I'm having trouble creating an agent with JADE.
My structure
/
Applications
jade
lib
jade.jar
jadeExamples.jar
src
examples
hello
HelloWorldAgent.class
HelloWorldAgent.java
My file HelloWorldAgent.java
package examples.hello;
import jade.core.Agent;
public class HelloWorldAgent extends Agent {
protected void setup() {
System.out.println("Hello! My name is "+getLocalName());
}
}
The steps I follow to create an agent :
/Applications/jade/src/examples/hello $ javac *.java
/Applications/jade/src/examples/hello $ java jade.Boot -gui -agents fred:examples.hello.HelloWorldAgent
Myclasspath
/Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home:/Applications/jade/lib/jade.jar:/Applications/jade/lib/jadeExamples.jar:/Applications/jade/src/
The output
Sep 21, 2019 5:28:05 PM jade.core.Runtime beginContainer
INFO: ----------------------------------
This is JADE 4.5.0 - revision 6825 of 23-05-2017 10:06:04
downloaded in Open Source, under LGPL restrictions,
at http://jade.tilab.com/
----------------------------------------
Sep 21, 2019 5:28:05 PM jade.imtp.leap.LEAPIMTPManager initialize
INFO: Listening for intra-platform commands on address:
- jicp://192.168.1.104:1099
Sep 21, 2019 5:28:06 PM jade.core.BaseService init
INFO: Service jade.core.management.AgentManagement initialized
Sep 21, 2019 5:28:06 PM jade.core.BaseService init
INFO: Service jade.core.messaging.Messaging initialized
Sep 21, 2019 5:28:06 PM jade.core.BaseService init
INFO: Service jade.core.resource.ResourceManagement initialized
Sep 21, 2019 5:28:06 PM jade.core.BaseService init
INFO: Service jade.core.mobility.AgentMobility initialized
Sep 21, 2019 5:28:06 PM jade.core.BaseService init
INFO: Service jade.core.event.Notification initialized
Sep 21, 2019 5:28:11 PM jade.mtp.http.HTTPServer <init>
INFO: HTTP-MTP Using XML parser com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser
Sep 21, 2019 5:28:11 PM jade.core.messaging.MessagingService boot
INFO: MTP addresses:
http://192.168.1.104:7778/acc
Hello World! My name is fred
Sep 21, 2019 5:28:11 PM jade.core.AgentContainerImpl joinPlatform
INFO: --------------------------------------
Agent container Main-Container#192.168.1.104 is ready.
--------------------------------------------
My problem
If I change the message in the HelloWorldAgent (e.g. System.out.println("Hello ! My name is "+getLocalName());), it doesn't update when I run my agent (the console says Hello World! My name is fred). And when I create a new class in the hello folder, I can't find my agent in the GUI.
What have I missed?
You have not set the classpath correctly. As mentioned in the accepted answer to 'What is a classpath and how do I set it?', your classpath can contain two entry types:
So, classpaths contain:
JAR files, and
Paths to the top of package hierarchies.
In your case you have reference ONLY the following .jar files :
/Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home
/Applications/jade/lib/jade.jar
/Applications/jade/lib/jadeExamples.jar
Notice that your working path /Applications/jade/src/examples/hello/ is not in the classpath. This means that your custom jade classes are not visible/accessable.
To solve your problem you have to add the additional paths you want to use in your classpaths. Usually you use the directory . to indicate that you want the "current directory" in your classpath.
Keep in mind that you have the JAR file jadeExamples.jar in your classpath. When you have a .class file for your changed HelloWorldAgent class it might not be clear which class the JVM is loading, the one from the JAR file or the .class file from the file system. Do not provide the same class with the same package in your classpath twice or even change the jadeExamples.jar file with a new changed JAR file (this might be even more confusing). Instead, create a new agent in YOUR package/namespace/directory and load it -agents foobar:your.package.and.ClassName, but ensure that the classpath is set correctly .
Related
org.jenkinsci.remoting.engine.WorkDirManager initializeW orkDir
INFO: Using /home/ubuntu/jenkins/remoting as a remoting work directory
May 11, 2022 4:35:54 PM org.jenkinsci.remoting.engine.WorkDirManager setupLoggin g
INFO: Both error and output logs will be printed to /home/ubuntu/jenkins/remotin g
May 11, 2022 4:35:55 PM hudson.remoting.jnlp.Main createEngine
INFO: Setting up agent: production
May 11, 2022 4:35:55 PM hudson.remoting.jnlp.Main$CuiListener
INFO: Jenkins agent is running in headless mode.
May 11, 2022 4:35:55 PM hudson.remoting.Engine startEngine
INFO: Using Remoting version: 4.13
May 11, 2022 4:35:55 PM org.jenkinsci.remoting.engine.WorkDirManager initializeW orkDir
INFO: Using /home/ubuntu/jenkins/remoting as a remoting work directory
May 11, 2022 4:35:55 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among [http://54.164.155.216:8080/]
May 11, 2022 4:35:55 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
May 11, 2022 4:36:00 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver isPortVisible
WARNING: connect timed out
May 11, 2022 4:36:00 PM hudson.remoting.jnlp.Main$CuiListener error
SEVERE: http://54.164.155.216:8080/ provided port:33725 is not reachable
java.io.IOException: http://54.164.155.216:8080/ provided port:33725 is not reac hable
at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpA gentEndpointResolver.java:311)
at hudson.remoting.Engine.innerRun(Engine.java:733)
at hudson.remoting.Engine.run(Engine.java:539)
I created a staging node and production node, I downloaded the agent.jar and slave-agent.jnlp for both nodes, and copy them to the servers.
I tried this command - java -jar agent.jar -jnlpUrl http://54.164.155.216:80 80/computer/production/jenkins-agent.jnlp -secret 0f69af1947110e62d0696f49aa07e0 7d30387478c6b1d0ae204b8aab6943baf6 -workDir "/home/ubuntu/jenkins"
I go the error below. I could establish a connection to the "built-in node", which I believe is the master node..Right?
Or do I need to create a master node and delete the built-in node that was there when I logged into the Jenkins?
I've successfully deployed a war file that I exported using Eclipse to a local instance of a TomEE server, but when trying to do exactly the same thing with the war file on another server, I get the following output to the console:
Jul 30, 2014 12:50:47 PM org.apache.openejb.util.JarExtractor extract
INFO: Extracting jar: C:\Apache TomEE\apache-tomee-plus-1.6.0.2\webapps\MyWar.war
Jul 30, 2014 12:50:47 PM org.apache.openejb.util.JarExtractor extract
INFO: Extracted path: C:\Apache TomEE\apache-tomee-plus-1.6.0.2\webapps\MyWar
Jul 30, 2014 12:50:48 PM org.apache.myfaces.ee6.MyFacesContainerInitializer onSt
artup
INFO: Added FacesServlet with mappings=[/faces/*, *.jsf, *.faces]
Jul 30, 2014 12:50:48 PM org.apache.tomee.myfaces.TomEEMyFacesContainerInitializ
er addListener
INFO: Installing <listener>org.apache.myfaces.webapp.StartupServletContextListen
er</listener>
Jul 30, 2014 12:50:48 PM org.apache.myfaces.config.DefaultFacesConfigurationProv
ider getStandardFacesConfig
INFO: Reading standard config META-INF/standard-faces-config.xml
Jul 30, 2014 12:50:48 PM org.apache.myfaces.config.DefaultFacesConfigurationProv
ider getClassloaderFacesConfig
INFO: Reading config : jar:file:/C:/Apache%20TomEE/apache-tomee-plus-1.6.0.2/lib
/openwebbeans-el22-1.2.1.jar!/META-INF/faces-config.xml
Jul 30, 2014 12:50:48 PM org.apache.myfaces.config.DefaultFacesConfigurationProv
ider getClassloaderFacesConfig
INFO: Reading config : jar:file:/C:/Apache%20TomEE/apache-tomee-plus-1.6.0.2/lib
/openwebbeans-jsf-1.2.1.jar!/META-INF/faces-config.xml
Jul 30, 2014 12:50:48 PM org.apache.myfaces.config.LogMetaInfUtils logArtifact
INFO: Artifact 'myfaces-api' was found in version '2.1.13' from path 'file:/C:/A
pache%20TomEE/apache-tomee-plus-1.6.0.2/lib/myfaces-api-2.1.13.jar'
Jul 30, 2014 12:50:48 PM org.apache.myfaces.config.LogMetaInfUtils logArtifact
INFO: Artifact 'myfaces-impl' was found in version '2.1.13' from path 'file:/C:/
Apache%20TomEE/apache-tomee-plus-1.6.0.2/lib/myfaces-impl-2.1.13.jar'
Jul 30, 2014 12:50:48 PM org.apache.myfaces.application.ApplicationImpl getProje
ctStage
INFO: Couldn't discover the current project stage, using Production
Jul 30, 2014 12:50:48 PM org.apache.myfaces.config.FacesConfigurator handleSeria
lFactory
INFO: Serialization provider : class org.apache.myfaces.shared_impl.util.serial.
DefaultSerialFactory
Jul 30, 2014 12:50:48 PM org.apache.myfaces.config.annotation.DefaultLifecyclePr
oviderFactory getLifecycleProvider
INFO: Using LifecycleProvider org.apache.myfaces.config.annotation.Tomcat7Annota
tionLifecycleProvider
Jul 30, 2014 12:50:48 PM org.apache.myfaces.webapp.AbstractFacesInitializer init
Faces
INFO: ServletContext initialized.
... the EJBs that are contained within the WAR are not initialised, and nothing happens.
Upon server restart, I get ClassNotFoundExceptions for all of the classes contained within my WAR (and now within WEB-INF/classes once exploded)
Can anyone help?
Guess it comes from the space, try in another folder with space maybe.
I created two agents and it runs well. but when I add Ontology class and registered the ontology I can't create the agents... I got following errors..
Jun 1, 2012 8:56:55 AM jade.core.BaseService init
INFO: Service jade.core.management.AgentManagement initialized
Jun 1, 2012 8:56:55 AM jade.core.BaseService init
INFO: Service jade.core.messaging.Messaging initialized
Jun 1, 2012 8:56:55 AM jade.core.BaseService init
INFO: Service jade.core.mobility.AgentMobility initialized
Jun 1, 2012 8:56:55 AM jade.core.BaseService init
INFO: Service jade.core.event.Notification initialized
Jun 1, 2012 8:56:55 AM jade.core.messaging.MessagingService clearCachedSlice
INFO: Clearing cache
Jun 1, 2012 8:56:55 AM jade.mtp.http.HTTPServer <init>
INFO: HTTP-MTP Using XML parser com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser
Jun 1, 2012 8:56:55 AM jade.core.messaging.MessagingService boot
INFO: MTP addresses:
http://169.254.108.164:7778/acc
Jun 1, 2012 8:56:55 AM jade.core.AgentContainerImpl startBootstrapAgents
SEVERE: Cannot create agent STMAgent: An undeclared exception was thrown [nested java.lang.ExceptionInInitializerError]
Jun 1, 2012 8:56:55 AM jade.core.AgentContainerImpl startBootstrapAgents
SEVERE: Cannot create agent REquestAgent: An undeclared exception was thrown [nested java.lang.NoClassDefFoundError: Could not initialize class FruitOntology.FruitOntology]
Jun 1, 2012 8:56:55 AM jade.core.AgentContainerImpl joinPlatform
class paths are correct. Ontology class paths are also correct.. What is the reason for this? Plz help me............
I found error.. it is on my ontology class..
Thank you..
The crucial error message seems to be:
SEVERE: Cannot create agent REquestAgent: An undeclared exception was thrown
[nested java.lang.NoClassDefFoundError:
Could not initialize class FruitOntology.FruitOntology]
Your code is not finding class FruitOntology in the package FruitOntology (which isn't a very good package name - normally, a package name would start with a lower-case letter, and would normally follow the convention of reversing the domain name of the organization).
As you haven't shown any of your code, we can only guess why that error arises. Have you perhaps mis-spelled the name in a configuration file somewhere? Do a grep through your project to see where FruitOntology.FruitOntology occurs. It probably isn't in normal Java code, as you would get a compilation error for missing classes, unless you're using Java Reflection for some reason.
I've to start working on a web-app project for which I've Eclipse Indigo and Tomcat 7.0 installed. The environment also has JRE 7, Android SDK in it. But whenever I start the server, it gets timed out!
Moreover, I'm able to start the server outside Eclipse and sucessfully execute a web app in the browser. But to debug, I would rather have it in Eclipse.
The error message is:
Server Tomcat v7.0 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.
In the console I get:
Mar 14, 2012 11:51:18 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\program files\Java\jre7\bin;C:\WINNT\Sun\Java\bin;C:\WINNT\system32;C:\WINNT;C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\oracle\product\11.1.0\BIN\;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\Executive Software\Diskeeper\;C:\Program Files\Pointsec\Pointsec Media Encryption\Program\;C:\Program Files\Windows Imaging\;C:\oracle\product\11.1.0\BIN;C:\Program Files\Reflection\;C:\eclipse;;.
Mar 14, 2012 11:51:18 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:AUDI_ASSIST_v2.0_WS_REDESIGN_Interceptor' did not find a matching property.
Mar 14, 2012 11:51:18 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-9080"]
Mar 14, 2012 11:51:18 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-9009"]
Mar 14, 2012 11:51:18 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 504 ms
Mar 14, 2012 11:51:18 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mar 14, 2012 11:51:18 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.26
Mar 14, 2012 11:51:18 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [109] milliseconds.
Mar 14, 2012 11:51:18 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(D:\documents and settings\fahmf\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp2\wtpwebapps\AUDI_ASSIST_v2.0_WS_REDESIGN_Interceptor\WEB-INF\lib\com.ibm.ws.webservices.thinclient_7.0.0.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Mar 14, 2012 11:51:20 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-9080"]
Mar 14, 2012 11:51:20 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-9009"]
Mar 14, 2012 11:51:20 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1697 ms
I have tried the solutions proposed in other questions on this forum like increasing the time out period,changing the port numbers, uninstalling & reinstalling Tomcat, changing the 'publisiing' option for the server but nothing seems to work.
Any help would be sincerely appreciated. Thanks in advance...
Just follow the Simple Steps
Double click on your desired server in the server-view , It will open the window and Right corner of the Window Timout option is availble and change time to 120 . it will work :)
For me the cause was Eclipse. Running the IDE with the '-clean' parameter solved it.
eclipse.exe -clean
Eclipse WTP usually tries to make sure that the web app is up by visiting the default page (/) of the app when you start the server. Until it gets an HTTP 200 (OK) response from that page - it thinks the app is not up. You are probably noticing the server icon (where you start tomcat from) still says "starting" with a green blinking.
I think Eclipse has a bug where it cannot handle a bunch of 302 on the page at / - which could happen if that page was redirecting to another page which was again redirecting to a login page.
SOLVED: That's it!!!! For me was compiling with JDK6 but running Tomcat with JDK7, WST uses the system properties and not the eclipse settings. I also configure the same JDK Version in eclipse and in System (check it with java -version in cmd line)
Details: I try to configure eclipse like describe here, but it didn´t solve the problem, then I notice in eclipse´s error log that tomcat was started with jre 1.7. in spite of my configurations.
I also try, in cmd line, 'java -version' and obtained '1.7' instead of expected '1.6'.
I also decide to configure java 1.6 (like in eclipse) in system panel but it didn´t solve the problem. I also desinstall jre 1.7 restart eclipse AND IT SUCCESS!.. It was a very usefull clue, thank you.
Verify the deployment-descriptor and check the value for <url-pattern>. This can be stopping tomcat to load.
You have to edit eclipse.ini and push to use Java 1.6
-vm
c:\Program Files\Java\jdk1.6.0_25\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Dhelp.lucene.tokenizer=standard
-Xms40m
-Xmx512m
http://wiki.eclipse.org/Eclipse.ini#-vm_value:_Windows_Example
Using tomcat's JULI logging (extension of jdk logging), is it possible to get log statements to include the context path of the webapp (for example /myapp). I have the same webapp deployed a few times with different configuration parameters in the web.xml. It would be very helpful to understand which webapp was spitting out which log statements.
Currently, the log output looks like:
Feb 22, 2012 9:37:57 AM org.mypackage.MyClass init
INFO: Model has been initialized
Feb 22, 2012 9:37:57 AM org.mypackage.MyClass init
INFO: after loading model: 1329921477445
I'd like to be able to include the context path of the webapp (or webapp name) before the class name. Something along these lines:
Feb 22, 2012 9:37:57 AM /mywebapp org.mypackage.MyClass init
INFO: Model has been initialized
Feb 22, 2012 9:37:57 AM /mywebapp org.mypackage.MyClass init
INFO: after loading model: 1329921477445
Thanks,
Matt
Use SLF4J and Logback in your webapps. Do not rely on Java Logging (JULI).