Discussion:
[jade-develop] JadeGateway and interaction with Servlet
Gianvito Siciliano
2014-06-03 14:45:32 UTC
Permalink
Hi, i started using Jade recently, and i have some problem with the
JadeGateway configuration.

1) I start jade RMA by terminal using java jade.Boot -gui
(in the CLASSPATH i've added jade.jar and mywebapp.jar that include
AgenteGateway class and User class)

2) to running the web app i use eclipse and Tomcat (with jade.jar)

...also in localhost:

3) if i run Tomcat Server without mywebapp.jar the error is this:

(during jadeGateway.execute("agents.AgenteGateway", null))

INFORMAZIONI: --------------------------------------

Agent container Container-1 at 172.16.71.173 is ready.

--------------------------------------------

jade.wrapper.ControllerException: Error creating GatewayAgent [
java.lang.ClassNotFoundException: agents.AgenteGateway]

at jade.wrapper.gateway.DynamicJadeGateway.checkJADE(
DynamicJadeGateway.java:147)

at jade.wrapper.gateway.DynamicJadeGateway.execute(
DynamicJadeGateway.java:86)

at jade.wrapper.gateway.DynamicJadeGateway.execute(
DynamicJadeGateway.java:68)

at jade.wrapper.gateway.JadeGateway.execute(JadeGateway.java:79)

at servlet.ServletValida.doPost(ServletValida.java:97)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:303)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:208)

at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:208)

at org.apache.catalina.core.StandardWrapperValve.invoke(
StandardWrapperValve.java:220)

at org.apache.catalina.core.StandardContextValve.invoke(
StandardContextValve.java:122)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(
AuthenticatorBase.java:501)

at org.apache.catalina.core.StandardHostValve.invoke(
StandardHostValve.java:171)

at org.apache.catalina.valves.ErrorReportValve.invoke(
ErrorReportValve.java:102)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)

at org.apache.catalina.core.StandardEngineValve.invoke(
StandardEngineValve.java:116)

at org.apache.catalina.connector.CoyoteAdapter.service(
CoyoteAdapter.java:408)

at org.apache.coyote.http11.AbstractHttp11Processor.process(
AbstractHttp11Processor.java:1040)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(
AbstractProtocol.java:607)

at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(
JIoEndpoint.java:316)

at java.util.concurrent.ThreadPoolExecutor.runWorker(
ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(
ThreadPoolExecutor.java:617)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(
TaskThread.java:61)

at java.lang.Thread.run(Thread.java:745



4) if i run Tomcat with mywebapp.jar in the run configuration i can enter
in the CommandProcess method but the problem now is with the serialized
object sent like parameter

java.lang.ClassCastException: bean.User cannot be cast to bean.User

at agents.AgenteGateway.processCommand(AgenteGateway.java:37)

at jade.wrapper.gateway.GatewayAgent$2.processCommand(GatewayAgent.java:85)

at jade.wrapper.gateway.GatewayBehaviour.action(GatewayBehaviour.java:44)

at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:344)

at jade.core.Agent$ActiveLifeCycle.execute(Agent.java:1532)

at jade.core.Agent.run(Agent.java:1471)

at java.lang.Thread.run(Thread.java:745)

giu 03, 2014 4:40:16 PM jade.wrapper.gateway.GatewayBehaviour releaseCommand

INFORMAZIONI: ControlContainer-2 terminated execution of command
bean.User at 38ab625c


ps....in this case in the RMA appear a new Container with ControlContainer
agent.


Please help me.

Thank you in advance.


Gianvito
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://avalon.cselt.it/pipermail/jade-develop/attachments/20140603/b40e9f64/attachment.html>
Liz Flores
2014-06-03 16:17:18 UTC
Permalink
Hi Gianvito,


I am making a project with servlets, Tomcat and Eclipse too. In the
classpath (run configurations) of my project I included myproject.jar,
jade.jar and the commons-codec-1.3.jar. And it is important to include this
when you run the agent, like the following:

java -cp
lib\jade.jar;lib\commons-codec\commons-codec-1.3.jar;lib\MyProject.jar
jade.Boot -gui -container -agents myagent:agent.AgentExample


If you have problems you can write me and I will be glad to help you.



