ClassNotFoundException: in gnu.gcj.runtime.SystemClassLoader - java

I am getting this Exception when i tried to run a java Application with the help of a Script
Caused by: java.lang.ClassNotFoundException: com.tata.topListQuoteSamples.TOPLISTSample not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:/home/sai/NewgdpapiToplist1/lib/commons-logging-1.0.4.jar,file:/home/sai/NewgdpapiToplist1/lib/log4j-1.2.8.jar,file:/home/sai/NewgdpapiToplist1/lib/mail.jar,file:/home/sai/NewgdpapiToplist1/lib/marketdata-b1.1.jar,file:/home/sai/NewgdpapiToplist1/lib/middleware.jar,file:/home/sai/NewgdpapiToplist1/lib/gdpapi-all.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 gnu.java.lang.MainThread.run(libgcj.so.7rh)
End time: Fri Mar 9 09:15:55 EST 2012

Basically you need to set the class path straight inside your script.
if you're executing java with "java.exe" (or whatever the linux equivalent) make sure you specify the class path (or if you're running that from the command line, make sure you either do that or are in the right folder)

Related

error starting tomcat 7 from eclipse

im getting this error when starting my tomcat 7
can someone help me?
Mar 03, 2014 5:07:31 PM org.apache.catalina.startup.Bootstrap initClassLoaders
SEVERE: Class loader creation threw exception
java.io.IOException: Invalid argument
at java.io.WinNTFileSystem.canonicalize0(Native Method)
at java.io.Win32FileSystem.canonicalize(Unknown Source)
at java.io.File.getCanonicalPath(Unknown Source)
at java.io.File.getCanonicalFile(Unknown Source)
at org.apache.catalina.startup.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:171)
at org.apache.catalina.startup.Bootstrap.createClassLoader(Bootstrap.java:176)
at org.apache.catalina.startup.Bootstrap.initClassLoaders(Bootstrap.java:103)
at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:208)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:406)
not sure if this is your problem but I received a similar error trying to starup Tomcat 6.
The problem was caused by this line in the catalina.properties file:
shared.loader=${catalina.base}/lib/*.jar,${catalina.base}/shared/classes,${catalina.home}/shared/lib/*.jar
You cant see it but there is an unprintable character following the *.jar which was being read as an invalid argument.
After I deleted that character Tomcat came up sucessefully.
I had a similar issue and it was a ending back slash issue \ in CATALINA_HOME environment variable.
https://stackoverflow.com/a/22209500/1383538
Maybe a bit late; but for anyone else who may have this problem; it
turned out i had put a backslash \ at the end on my CATALINA_HOME
environment variable (I was using windows). When i removed it, i could
start using catalina run command.
https://stackoverflow.com/a/28261336/1383538
Had a similar issue with Tomcat 8 and Java 8 on Windows 8, and after
little bit of playing around, I noticed that CATALINA_HOME was set as
"CATA_HOME=c:\mydir\tomcat.8.0\"
I just changed it to CATA_HOME=c:\mydir\tomcat.8.0" and it fixed all
the issues. I never thought ending back slash would cause the issue
but there you are...it did!!!

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

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

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.

JPL/SWI Prolog not working

I'm trying to use the SWI-Prolog JPL library, but I'm having problems.
I'm trying to let my Eclipse project access JPL, but when I try to start the program, I get the following error:
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no jpl in java.library.path
I copied the jpl.jar into my project directory, and I set it on the build path. Additionally, I pass the following VM arguments:
-Djava.library.path="C:\Program Files\Prolog\bin"
(That's the directory where Prolog was installed).
What am I doing wrong?
EDIT: I don't seem to have the libpl.dll anywhere on my computer. Could this be causing my problem?
The jvm.dll of your running JDK/JRE must be available in your system PATH so that jpl.dll from java.library.path loads properly.
You have to take care to 32 bits / 64 bits consistency between your JPL installation and your running JVM - so do not try any mix.
Here is information from an old installation doc.
For such installation support, you should use the JPL mailing list.
You should set the java.library.path to the folder where the jpl.dll file is located. As far as I know it is the Prolog\bin folder.
A system-wide solution in a Mac environment (SWI-Prolog version 7.1.4 for x86_64-darwin13.1.0) would be to create the following symlink:
ln -s /usr/local/Cellar/swi-prolog/7.1.4/libexec/lib/swipl-7.1.4/lib/x86_64-darwin13.1.0/libjpl.jnilib /Library/Java/Extensions/libjpl.jnilib
Could be rather
ln -s
/Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin/libjpl.dylib
/Library/Java/Extensions/libjpl.dylib
? (no .inilib was found under darwin folder)
In my case still error on mojave (SWI-Prolog (threaded, 64 bits, version 8.0.2)):
Jan 03, 2020 12:10:55 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [ACTIONS] in context with path [/SVIZ] threw exception [Servlet execution threw an exception] with root cause
java.lang.UnsatisfiedLinkError: /Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin/libjpl.dylib: dlopen(/Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin/libjpl.dylib, 1): Library not loaded: #rpath/libswipl.8.dylib
Referenced from: /Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin/libjpl.dylib
Reason: image not found

java javax.comm

Hi im trying to read com port, so I add library to my java directory like
they wrote here but when Im witing simple code like
import java.util.Enumeration;
import javax.comm.*;
public class CompotCore {
public static void main(String[] args)
{
Enumeration list = CommPortIdentifier.getPortIdentifiers();
}
}
I get such error:
java.lang.UnsatisfiedLinkError: no Serial in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1681)
at java.lang.Runtime.loadLibrary0(Runtime.java:840)
at java.lang.System.loadLibrary(System.java:1047)
at gnu.io.RXTXCommDriver.<clinit>(RXTXCommDriver.java)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:237)
at javax.comm.CommPortIdentifier.<clinit>(CommPortIdentifier.java:109)
at CompotCore.main(CompotCore.java:11)
Exception in thread "main" java.lang.UnsatisfiedLinkError: com.sun.comm.SunrayInfo.isSessionActive()Z
at com.sun.comm.SunrayInfo.isSessionActive(Native Method)
at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155)
at com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100)
at javax.comm.CommPortIdentifier.<clinit>(CommPortIdentifier.java:138)
at CompotCore.main(CompotCore.java:11)
i read that I had to add System.load("Serial"); with full path but I dont have such library and dont know where to find it.
On the site you link to it includes instructions to copy two native libraries into your JRE lib dir:
cp rxtx-bins.1/1.4/i386-pc-linux/libParallel.so /usr/java/j2sdk1.4.0/jre/lib/i386/
cp rxtx-bins.1/1.4/i386-pc-linux/libSerial.so /usr/java/j2sdk1.4.0/jre/lib/i386/
Are they there?
Be sure you are copying them into the correct JRE. What does which java tell you?
An alternative to copying to jre/lib would be to have them in some other location and then point to that dir with the System Property java.library.path, e.g. you would execute Java like this to start your program
java -Djava.library.path=<dir_with_those_libs> <your_other_args>
Update
OK I downloaded the rtxt tar and took a look. After you untar it, you have the following (one example):
ls -l rxtx-bins.1/1.4/i386-pc-linux/
total 44
-rwxr-xr-x 1 root root 9700 Dec 5 2001 libParallel-1.4.15.so
lrwxrwxrwx 1 root root 21 Jul 6 03:23 libParallel.so -> libParallel-1.4.15.so
-rwxr-xr-x 1 root root 31400 Dec 5 2001 libSerial-1.4.15.so
lrwxrwxrwx 1 root root 19 Jul 6 03:23 libSerial.so -> libSerial-1.4.15.so
If you followed the instructions from that page, you will have only copied the links, not the actual libs. So the solution will be to copy ALL the files, something like this:
cp rxtx-bins.1/1.4/i386-pc-linux/* /usr/java/j2sdk1.4.0/jre/lib/i386/
Or alternatively to execute Java something like:
java -Djava.library.path=~/rxtx-bins.1/1.4/i386-pc-linux:$LD_LIBRARY_PATH <your_other_args>
The page that you linked to offers you to download the RXTX package. In that archive file there are the native libraries that you need for different platforms.
You just have to make sure that Java can find the relevant native library for the OS that you are using. You can do that by specifying the directory that contains the native library in the java.library.path system property, which you can set on the command line like this:
java -Djava.library.path=C:\Folder\That\Contains\TheDLL CompotCore
For Linux, obviously:
java -Djava.library.path=/folder/that/contains/the_so CompotCore
(Ofcourse, substitute the actual directory in the command).

Categories