How to run Jade agents in two containers (from two consoles) - java

I'm new in Jade and study Jade Primer. I'm using the latest version Jade v4.2.
I'm trying to set up two behaviours, each coded to receive messages. I should run them in two separated windows, but it doesn't work for me.
I'm using Eclipse on WinXp. I have entered classpath to Jade
c:\jade\lib\jade.jar;C:\jade\lib\commons-codec\commons-codec-1.3.jar;C:\Program Files\Java\jre7\bin
and to folder containing my projects
C:\Users\me\workspace\jadeProject\src
There is folder primer4 (package added to Java code), where I put my Java files.
I compiled Java files by javac from console.
Then I tried to run from the console (from primar4 folder):
%java jade.Boot -agents a1:primer4.Responder;a2:primer4.Responder
The First command is working. Then I run second console window and put:
%java jade.Boot -container main:primer4.Template
INFO: Service jade.core.event.Notification initialized
pač 19, 2012 4:35:57 PM jade.core.AgentContainerImpl startBootstrapAgents
SEVERE: Cannot create agent main: Class primer4.Template for agent ( agent identifier
:name main#10.0.2.15:1099/JADE ) not found [nested java.lang.ClassNotFoundException: primer4.Template]
pač 19, 2012 4:35:57 PM jade.core.AgentContainerImpl joinPlatform
INFO: Agent container Container-2#10.0.2.15 is ready.
I got this error, can somebody tell me:
How can I fix it?
Is possible to run agents in two containers from one line in console (in one console, the same time)?

Try the -agents option in the second command:
java jade.Boot -container -agents main:primer4.Template

This is by the Classpath problem. So please make sure the directory which is having your .class files in the classpath.
you can create one agent per container by the
-container option.
or you can create the agents by
jade.core.Runtime runtime = jade.core.Runtime.instance();
jade.wrapper.AgentContainer home = runtime.createAgentContainer(new ProfileImpl());
home.createNewAgent(getName(), Agent.class.getName(), args);
Like this you can create the agents and add dynamically.

Related

Weblogic 12.2.1.3 Error: Could not find or load main class com.oracle.cie.wizard.WizardController

I was trying to configure Weblogic 12.2.1.3 on Linux account.
After going through oracle documentation, I understood we setup Weblogic by running config.sh script located in /opt/weblogic12213/wlserver_12.2.1.3/installation/oracle_common/common/bin folder.
But this script is giving error as :
Error: Could not find or load main class
com.oracle.cie.wizard.WizardController
Below is the last command which it executes in setup script and it is giving an error :
/usr/java/jdk1.8.0_192/bin/java -Dpython.cachedir=/tmp/cachedir
-Xms32m -Xmx1024m -Dweblogic.alternateTypesDirectory=/opt/weblogic12213/wlserver_12.2.1.3/installation/wlserver/../oracle_common/modules/oracle.oamprovider,/opt/weblogic12213/wlserver_12.2.1.3/installation/wlserver/../oracle_common/modules/oracle.jps
com.oracle.cie.wizard.WizardController -target=config-oneclick
scripts provided by weblogic doesn't set CLASSPATH correctly.
com.oracle.cie.wizard.WizardController comes under com.oracle.cie.wizard_7.8.2.0.jar .
Steps done.
1. Copied config_internal.sh script on some local path. (Because I didn't have the root permission.)
2. Appended this jar in CLASSPATH varibale like this :
CLASSPATH="${FMWCONFIG_CLASSPATH}${CLASSPATHSEP}${DERBY_CLASSPATH}:/opt/weblogic12213/wlserver_12.2.1.3/installation/oracle_common/modules/com.oracle.cie.wizard_7.8.2.0.jar"

I followed the steps of Google's help, but the credentials do not work [duplicate]

When running the Java quickstart sample at https://developers.google.com/drive/web/quickstart/java?hl=hu in NetBeans, I'm receiving the error code:
Jun 04, 2015 12:12:11 AM com.google.api.client.util.store.FileDataStoreFactory setPermissionsToOwnerOnly
WARNING: unable to change permissions for everybody:
C:\Users\Quibbles\credentials\drive-api-quickstart
What am I doing wrong?
Edit: This is the complete error message.
Jun 04, 2015 5:11:39 PM com.google.api.client.util.store.FileDataStoreFactory setPermissionsToOwnerOnly
WARNING: unable to change permissions for owner: C:\Users\Quibbles\.credentials\drive-api-quickstart
Exception in thread "main" java.lang.NullPointerException
at java.io.Reader.<init>(Reader.java:78)
at java.io.InputStreamReader.<init>(InputStreamReader.java:72)
at DriveQuickstart.authorize(DriveQuickstart.java:64)
at DriveQuickstart.getDriveService(DriveQuickstart.java:87)
at DriveQuickstart.main(DriveQuickstart.java:96)
Java Result: 1
Had the same issue and wasted hours before realizing that "unable to change permissions for owner: C:\Users\Quibbles.credentials\drive-api-quickstart"
is just a warning.
The real issue is the null pointer here.
InputStream in =
DriveQuickstart.class.getResourceAsStream("/client_secret.json");
This line was the issue in my case. "in" was null and hence the null pointer.
InputStream in = new FileInputStream("<Full Path>\\client_secret.json");
This resolved my issue.
The actual problem is a bug in Google's API code for setPermissionsToOwnerOnly
The code was written to only work on Linux/Unix based systems and not Windows ACL based systems.
You can ignore the warning or write your own DataStore class that sets the permissions correctly for Windows.
I'm going to try to file a bug with Google on it too.
I was facing same issue in Eclipse. Here’s a solution:
Run eclipse in admin mode
Clear the directory
C:/Users/<username>.credentials/calendar-java-quickstart.json
Copy the .json file the bin directory, e.g. bin/main/resources/client_secret.json
You are free to run now.
Basically if you already enabled de Drive API and created credentials.json file at Google Drive API Rest, now you need :
1 - Remove the tokens directory generated in you last execution. In this directory contains a file StoredCredential.
2 - Change de SCOPE to DriveScopes.DRIVE like sample bellow:
private static List SCOPES = Collections.singletonList(DriveScopes.DRIVE);
3 - Re run the program. It will be request that you login in your google account to give the access consent.
4 - It will be generated a new one tokens directory in your project and now with with read and write permissions at google Drive.
This work for me.
I just ran into the same issue with the https://developers.google.com/google-apps/calendar/quickstart/java example. I suspect that the issue is that you are running it in Windows and the JVM that you are running it does not have Adminsitrator rights for changing the file permissions in Windows.
See Run Java application as administrator on Windows
Had the same problem when running the example given in the tutorial "https://developers.google.com/drive/v2/web/quickstart/java". Followed the instruction ditto as given the in the tutorial, but kept getting this permission exception. Eventually, managed to sort it out by moving the "client_secret.json" to the "\build\classes\main\classes" folder. Also, before building the project with "gradle -q run" for the first time, delete any files in the "C:\Users\userName\.credentials" folder.
Just make sure that client_secret.json is under main/resources/ directory.
InputStream in =
DriveQuickstart.class.getResourceAsStream("/json/client_secret.json");
Was able to resolve the issue by deleting the StoredCredentials files under the token folder. I had to reauthenticate again with google the next time the program was executed.

Newrelic startup exception

We are getting the following error in catalina.out file when we restart our application with newrelic java agent configured.
We have followed the steps specified in newrelic installation guide and following is the entry created in catalina.sh by newrelic installer:
# ---- New Relic switch automatically added to start command on 2013 Dec 09, 20:24:35
NR_JAR=/usr/share/fk-ops-tomcat6-base/newrelic/newrelic.jar; export NR_JAR
JAVA_OPTS="$JAVA_OPTS -javaagent:$NR_JAR"; export JAVA_OPTS
Exception on app restart in catalina.out:
Error bootstrapping New Relic agent: java.lang.RuntimeException: java.io.IOException: No such file or directory
java.lang.RuntimeException: java.io.IOException: No such file or directory
at com.newrelic.bootstrap.BootstrapLoader.load(BootstrapLoader.java:95)
at com.newrelic.bootstrap.BootstrapAgent.premain(BootstrapAgent.java:93)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:323)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)
Caused by: java.io.IOException: No such file or directory
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.checkAndCreate(File.java:1704)
at java.io.File.createTempFile(File.java:1792)
at java.io.File.createTempFile(File.java:1828)
at com.newrelic.bootstrap.BootstrapLoader.getJarFileInAgent(BootstrapLoader.java:81)
at com.newrelic.bootstrap.BootstrapLoader.addBridgeJarToClassPath(BootstrapLoader.java:47)
at com.newrelic.bootstrap.BootstrapLoader.load(BootstrapLoader.java:92)
... 7 more
I just encountered the same problem. The not very helpful error message alluded to the fact that the newrelic agent (or rather the user under which my server is running) wasn't able to write into /tmp. Maybe that helps!
I hit that exception with that stack trace recently, and in my case it was caused by the temporary directory not existing at all.
In particular: by default tomcat uses $CATALINA_BASE/temp as value for the java.io.tmpdir property, and seems to create that when needed. At the time the newrelic agent boots up however it may not yet exist, and so newrelic agent fails with that exception.
After restarting things are fine (now the directory exists!), but I solved in my startup scripts:
1. set the value of CATALINA_TMPDIR explicitly to something I control
2. ensure that directory exists before starting tomcat.
Make sure the newrelic.yml placed and marked readable in the same directory as the .jar
I work for New Relic.
As you've seen from the answers above, there can be multiple causes for this kind of message - some of which are pretty unexpected. Since this forum is not intended for back-and-forth messaging about incidents, in case neither of the previous two answers solved the problem for you, your best bet will be to open a ticket for support at http://support.newrelic.com where we can ask to look at your logfile and gather debug logs as necessary.
I had the same problem using apache version 6.0.33. Once I upgraded to 7.0.53 everything worked.
save problem.
But I found this:
Sep 09, 2015 11:19:48 AM org.apache.catalina.startup.Catalina initDirs
SEVERE: Cannot find specified temporary folder at /mnt/apache-tomcat-7.0.56/temp
then doing this:
mkdir /mnt/apache-tomcat-7.0.56/temp
cp /mnt/apache-tomcat-7.0.56/newrelic/* /mnt/apache-tomcat-7.0.56/temp
Everything works.
You may not need cp.
If you look at very early of Tomcat log (catalina.out) after NewRelic exception, you can see what folder is required that are missing. Here is mine:
May 29, 2017 5:04:31 PM org.apache.catalina.startup.Catalina initDirs
SEVERE: Cannot find specified temporary folder at /var/log/tomcat/tomcat7/temp
May 29, 2017 5:04:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/7.0.59
Hope this help

Glassfish hangs on OS X 10.5/Java 6

I want to play around with glassfish on a Mac, but I'm having trouble getting it to start.
I've followed the installation instructions and created a default domain, which seemed to go fine, but when I try to start it (asadmin start-domain domain1) it just sits there:
[kris#Macintosh-2:~/glassfish] ./bin/asadmin start-domain domain1
Starting Domain domain1, please wait.
Default Log location is /Users/kris/glassfish/domains/domain1/logs/server.log.
Redirecting output to /Users/kris/glassfish/domains/domain1/logs/server.log
The log contains nothing but the command to launch the server:
Mar 12, 2009 7:09:40 PM com.sun.enterprise.admin.servermgmt.launch.ASLauncher buildCommand
INFO:
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java
<crapload of system properties>
-client
-XX:+UnlockDiagnosticVMOptions
-XX:MaxPermSize=192m
-Xmx512m
-XX:NewRatio=2
-XX:+LogVMOutput
-XX:LogFile=/Users/kris/glassfish/domains/domain1/logs/jvm.log
-cp
/Users/kris/glassfish/lib/jhall.jar:/Users/kris/glassfish/lib/appserv-launch.jar
com.sun.enterprise.server.PELaunch
start
Eventually, asadmin gives up waiting:
Timeout waiting for domain domain1 to go to starting state.
CLI156 Could not start the domain domain1.
This is using glassfish v2.1, but I get similar behaviour on v3 prelude. I've also tried both java 5 and 6. I'm at a loss as to what sort of debugging to do as it doesn't seem to be even getting off the ground.
I was able to start my glassfish for the first time, but the second time, it just gives me that weird error message that it could not start the domain.
Googling around, there was mention of a lock file in the imq.
Check if you have a file 'lock' in "/glassfish/domains/domain1/imq/instances/imqbroker/". If there is one, delete it, and then try to start glassfish again.
Also on the JMS front, have you tried changing your broker from EMBED to LOCAL in your domain.xml? I seem to remember that help on OS X.
Have you perhaps moved the glassfish installation dir since you first started it up? GF gets very confused about caching when you do this. Solution here.

tomcat5 fails to start on CentOS 5 with NoClassDefFoundError exception

Tomcat fails to start even if i remove all my applications from the WEBAPPS directory leaving everything just like after the OS installation.
The log (catalina.out) says:
Using CATALINA_BASE: /usr/share/tomcat5
Using CATALINA_HOME: /usr/share/tomcat5
Using CATALINA_TMPDIR: /usr/share/tomcat5/temp
Using JRE_HOME:
Created MBeanServer with ID: -dpv07y:fl4s82vl.0:hydrogenium.timberlinecolorado.com:1
java.lang.NoClassDefFoundError: org.apache.catalina.core.StandardService
at java.lang.Class.initializeClass(libgcj.so.7rh)
at java.lang.Class.initializeClass(libgcj.so.7rh)
at java.lang.Class.initializeClass(libgcj.so.7rh)
at java.lang.Class.newInstance(libgcj.so.7rh)
at org.apache.catalina.startup.Bootstrap.init(bootstrap.jar.so)
at org.apache.catalina.startup.Bootstrap.main(bootstrap.jar.so)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.modeler.Registry not found in org.apache.catalina.loader.StandardClassLoader{urls=[file:/var/lib/tomcat5/server/classes/,file:/usr/share/java/tomcat5/catalina-cluster-5.5.23.jar,file:/usr/share/java/tomcat5/catalina-storeconfig-5.5.23.jar,file:/usr/share/java/tomcat5/catalina-optional-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-coyote-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-jkstatus-ant-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-ajp-5.5.23.jar,file:/usr/share/java/tomcat5/servlets-default-5.5.23.jar,file:/usr/share/java/tomcat5/servlets-invoker-5.5.23.jar,file:/usr/share/java/tomcat5/catalina-ant-jmx-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-http-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-util-5.5.23.jar,file:/usr/share/java/tomcat5/tomcat-apr-5.5.23.jar,file:/usr/share/eclipse/plugins/org.eclipse.jdt.core_3.2.1.v_677_R32x.jar,file:/usr/share/java/tomcat5/servlets-webdav-5.5.23.jar,file:/usr/share/java/tomcat5/catalina-5.5.23.jar], parent=org.apache.catalina.loader.StandardClassLoader{urls=[file:/var/lib/tomcat5/common/classes/,file:/var/lib/tomcat5/common/i18n/tomcat-i18n-ja.jar,file:/var/lib/tomcat5/common/i18n/tomcat-i18n-fr.jar,file:/var/lib/tomcat5/common/i18n/tomcat-i18n-en.jar,file:/var/lib/tomcat5/common/i18n/tomcat-i18n-es.jar,file:/usr/share/java/tomcat5/naming-resources-5.5.23.jar,file:/usr/share/eclipse/plugins/org.eclipse.jdt.core_3.2.1.v_677_R32x.jar,file:/usr/share/java/tomcat5/naming-factory-5.5.23.jar], parent=gnu.gcj.runtime.SystemClassLoader{urls=[file:/usr/lib/jvm/java/lib/tools.jar,file:/usr/share/tomcat5/bin/bootstrap.jar,file:/usr/share/tomcat5/bin/commons-logging-api.jar,file:/usr/share/java/mx4j/mx4j-impl.jar,file:/usr/share/java/mx4j/mx4j-jmx.jar], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}}}
at java.net.URLClassLoader.findClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at java.lang.Class.initializeClass(libgcj.so.7rh)
...5 more
Seems like you've implemented a JMX service and tried to install it on your server.xml file but forgot to add the apache commons modeler jar to the server/lib directory (therefore the ClassNotFoundException for org.apache.commons.modeler.Registry). Check your server.xml file for anything you might have added, and try to add the proper jar file to your server classpath.
This screams class path issue, to me. Where exactly is your tomcat installed? (Give us command line printouts of where the home directory is.) Also, how are you starting it?
Seems like you need to have the jar for commons-modeler into $CATALINA_HOME/common/lib. You get the same kind of error when trying to setup JDBC datasources if you didn't put the driver's jar file into tomcat's server classpath.
Check your JAVA_HOME/JRE_HOME setting. You might want to use a different JVM rather than the one that is installed with the OS

Categories