• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Has anyone worked with Mobile Agents? (Servlet AND Mobile Agent)  RSS feed

 
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Have anyone implemented mobile agent before?
Also, have anyone tried integrading Servlet with Agents? Thanks
 
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have these notes from my servlets related URL collection
http://www.vistabonita.com/papers/DistributedComputingTopics.html - also AGLETS
http://www.vistabonita.com/papers/JMS/Introduction.html - paper on JMS
also the TACOS mobile agents in java
http://www.agentgo.com/aboutus.htm - mobile Java & XML wireless applications
Definately a cool topic - many books about "distributed computing" talk about mobile agents - servlets are a logical component since it should be easy for mobile agents to communicate via HTTP.
Bill
 
Ken Shamrock
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh thanks.im a new baby on this topic
Have you tried them out?(Servlet+Agent)
I got many problem on this.
Also, can servlet help create a context for placing mobile agents? Or it can just help creating the agents? thanks
 
Ken Shamrock
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I had 1 servlet file and agent class created but can't work on Aglet2 yet (someone said the code can run on Aglet1.0.3 but I want to use Aglet2) the code and error is shown below, does anyone know how to overcome this? Thanks
code:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import com.ibm.aglet.*;
import java.net.*;
import com.ibm.aglet.system.*;
import com.ibm.aglet.event.*;
import java.sql.*;
public class example extends HttpServlet {
//Initialize global variables
public void init(ServletConfig config) throws ServletException {
super.init(config);
}
//Process the HTTP Get request
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = new PrintWriter (response.getOutputStream());

AgletProxy Proxy = null;
String text = "";
String values[];

values = request.getParameterValues("textfield1");
if (values != null) {
text = values[0];
}

out.println("<html>");
out.println("<body bgcolor=\"#FFFFFF\">");
out.println("<form name = \"form1\" method= \"post\" action = \"/user/servlet/example\">");
out.println("<table>");
out.println("<tr><td>From User</td><td>From Aglet</td></tr>");
out.println("<tr>");
out.println("<td><input type=\"text\" name=\"textfield1\" value=\""+text+"\"></td>");


try
{

Proxy = null;
FutureReply reply = null;
Proxy = Aglets.createAglet("atp://203.218.14.20:4434",null,"sampleaglet1",null);
reply = Proxy.sendFutureMessage(new Message(text));
reply.waitForReply(5000);
if (reply.isAvailable())
{
out.println("<td><input type=\"text\" READONLY name=\"textfield2\" value=\""+reply.getReply()+"\"></td>");
}
else
{
}
Proxy.dispose();
}
catch (Exception e)
{
e.printStackTrace();
}

out.println("</tr>");
out.println("<tr><td><input type=\"submit\" name=\"Submit\" value=\"Submit\"></td></tr>");
out.println("</table>");
out.println("</form>");
out.println("</body>");
out.println("</html>");
out.close();
}
//Process the HTTP Post request
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request,response);
}
}
--
Starting service Tomcat-Standalone
Apache Tomcat/4.0.1
Starting service Tomcat-Apache
Apache Tomcat/4.0.1
[Reading security policy file:
E:\jdk1.4\jre\lib\security\java.policy... done.]
[Reading security policy file: E:\Documents and
Settings\shanemcmahon\.java.policy... done.]
[Loading shared secrets from file E:\Documents and
Settings\shanemcmahon\.aglets
\security\secrets.dat ... file not found.]
No secrets.
---------------------------------------------
Licensed Materials - Property of IBM
(c) Copyright IBM Corp.
1996, 1998 All rights reserved.
US Government Users Restricted Rights -
Use, duplication or disclosure restricted
by GSA ADP Schedule Contract with IBM Corp.
---------------------------------------------
[IBM Aglets Class Library 2.1.0]
java.net.MalformedURLException: unknown protocol:atp
at java.net.URL.<init>(URL.java:398)
at java.net.URL.<init>(URL.java:323)
at java.net.URL.<init>(URL.java:318)
at java.net.URL.<init>(URL.java:253)
at java.net.URL.<init>(URL.java:274)
at com.ibm.aglet.Ticket.getDestination(Ticket.java:179)
at com.ibm.maf.atp.MAFAgentSystem_ATPClient.<init>(MAFAgentSystem_ATPClient.java:108)
at com.ibm.maf.atp.Handler.getMAFAgentSystem(Handler.java:113)

What problem it probaby is?Thanks
 
Ken Shamrock
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
//sample aglet1
import com.ibm.aglet.*;
import com.ibm.aglet.event.*;
import java.io.*;
import java.util.*;

public class sampleaglet1 extends Aglet{

public boolean handleMessage(Message msg)
{
msg.sendReply("From Aglet : " + msg.getKind());
return true;
}
}
 
Author and ninkuma
Marshal
Posts: 66820
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dan Dales,
Your post was moved to a new topic.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!