I'm trying to use the Lizzy library (http://lizzy.sourceforge.net/) to do some playlist manipulation. As a dependency, it requires that I have the Castor library (http://www.castor.org/) in my build path. So I went to the site, and downloaded Castor 1.3.1, then put the .jar into my build path.
However, when I try to run this line of code to convert a specific playlist file to a generic playlist object:
specificPlaylist = SpecificPlaylistFactory.getInstance().readFrom(playlistFile);
I end up getting a NoClassDefFoundError:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/exolab/castor/core/exceptions/CastorException
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(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)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(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)
at org.exolab.castor.mapping.Mapping.<init>(Mapping.java:81)
at christophedelory.xml.XmlSerializer.getMapping(XmlSerializer.java:100)
at christophedelory.playlist.asx.AsxProvider.readFrom(AsxProvider.java:202)
at christophedelory.playlist.SpecificPlaylistFactory.readFrom(SpecificPlaylistFactory.java:132)
at christophedelory.playlist.SpecificPlaylistFactory.readFrom(SpecificPlaylistFactory.java:168)
...
Am I missing a .jar file? I managed to create an instance of a CastorException class (but it was in a different package than the one the exception is talking about). I thought that the basic Castor-1.3.1.jar file held all of the classes it needed.
Additional information: I'm trying to decode a .wpl playlist file, which should be supported by Lizzy. And my build path looks like this:
Thanks for any help.
You can easily look in the Castor jar to see what's there using a wide variety of tools - WinZip happens to be my tool of choice. You'll find that while there's a CastorException, it's in the wrong package.
Looking at the old downloads page under 1.3.1, I see a Castor-1.3.1-core.jar. Looking in it, I see CastorException in the right package. You may need other jars too - I'd consult the documentation, or continue by trial-and-error, or try to find a POM that will tell you.
Related
I am using AJSC framework in SpringBoot with JaxB implementation. I built the stubs outside the project and copied them inside the project with proper directories.
However, during API execution, i get a classNotDef error. But I have seen my Jar file and i have the package-info class file inside the directory.
Caused by: java.lang.NoClassDefFoundError: BOOT-INF/classes/com/att/fpp/fpprome/opportunity/package-info (wrong name: com/att/fpp/fpprome/opportunity/package-info)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
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)
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.hibernate.annotations.common.util.StandardClassLoaderDelegateImpl.classForName(StandardClassLoaderDelegateImpl.java:57)
at org.hibernate.boot.internal.MetadataBuilderImpl$MetadataBuildingOptionsImpl$4.classForName(MetadataBuilderImpl.java:758)
at org.hibernate.annotations.common.reflection.java.JavaReflectionManager.packageForName(JavaReflectionManager.java:148)
at org.hibernate.cfg.AnnotationBinder.bindPackage(AnnotationBinder.java:281)
at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.prepare(AnnotationMetadataSourceProcessorImpl.java:186)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.prepare(MetadataBuildingProcess.java:156)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:253)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:847)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:874)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:58)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
at acsi.grid.gridcore.core.sql.EntityManagerHelper.getDefaultEntityManager(EntityManagerHelper.java:250)
at acsi.grid.gridcore.core.sql.EntityManagerHelper.getEntityManager(EntityManagerHelper.java:174)
at acsi.grid.gridcore.core.JdbcGridBagImpl.getEntityManager(JdbcGridBagImpl.java:188)
at acsi.grid.gridcore.core.JdbcGridBagImpl.put(JdbcGridBagImpl.java:163)
at com.att.fpp.fpprome.dao.impl.OpportunityDaoImpl.updateOpportunityDatabaseROME(OpportunityDaoImpl.java:497)
at com.att.fpp.fpprome.bo.impl.OpportunityBusinessObjectImpl.getOpptyInfo(OpportunityBusinessObjectImpl.java:78)
at com.att.fpp.fpprome.service.impl.OpportunityServiceImpl.getOpportunitiesById(OpportunityServiceImpl.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
Also I noticed that I am not using apache.cxf anywhere in pom but yet it is being called here.
A possible solution for the NoClassDefFoundError originated by the package-info class: Spring boot, runnable jar can't load package-info.class
Found the issue.
The AJSC framework implementing the ADF (Hibernate based ORM) did not support package-info and hence searched for that class everytime.
Only way around was to execute the command to not generate the package-info during stubs generation.
Use -npa in XJC utility to suppress package-info and everything will work.
In case you got here by looking for a solution to a similar "package-info (wrong name:" issue, I fixed my problem by upgrading hibernate (since the one in the app was quite old).
We had installed version of our applications (without any instrumentation or cobertura jar included before generating application bundles).
After installation we instrumented all the jar with cobertura, and included cobertura jar file in java classpath. but while starting application it give below error.
any input will really help, thanks.
Java version "1.7.0_25"
cobertura ver 1.9.4.1
Exception in thread "main" java.lang.NoClassDefFoundError: net/sourceforge/cobertura/coveragedata/HasBeenInstrumented
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
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)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: net.sourceforge.cobertura.coveragedata.HasBeenInstrumented
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)
... 13 more
You should add cobetura.jar to Bootstrap Classes with -Xbootclasspath. More info: https://docs.oracle.com/javase/8/docs/technotes/tools/findingclasses.html
This needs to be done in order to load the cobetura classes, which are needed in order to load your app classes.
I have been able to get rid of this problem by running a late package goal, as it re-compiles and re-packages de code without Cobertura.
The goals I use are:
clean site package
I have a Dynamic Web Project in Java and I use Jena and D2RQ libraries.
When I start my project as "Java Application", I have this problem:
Exception in thread "main"
java.lang.IncompatibleClassChangeError: Implementing class at
java.lang.ClassLoader.defineClass1(Native Method) at
java.lang.ClassLoader.defineClass(Unknown Source) at
java.security.SecureClassLoader.defineClass(Unknown Source) at
java.net.URLClassLoader.defineClass(Unknown Source) at
java.net.URLClassLoader.access$100(Unknown Source) 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) at
de.fuberlin.wiwiss.d2rq.algebra.CompatibleRelationGroup.addNodeRelation(CompatibleRelationGroup.java:53)
at
de.fuberlin.wiwiss.d2rq.algebra.CompatibleRelationGroup.groupNodeRelations(CompatibleRelationGroup.java:38)
at de.fuberlin.wiwiss.d2rq.find.FindQuery.iterator(FindQuery.java:78)
at
de.fuberlin.wiwiss.d2rq.jena.GraphD2RQ.graphBaseFind(GraphD2RQ.java:88)
at com.hp.hpl.jena.graph.impl.GraphBase.find(GraphBase.java:240) at
com.hp.hpl.jena.graph.compose.DisjointUnion.graphBaseFind(DisjointUnion.java:27)
at com.hp.hpl.jena.graph.impl.GraphBase.find(GraphBase.java:240) at
com.hp.hpl.jena.graph.impl.GraphBase.graphBaseFind(GraphBase.java:260)
at com.hp.hpl.jena.graph.impl.GraphBase.find(GraphBase.java:257) at
com.hp.hpl.jena.graph.query.SimpleQueryHandler.predicatesFor(SimpleQueryHandler.java:68)
at
com.hp.hpl.jena.graph.query.SimpleQueryHandler.predicatesFor(SimpleQueryHandler.java:47)
at
com.hp.hpl.jena.rdf.model.impl.ModelCom.listPredicates(ModelCom.java:751)
at
com.hp.hpl.jena.rdf.model.impl.ModelCom.listNameSpaces(ModelCom.java:763)
at
com.hp.hpl.jena.xmloutput.impl.BaseXMLWriter.addNameSpaces(BaseXMLWriter.java:233)
at
com.hp.hpl.jena.xmloutput.impl.BaseXMLWriter.setupNamespaces(BaseXMLWriter.java:487)
at
com.hp.hpl.jena.xmloutput.impl.BaseXMLWriter.write(BaseXMLWriter.java:469)
at MyPackage.MyClass.Mymethod(MyClass.java:118) at
MyPackage.Test.main(Test.java:77)
The row 118 of the class "MyClass" contains this code:
writer.write(d2rqModel, new OutputStreamWriter(out, "utf-8"),loader.getResourceBaseURI());
with
RDFWriter writer;
and
import com.hp.hpl.jena.rdf.model.RDFWriter;
Why I have this problem?
In addition, the same class in a different project works well!!! Why?
You've changed and recompiled the class without recompiling everything that depends on it. Do a clean build. You may get some compiler errors in the process.
You may have added dependency that are ambiguous to compiler's understanding. Verify that you don't have duplicate dependency for same class.
I have the project based on JavFX 2, it`s done and works perfect in Eclipse. Now i am trying to deploy it on computer(self-service,terminal,..). I have created jar file, but when i am trying to "java -jar myproject.jar" i take the following
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
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)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
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)
... 13 more
UDT:
I think there is some problem with jfxrt.jar where javafx.application.Application class stored, in eclipse i added this jar in build path manually..
In Java 7, JavaFX is included with the JDK download but is not on the classpath (JavaFX is not part of the core libraries in Java 7). Have a look at the tutorial on deployment, which shows mechanisms for deploying a jar file that will work.
(In Java 8, JavaFX becomes part of the core libraries and will be included on the classpath, so your regular jar file may well work. There are still some cool things you can do with the proper deployment process, though.)
I work for a local school district part time. They run a piece of software called A+ learning system. It uses the java runtime environment to do what it does. On one of our computers, it isn't running; opening a command prompt and typing out:
java -jar als.jar
gives the following error messages.
C:\als30\alsclient>java -jar als.jar > C:\alsdebuginfo.txt
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/ControllerListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(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)
at ALS.checkALSRunning(ALS.java:1017)
at ALS.main(ALS.java:192)
Caused by: java.lang.ClassNotFoundException: javax.media.ControllerListener
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)
... 14 more
I really don't know enough about java or A+ learning system to be able to debug this stuff. My only hunch is that maybe the computer is running the wrong version of the Java Runtime Environment. Any shove in the right direction would be greatly appreciated.
Thanks in advance guys.
It looks like the optional Java Media Framework is not installed.
You can get it here, along with installation instructions.
ClassNotFoundException usually means that a class is missing that it is expecting to be on the classpath. My guess is that it is expecting a system library, or a separate library, to be available (installed to the Java lib directory maybe) that isn't. Does that help at all?