Liz Flores
Post by Gianvito Siciliano
Hi, i started using Jade recently, and i have some problem with the
JadeGateway configuration.
1) I start jade RMA by terminal using java jade.Boot -gui
(in the CLASSPATH i've added jade.jar and mywebapp.jar that include
AgenteGateway class and User class)
2) to running the web app i use eclipse and Tomcat (with jade.jar)
(during jadeGateway.execute("agents.AgenteGateway", null))
INFORMAZIONI: --------------------------------------
Agent container Container-1 at 172.16.71.173 is ready.
--------------------------------------------
jade.wrapper.ControllerException: Error creating GatewayAgent [
java.lang.ClassNotFoundException: agents.AgenteGateway]
at jade.wrapper.gateway.DynamicJadeGateway.checkJADE(
DynamicJadeGateway.java:147)
at jade.wrapper.gateway.DynamicJadeGateway.execute(
DynamicJadeGateway.java:86)
at jade.wrapper.gateway.DynamicJadeGateway.execute(
DynamicJadeGateway.java:68)
at jade.wrapper.gateway.JadeGateway.execute(JadeGateway.java:79)
at servlet.ServletValida.doPost(ServletValida.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(
StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(
StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(
AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(
StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(
ErrorReportValve.java:102)
at org.apache.catalina.valves.AccessLogValve.invoke(
AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(
StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(
CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(
AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(
AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(
JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(
ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(
ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(
TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745
4) if i run Tomcat with mywebapp.jar in the run configuration i can enter
in the CommandProcess method but the problem now is with the serialized
object sent like parameter
java.lang.ClassCastException: bean.User cannot be cast to bean.User
at agents.AgenteGateway.processCommand(AgenteGateway.java:37)
at jade.wrapper.gateway.GatewayAgent$2.processCommand(GatewayAgent.java:85
)
at jade.wrapper.gateway.GatewayBehaviour.action(GatewayBehaviour.java:44)
at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:344)
at jade.core.Agent$ActiveLifeCycle.execute(Agent.java:1532)
at jade.core.Agent.run(Agent.java:1471)
at java.lang.Thread.run(Thread.java:745)
giu 03, 2014 4:40:16 PM jade.wrapper.gateway.GatewayBehaviour
releaseCommand
INFORMAZIONI: ControlContainer-2 terminated execution of command
bean.User at 38ab625c
ps....in this case in the RMA appear a new Container with ControlContainer
agent.
Please help me.
Thank you in advance.
Gianvito
_______________________________________________
jade-develop mailing list
jade-develop at avalon.tilab.com
https://avalon.cselt.it/mailman/listinfo/jade-develop
UNSUBSCRIBE INSTRUCTIONS AT
http://jade.tilab.com/community-mailinglist.htm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://avalon.cselt.it/pipermail/jade-develop/attachments/20140603/ae684967/attachment.html>
Liz Flores
2014-06-03 17:46:35 UTC
Permalink
Hi Gianvito,


I don?t run the Gateway agent by the console. I start it in the servlet.
You can find an example in the folder doc/tutorials/JadeGateway.pdf of
jade.


I run the gateway like this:


*public* *void* init() *throws* ServletException {

JadeGateway.*init*("agentpackage.myAgent",*null*);

}


So you can use it when you write:


*try* {

JadeGateway.*execute*(myMessage);

} *catch*(Exception e) {

System.*out*.println(e);

}



Kind regards.


Liz Flores


2014-06-03 12:06 GMT-05:00 Gianvito Siciliano <gianvito.siciliano at gmail.com>
Thank you very much for the answer, but i can't resolve the problem: is
very strange!
- echo $CLASSPATH
1) when i try to run with a new container (java jade.Boot -gui -container
-agents agente:agents.AgenteGateway)
INFORMAZIONI: ...
Retrieving CommandDispatcher for platform null
giu 03, 2014 6:59:38 PM jade.imtp.leap.LEAPIMTPManager initialize
- jicp://172.17.23.152:1099
giu 03, 2014 6:59:38 PM jade.core.AgentContainerImpl joinPlatform
GRAVE: Some problem occurred while joining agent platform.
jade.core.ProfileException: Can't get a proxy to the Platform Manager
[nested jade.core.IMTPException: Dispatcher error [nested
jade.imtp.leap.DispatcherException: DispatcherException in remote site. No
skeleton for object-id 0]]
at jade.core.ProfileImpl.createPlatformManager(ProfileImpl.java:534)
at jade.core.ProfileImpl.getPlatformManager(ProfileImpl.java:447)
at jade.core.ProfileImpl.getServiceManager(ProfileImpl.java:461)
at jade.core.AgentContainerImpl.init(AgentContainerImpl.java:343)
at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:482)
at jade.core.Runtime.createAgentContainer(Runtime.java:133)
at jade.Boot.main(Boot.java:91)
giu 03, 2014 6:59:38 PM jade.core.Runtime$1 run
INFORMAZIONI: JADE is closing down now.
2) with main container (java jade.Boot -gui -host localhost -agents
agente:agents.AgenteGateway)
it create the agent but...
INFORMAZIONI: Started GatewayAgent agente
giu 03, 2014 7:05:19 PM jade.core.AgentContainerImpl joinPlatform
INFORMAZIONI: --------------------------------------
Agent container Main-Container at 172.17.23.152 is ready.
--------------------------------------------
jade.imtp.leap.LEAPSerializationException: Cannot deserialize
ServiceDescriptor: class jade.core.resource.ResourceManagementService for
service jade.core.resource.ResourceManagement not found
at
jade.imtp.leap.DeliverableDataInputStream.deserializeServiceDescriptor(DeliverableDataInputStream.java:543)
at
jade.imtp.leap.DeliverableDataInputStream.readObject(DeliverableDataInputStream.java:150)
at
jade.imtp.leap.DeliverableDataInputStream.deserializeVector(DeliverableDataInputStream.java:355)
at
jade.imtp.leap.DeliverableDataInputStream.readObject(DeliverableDataInputStream.java:128)
at
jade.imtp.leap.DeliverableDataInputStream.deserializeCommand(DeliverableDataInputStream.java:467)
at
jade.imtp.leap.CommandDispatcher.deserializeCommand(CommandDispatcher.java:551)
at
jade.imtp.leap.CommandDispatcher.handleCommand(CommandDispatcher.java:914)
at
jade.imtp.leap.JICP.JICPServer$ConnectionHandler.run(JICPServer.java:439)
Hi Gianvito,
Post by Liz Flores
I am making a project with servlets, Tomcat and Eclipse too. In the
classpath (run configurations) of my project I included myproject.jar,
jade.jar and the commons-codec-1.3.jar. And it is important to include this
java -cp
lib\jade.jar;lib\commons-codec\commons-codec-1.3.jar;lib\MyProject.jar
jade.Boot -gui -container -agents myagent:agent.AgentExample
If you have problems you can write me and I will be glad to help you.
Liz Flores
2014-06-03 9:45 GMT-05:00 Gianvito Siciliano <
Post by Gianvito Siciliano
Hi, i started using Jade recently, and i have some problem with the
JadeGateway configuration.
1) I start jade RMA by terminal using java jade.Boot -gui
(in the CLASSPATH i've added jade.jar and mywebapp.jar that include
AgenteGateway class and User class)
2) to running the web app i use eclipse and Tomcat (with jade.jar)
(during jadeGateway.execute("agents.AgenteGateway", null))
INFORMAZIONI: --------------------------------------
Agent container Container-1 at 172.16.71.173 is ready.
--------------------------------------------
jade.wrapper.ControllerException: Error creating GatewayAgent [
java.lang.ClassNotFoundException: agents.AgenteGateway]
at jade.wrapper.gateway.DynamicJadeGateway.checkJADE(
DynamicJadeGateway.java:147)
at jade.wrapper.gateway.DynamicJadeGateway.execute(
DynamicJadeGateway.java:86)
at jade.wrapper.gateway.DynamicJadeGateway.execute(
DynamicJadeGateway.java:68)
at jade.wrapper.gateway.JadeGateway.execute(JadeGateway.java:79)
at servlet.ServletValida.doPost(ServletValida.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52
)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(
StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(
StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(
AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(
StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(
ErrorReportValve.java:102)
at org.apache.catalina.valves.AccessLogValve.invoke(
AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(
StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(
CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(
AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(
AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(
JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(
ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(
ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(
TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745
4) if i run Tomcat with mywebapp.jar in the run configuration i can
enter in the CommandProcess method but the problem now is with the
serialized object sent like parameter
java.lang.ClassCastException: bean.User cannot be cast to bean.User
at agents.AgenteGateway.processCommand(AgenteGateway.java:37)
at jade.wrapper.gateway.GatewayAgent$2.processCommand(
GatewayAgent.java:85)
at jade.wrapper.gateway.GatewayBehaviour.action(GatewayBehaviour.java:44
)
at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:344)
at jade.core.Agent$ActiveLifeCycle.execute(Agent.java:1532)
at jade.core.Agent.run(Agent.java:1471)
at java.lang.Thread.run(Thread.java:745)
giu 03, 2014 4:40:16 PM jade.wrapper.gateway.GatewayBehaviour
releaseCommand
INFORMAZIONI: ControlContainer-2 terminated execution of command
bean.User at 38ab625c
ps....in this case in the RMA appear a new Container with
ControlContainer agent.
Please help me.
Thank you in advance.
Gianvito
_______________________________________________
jade-develop mailing list
jade-develop at avalon.tilab.com
https://avalon.cselt.it/mailman/listinfo/jade-develop
UNSUBSCRIBE INSTRUCTIONS AT
http://jade.tilab.com/community-mailinglist.htm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://avalon.cselt.it/pipermail/jade-develop/attachments/20140603/0aa84752/attachment-0001.html>
Loading...