When I compile and run my application on my local machine with specs Windows XP sp2, JDK 5u11, I get no error. But when I try to run this application (compiled on Windows XP) on a Linux Debian distro, JDK 5 I get the following error:
Unable to instantiate class load helper class: null
What can I do to get rid of this exception message?
Yes, this isn't really enough info to help, but a simple Google search led me to the source code which explalins it a bit:
Quartz has a "ClassLoadHelper" interface and you can specify the class name of the implementation of this to use. You've not configured it, or there's an error in creating it. Perhaps it's complaining it doesn't have the name of a class to instantiate.
In any event the code apparently logs a stack trace with this, so you should provide that.
Related
I have seen this:
java.lang.NoClassDefFoundError: Could not initialize class XXX
And this: Different methodologies for solving bugs that only occur in production
But my question is, given what the first answer says about this problem, how could it be that I could be getting that error on only one of the two places? isn't this a pretty serious error that should prevent the program from compiling in any location? (I properly import the class in the file this error occurs.)
What differences between the two environments should I be looking for?
Other questions about the error I'm getting in QA indicate it could be some nested problem with the class itself, but like I said if that was the case why would it only happen in the QA environment? I can run jmeter load/endurance tests against my program all day long locally and not see this error.
Note, I don't handle the deployments to QA, but is there something I should ask the guy who does? Would run config differences be a potential cause?
The logs in splunk aren't super helpful, here's part of the exception of one instance of the error:
[https-jsse-nio-11402-exec-9] 28 Jun 2021 13:29:45,415+0000 ERROR GenericThrowableMapper [{applicationSystemCode=[removed]-app, clientIP=[removed], clusterId=[removed], containerId=[removed], correlationId=[removed], domainName=[removed], hostName=[removed], messageId=[removed], userId=[removed], webAnalyticsCorrelationId=|}]: java.lang.NoClassDefFoundError: Could not initialize class [removed].CDDConfig
at [removed].execute([removed]AggregationResource.java:77)
at [removed]AggregationResource$$FastClassBySpringCGLIB$$7a8c5a8e.invoke(<generated>)
It then goes on into package classes and all that for a bunch of lines. I add this to ask - maybe there's something else I should try to have it log?
This isn't much more than a spontaneous guess, but judging from experience, I suspect a JDK / JRE version error.
Classic case I witnessed: you compile something on your dev machine with, say, OpenJDK version 8.x.x. You commit / push, the Jenkins CICD pipe starts running, but someone configured its JAVA_HOME to some 11.x version JDK.
-> ClassNotFoundError, NoClassDef, etc.
If you do not do the deployment to QA yourself, can you check what JDK the code has been compiled with? Or ask the guy doing it for that info.
I just downloaded some java applets from this site: http://www.surendranath.org/Apps.html to run them offline on my laptop. Take for example this one: http://www.surendranath.org/Applets/Oscillations/Lissajous/Lissajous.html
By inspecting the source code I downloaded the file: wget http://www.surendranath.org/Applets/Oscillations/Lissajous/LissajousApplet.class
Then I tried it to run it on my ubuntu box via gappletviewer-4.8 -code LissayousApplet.class
However I got the following error message:
Exception in thfully qualifiedread "main" java.lang.NoClassDefFoundError: loaded class LissajousApplet was in fact named Applets.Oscillations.Lissajous.LissajousApplet
at java.lang.VMClassLoader.defineClass(libgcj.so.14)
at java.lang.ClassLoader.defineClass(libgcj.so.14)
at java.security.SecureClassLoader.defineClass(libgcj.so.14)
at java.net.URLClassLoader.findClass(libgcj.so.14)
at java.lang.ClassLoader.loadClass(libgcj.so.14)
at java.lang.ClassLoader.loadClass(libgcj.so.14)
at java.lang.ClassLoader.loadClass(libgcj.so.14)
at gnu.classpath.tools.appletviewer.Main.createApplet(libgcj-tools.so.14)
at gnu.classpath.tools.appletviewer.StandaloneAppletWindow.<init>(libgcj-tools.so.14)
at gnu.classpath.tools.appletviewer.StandaloneAppletViewer.createWindows(libgcj-tools.so.14)
at gnu.classpath.tools.appletviewer.StandaloneAppletViewer.<init>(libgcj-tools.so.14)
at gnu.classpath.tools.appletviewer.Main.main(libgcj-tools.so.14)
So what is the correct way to run this applet offline? Running it online within my browser and the icetea plugin works. However I need a way to run it offline.
Edit
Trying the fully qualified class-name results in:
gappletviewer-4.8 -code Applets.Oscillations.Lissajous.LissajousApplet.class -codebase codebase="../../../"
WARNING: CURRENTLY GAPPLETVIEWER RUNS WITH NOSECURITY MANAGER.
THIS MEANS THAT APPLETS YOU LOAD CAN DO ANYTHING A JAVA APPLICATION
THAT YOU DOWNLOAD AND RUN CAN DO. BE *VERY* CAREFUL WHICH APPLETS YOU RUN.
DO NOT USE GAPPLETVIEWER ON YOUR SYSTEM IF YOUR SYSTEM STORES IMPORTANTDATA.
THIS DATA CAN BE DESTROYED OR STOLEN IF YOU LOAD A MALICIOUS APPLET.
[press 'c' or 'C' to continue or anything else to quit]
c
java.lang.ClassNotFoundException: Applets.Oscillations.Lissajous.LissajousApplet not found in gnu.classpath.tools.appletviewer.AppletClassLoader{urls=[file:/home/null,file:/home/], parent=gnu.gcj.runtime.SystemClassLoader{urls=[file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}}
at java.net.URLClassLoader.findClass(libgcj.so.14)
at gnu.classpath.tools.appletviewer.AppletClassLoader.findClass(libgcj-tools.so.14)
at java.lang.ClassLoader.loadClass(libgcj.so.14)
at java.lang.ClassLoader.loadClass(libgcj.so.14)
at gnu.classpath.tools.appletviewer.Main.createApplet(libgcj-tools.so.14)
at gnu.classpath.tools.appletviewer.StandaloneAppletWindow.<init>(libgcj-tools.so.14)
at gnu.classpath.tools.appletviewer.StandaloneAppletViewer.createWindows(libgcj-tools.so.14)
at gnu.classpath.tools.appletviewer.StandaloneAppletViewer.<init>(libgcj-tools.so.14)
at gnu.classpath.tools.appletviewer.Main.main(libgcj-tools.so.14)
Try using the fully qualified classname
gappletviewer-4.8 -code Applets.Oscillations.Lissajous.LissajousApplet.class -codebase codebase="http://www.surendranath.org/"
Read: gappletviewer Man page
We have coded and run a dynamic web application using MAPSERVER(Version 6.0.1) on windows platform using Java Technology. Now, there is need of deploying it on Ubuntu 11.10. We have installed Apache Tomcat 6.0, Mapserver 6.0.1, Apache 2.0, and FWTools-2.0.1(As this package contain all required tools for mapserver if I am not wrong, so I didn't feel any other tools to be installed). We have deployed the war file(and put application without) in Apache Tomcat 's Webapps folder. I even got the index page which dont have code related with mapscript api. But while fetching the other servlet with mapscript we are getting following error...
java.lang.UnsatisfiedLinkError: no mapscript in java.library.path
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1681)
java.lang.Runtime.loadLibrary0(Runtime.java:840)
java.lang.System.loadLibrary(System.java:1047)
edu.umn.gis.mapscript.mapscriptJNI.<clinit>(mapscriptJNI.java:23)
edu.umn.gis.mapscript.mapObj.<init>(mapObj.java:283)
Again while refreshing the browser page where the above error was displayed, I got a change,
java.lang.NoClassDefFoundError: Could not initialize class
edu.umn.gis.mapscript.mapscriptJNI
edu.umn.gis.mapscript.mapObj.<init>(mapObj.java:283)
I searched on net about the above problem. But finally blank. Please, provide idea about the above problem.
I'm not going to explain why you're getting the UnsatisfiedLinkError, but instead I'll explain why you are getting the NoClassDefFoundError when you reload the page.
A NoClassDefFoundError with a message Could not initialize class ... is thrown by the JVM when it attempts to initialize a class that it has already tried and failed to initialize.
The first of your two stacktraces contains the line
edu.umn.gis.mapscript.mapscriptJNI.<clinit>(mapscriptJNI.java:23)
The method name <clinit> denotes the static initializer, of the class mapscriptJNI. So, at the point that the UnsatisfiedLinkError was thrown, the JVM was trying to initialize this class. Looking at the error message, it seems that this static initializer tried to load the native code library mapscript but failed.
This UnsatisfiedLinkError causes the mapscriptJNI class to fail to initialize successfully. The JVM keeps a record of all classes that fail to initialize, and if you attempt to initialize one of those classes again, you'll get a NoClassDefFoundError with a message saying that it could not initialize that class.
When you refresh the page, you end up causing the JVM to attempt to initialize the class mapscriptJNI a second time. Of course, this class failed to initialize the previous time. Your second stacktrace contains exactly the error I've described.
In short, the UnsatisfiedLinkError is the real error here. Fix that and the other one will go away.
I would check the following 2 items:
Is the mapscript.jar file on Tomcat or at least your webapp's classpath? (NoClassDefFoundError is your big clue here)
Is the libmapscript.so on either your LD_LIBRARY_PATH or -Djava.library.path? (UnsatisfiedLinkError since the shared object cannot be found)
Try having a look at this post, near the Running Java Mapscript (on Linux) section.
Hope that helps!
In Eclipse I get this eror:
Exception in thread "main"
java.lang.UnsatisfiedLinkError:
com.nokia.mid.impl.isa.util.SharedObjects.nativeSetTable(Ljava/util/Hashtable;)Ljava/util/Hashtable;
I can see SharedObjects, but nativeSetTable doesn't seem to be a method. It might however be hidden -> I don't have access to the source code.
This was my code:
connection = (HttpConnection)Connector.open(this.url);
This is the trace:
Exception in thread "main" java.lang.UnsatisfiedLinkError:
com.nokia.mid.impl.isa.util.SharedObjects.nativeSetTable(Ljava/util/Hashtable;)Ljava/util/Hashtable;
at
com.nokia.mid.impl.isa.util.SharedObjects.nativeSetTable(Native
Method) at
com.nokia.mid.impl.isa.util.SharedObjects.createTable(SharedObjects.java:465)
at
com.nokia.mid.impl.isa.util.SharedObjects.(SharedObjects.java:181)
at
com.nokia.mid.impl.isa.io.GeneralSharedIO.(GeneralSharedIO.java:67)
at
com.sun.midp.io.ConnectionBaseAdapter.checkForPermission(ConnectionBaseAdapter.java:236)
at
com.sun.midp.io.ConnectionBaseAdapter.openPrim(ConnectionBaseAdapter.java:205)
at
com.sun.midp.io.ConnectionBaseAdapter.openPrim(ConnectionBaseAdapter.java:178)
at
com.sun.midp.io.InternalConnector.openPrim(InternalConnector.java:254)
at
com.sun.midp.io.InternalConnector.open(InternalConnector.java:153)
at
javax.microedition.io.Connector.open(Connector.java:138)
at
javax.microedition.io.Connector.open(Connector.java:120)
at
javax.microedition.io.Connector.open(Connector.java:104)
I think that nativeSetTable() is protected or private, that's why you don't see it. And moreover nativeSetTable() is a native method, which means that it is based on native code (already compiled for a specific processor and available in a specific lib [ie. a DLL]).
UnsatisfiedLinkError means that this particular method couldn't be retrieved and executed properly.
Thrown if the Java Virtual Machine cannot find an appropriate native-language definition of a method declared native.
This means that your Java ME emulator must have missing librairies. You should try to reinstall it.
Resources :
Javadoc - UnsatisfiedLinkError
I guess you are coupling your source code with the wrong version of the nokia mid library.
It could be that your runtime classpath is using a different version of the jar where SharedObjects lives, when compared to your compile-time classpath in Eclipse. I would double-check your classpath settings.
Ok, I found one reason:
I created a test class in java to test my code, just a plain java file (with main method). And I ran it as a plain java application. Then, it doesn't work. But after I tried it in a Midlet, I didn't get the error!
I have a jar application which process and converts file into csv file. I have made it to run in windows service using Java Service Wrapper. It got installed my jar application successfully when I run "InstallApp-NT. Bat" file and starts running my application when I run "app" command.
But when I try to start the service in services, its not starting and showing following message in dialog box<
Windows could not start the generic Preprocessor application on Local Computer. For more information, review the System Event Log. If this is a non-microsoft service, contact the service vendor, and refer to service-specific error code1
I have the system log file and it showing the below error message
System Event log:
--> Wrapper Started as Service
Java Service Wrapper Community Edition 3.3.2
Copyright (C) 1999-2009 Tanuki Software, Ltd. All Rights Reserved.
http://wrapper.tanukisoftware.org
Launching a JVM...
WrapperManager: Initializing...
WrapperSimpleApp:
WrapperSimpleApp: Encountered an error running main:
WrapperSimpleApp: java. Lang. NullPointerException
WrapperSimpleApp: at java. Util. Hashtable. Put(Hashtable. Java: 396)
WrapperSimpleApp: at java. Util. Properties. SetProperty(Properties. Java: 128)
WrapperSimpleApp: at java. Lang. System. SetProperty(System. Java: 701)
WrapperSimpleApp: at com. Dnb. Genericpreprocessor. Process. ProcessRunner. Main(Unknown Source)
WrapperSimpleApp: at sun. Reflect. NativeMethodAccessorImpl. Invoke0(Native Method)
WrapperSimpleApp: at sun. Reflect. NativeMethodAccessorImpl. Invoke(NativeMethodAccessorImpl. Java: 39)
WrapperSimpleApp: at sun. Reflect. DelegatingMethodAccessorImpl. Invoke(DelegatingMethodAccessorImpl. Java: 25)
WrapperSimpleApp: at java. Lang. Reflect. Method. Invoke(Method. Java: 585)
WrapperSimpleApp: at org. Tanukisoftware. Wrapper. WrapperSimpleApp. Run(WrapperSimpleApp. Java: 238)
WrapperSimpleApp: at java. Lang. Thread. Run(Thread. Java: 595)
<-- Wrapper Stopped
I don't think any error in application code because it running fine when run "app" command. Please help what I should now. Thanks in advance.
I am using the following code in com.dnb.genericpreprocessor.process.ProcessRunner class.
String projectHome = "D:\BL";
System.setProperty("project.home", projectHome);
System.setProperty("log.home",System.getenv("DBE")); ---> DBE is the envirinment variable I created in user variables.
When I run the application by giving app command... Its running the application by printing the environment value but showing the same error when I start it in service.
Answering your question update that you phrased as an answer, you need to ensure that the variable is in fact set in the specific environment where you are running the application. It appears that it is not. In fact, to avoid the NullPointerException, I would modify your code to something like:
String loghome = System.getenv("DBE");
if (loghome == null) {
// LOG A COMPLAINT that the environment variable is not set
loghome = "some reasonable default value";
}
System.setProperty("log.home", loghome);
so at least your application won't fail with an obtuse NPE if it is executed in the wrong environment.
Check com.dnb.genericpreprocessor.process.ProcessRunner if that is your code and see what data you are setting in System property. NullPointer is telling that the key or the value you passed is Null.
Check your wrapper.config; you need to have all the necessary jars in order, and each with their own index number (for some reason):
wrapper.java.classpath.1=../lib/wrapper.jar
wrapper.java.classpath.2=%JAVA_HOME%/lib/tools.jar
...
Just a first thought.
I am not familiar with the proprietary solution you are using, but it seems you somehow configured it wrong.
Looks like some parameter the wrapper should have is null and is propagating all the way up until the system is trying to set it as property.
Maybe you should put your 'DBE' enviroment in the system variables not user variables.
Windows service starts at system account.