I have an application that has only signed jars, all by the same certificate, mine. I wan't to run the application with Webstart. The application runs a compiler, and the compiled code runs LWJGL. However when I run the application, it returns errors by the compiled code that it literally cant find the LWJGL(-library) packages (the original application can see it fine). When I compile the application as a Trusted-Library, it errors out as well:
Exception in thread "CompilerThread" java.lang.NoClassDefFoundError: com/sun/tools/javac/api/JavacTool
at customcompile.CustomCompile$2.run(CustomCompile.java:82)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.api.JavacTool
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 2 more
http://download.oracle.com/javase/6/docs/technotes/guides/jweb/mixed_code.html
I found this site, but it doesn't get me much wiser on the particular subject, since it is clearly related to the compiled code being handled differently than the other code.
Can anyone help me out with this? Or clear it up?
Edit: I have concluded the compiled code is treated as unsigned.
Getting the libraries to be recognized, requires them being added in the classpath.
I think redirecting System.getProperty calls and the like, to the signed classes, will solve any problems in the unsigned code, giving it indirectly more rights.
Related
We have a webstart swing application running on our multiple remote desktop servers for a lot of customers. Suddenly, on one of our servers the customers started getting a java.lang.NoClassDefFoundError. Not on startup, the applications starts up fine, but when doing specific tasks, eg sending a mail through our software, it popups up in the console like this:
java.lang.NoClassDefFoundError: pos/MailSenderInterface
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
......
Caused by: java.lang.ClassNotFoundException: pos.MailSenderInterface
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 56 more
The problem is, this only happens on ONE of our servers. On all the other servers the webstart application runs just fine! But on this single terminal server, I get the error, even though the java version is the same, and the link to the jnlp-file is the same.
I have of course tried deleting temporary internet files in the java control panel, to no avail.
I then started toying around a bit, and found out something very strange.
Our customers start the application from an icon pointing to a batch-file in c:\drift
This batchfile only contains the following:
#start javaws http://ourserver/ourapplication.jnlp
Typing the link outside the batch-file gives the same error. Then I typed cd .. so that my current path was c:\ instead of c:\drift and started javaws from there. And surprise, no errors! I then tried cd drift again and the error occured again. I have tried this many times now, with the same result. So somehow the path from WHERE I start javaws have something to say for if I get the NoClassDefFoundError or not. But neither c:\ or c:\drift contains any .jar-files (although subdirectories may). I am very perplexed by this. What on earth is wrong? Our java version is 1.7.0_67
Aha! The path c:\drift\ actually had a directory "pos" from a couple of years back, with an old version of MailSender.class but with no MailSenderInterface.class Deleting this directory solved the problem. :-)
(Remember that the error was about a missing pos/MailSenderInterface)
Apparently the newest javaws in java 1.7.0_67 tries to load classes from a subdirectory of the place where you started javaws if such a directory is found, instead of loading the files from the correctly downloaded jar-files.
I have developed a Webservice client application using jaxrpc. Within eclipse the application runs fine, however after I have exported the jar file, I get the following runtime error
D:\>java -jar Myclient2.jar
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/rpc/Service
Exception
at Mynet.MyScheduler.<init>(MyScheduler.java:47)
at Mynet.MyScheduler.<init>(MyScheduler.java:36)
at Mynet.MyNetMain.main(MyNetMain.java:11)
Caused by: java.lang.ClassNotFoundException: javax.xml.rpc.ServiceException
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 3 more
I have tried to set the CLASSPATH variable but no changes.
set CLASSPATH=%CLASSPATH%;D:\eclipse\plugins\javax.xml.rpc_1.1.0.v201209140446\lib\jaxrpc.jar
set CLASSPATH=%CLASSPATH%;D:\eclipse\plugins\org.apache.axis_1.4.0.v201005080400\lib\axis.jar
echo %CLASSPATH%
java -jar Myclient2.jar
I am rather new to java so definitely a newbie question
KR
You should consider migrating your web service to JAX-WS. JAX-RPC is an older java web service technology that is unlikely to be maintained much moving forward.
But the single biggest benefit you will experience is that all of the JAX-WS runtime and tooling has been part of the Java JDK since Java 6. This means that you can build web services with no runtime library dependencies.
Anytime that you get "java.lang.NoClassDefFoundError"; it is very probable that you are missing a jar file.
you should search for the jar file containing "javax/xml/rpc" and then add it to your classpath or as a dependency to your maven project.
Here you should find them:
http://search.maven.org/
http://mvnrepository.com/
I'm trying to run an application in eclipse which is setup as MVC app and it is the solution code posted by our professor for a homework. After I copy and pasted all of the classes and tried to run it, I got the following error:
JOGL> Hello JOAL Exception in thread "main" java.lang.NoClassDefFoundError: com/jogamp/openal/JoalVersion at jogamp.opengl.openal.av.ALDummyUsage.main(ALDummyUsage.java:14) Caused by: java.lang.ClassNotFoundException: com.jogamp.openal.JoalVersion at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 1 more
I'm not entirely sure what the issue is and apparently no one else has been having the same issue.
My buildpath has a library I titled "JOGL" and I added the external jars gluegen-rt.jar and jogl-all.jar as was instructed by the professor.
Thanks for the help!
Actually, your code uses JOAL too, you need to put joal.jar into your classpath (Build path in Eclipse) and you need to put the JAR(s) containing its native libraries into the same directory as you did for JOGL and GlueGen. I assume you followed these instructions:
http://jogamp.org/wiki/index.php/Setting_up_a_JogAmp_project_in_your_favorite_IDE#Eclipse_IDE_project
Edit.: You don't run your own program for your homework, you try to run ALDummyUsage which is in JOGL itself. If you want to run your own program with your own main class, rather right-click on it and choose "Run As" -> "Java application" in Eclipse.
I have a class that uses Java3D that successfully compiles, although when I try to run it it says: Exception in thread "main" java.lang.NoClassDefFoundError:
javax/media/j3d/Canvas3D,
With the following stack trace:
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javax.media.j3d.Canvas3D
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Stuff I have already tried:
I couldn't even get it to compile until I copied the Java3D jars into /jre/lib/ext/.
I have the latest Java, Java3D and I am using Notepad++ and I have tried reinstalling Java3D.
I have set the classpath/path correctly.
There are no errors in the code.
I can run normal Java applications I have created.
I have tried using the classpath thing when running the application (java -classpath blahblah ApplicationName).
I have checked inside the jars and the classes (including Canvas3D) are definitely in there.
Not everything you say is true.
IF the classes are in the jars, and IF you have set the classpath correctly, THEN you would not get this message.
I suspect you have a build path confused with a classpath (which is mostly associated with runtime, where build path is associated with compile time). Without knowing more details of your runtime environment, it's hard to be more specific.
It always puzzles me how someone with a problem they cannot solve asserts so definitely that all these things are set up "correctly": how do you know? Isn't the problem some evidence to the contrary, at least enough for a small doubt?
After creating a number of Android apps using Java in Eclipse. I now need to create a stand alone Java program so that I can create an sqlite database - that will eventually be used in a future Android app.
I am using the SQLJet library from http://sqljet.com and have copied their example code.
When I try to run the code by using the "Run" button in Eclipse I get the following error.
Exception in thread "main" java.lang.NoClassDefFoundError: org/antlr/runtime/RecognitionException
at org.tmatesoft.sqljet.core.table.engine.SqlJetEngine$2.runSynchronized(SqlJetEngine.java:282)
at org.tmatesoft.sqljet.core.table.engine.SqlJetEngine.runSynchronized(SqlJetEngine.java:217)
at org.tmatesoft.sqljet.core.table.engine.SqlJetEngine.readSchema(SqlJetEngine.java:276)
at org.tmatesoft.sqljet.core.table.engine.SqlJetEngine.getOptions(SqlJetEngine.java:299)
at nlmc.loader.apps4care.com.Test.main(Test.java:36)
Caused by: java.lang.ClassNotFoundException: org.antlr.runtime.RecognitionException
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 5 more
Now as the code has been copied without change, I am guessing there is nothing wrong with that and I suspect that I don't have my environment set up correctly. As a newbie Java developer (normally C#) I'm struggling to make sense of what the problem is. never mind the solution.
Code now working and the database is created. Unfortunately looks like it is not compatible with the sqlite3, the version Android uses. Back to the drawing board...!
The program needs the class org.antlr.runtime.RecognitionException. See here for a list of jars where you can find it: http://www.jarfinder.com/index.php/java/info/org.antlr.runtime.RecognitionException
EDIT: And here you can see all the dependencies for SQLJet: http://mvnrepository.com/artifact/org.tmatesoft.sqljet/sqljet/1.1.1