I have a static java project and have so many class in it. used jar of java batch,drive Api , mongo Connnection etc and i have no errors compile time but while running a main class i am getting this.what can i do for this ?
Error: Unable to initialize main class kioskdriveCollabMain
Caused by: java.lang.NoClassDefFoundError: com/google/api/client/http/AbstractInputStreamContent
Error: Unable to initialize main class kioskdriveCollabMain
Caused by: java.lang.NoClassDefFoundError: com/google/api/client/googleapis/batch/json/JsonBatchCallback
java.lang.NoClassDefFoundError causes when the dependency isn't resolved i.e. it is unable to find the specified class.
com/google/api/client/http/AbstractInputStreamContent requires google-http-java-client jar.
com/google/api/client/googleapis/batch/json/JsonBatchCallback requires google-api-java-client jar.
Related
I have an existing Maven project working fine on a java version 1.8.0_241. But this supports vaadin version 7.2.6 and is needed to upgrade to vaadin 8 along with the compatibilty package. After making the necessary changes all the compilation issue are resolved but during execution, we are facing a ClassNotFoundException for one of our class GuiBaseApplication. But the class file was present in the OSGI Bundle guibase-2.2.4-SNAPSHOT.jar being used.
This class is an abstract class extending one class and implementing another class.
public abstract class GuiBaseApplication extends UI implements CrumbTrail
{
-
-
}
But when we took the -verbose logs, then could see that class was loaded once as below log.
**[Loaded com.product.rm.common.guibase.GuiBaseApplication from file:/home/user/bcd/com.product.bss.vaadin/target/guibase-2.2.4-SNAPSHOT.jar]**
Uptill now the Web GUI HTTP server was up and running.
Then trying to connect via the browser, the below error was displayed.
HTTP ERROR 500 javax.servlet.ServletException: com.vaadin.server.ServiceException: com.vaadin.server.ServiceException: com.product.rm.common.guibase.GuiBaseApplication could not be loaded
URI: /gui
STATUS: 500
MESSAGE: javax.servlet.ServletException: com.vaadin.server.ServiceException: com.vaadin.server.ServiceException: com.product.rm.common.guibase.GuiBaseApplication could not be loaded
SERVLET: com.product.rm.bcd.server.webgui.ApplicationServlet-27a56cca
CAUSED BY: javax.servlet.ServletException: com.vaadin.server.ServiceException: com.vaadin.server.ServiceException: com.product.rm.common.guibase.GuiBaseApplication could not be loaded
CAUSED BY: com.vaadin.server.ServiceException: com.vaadin.server.ServiceException: com.product.rm.common.guibase.GuiBaseApplication could not be loaded
CAUSED BY: com.vaadin.server.ServiceException: com.product.rm.common.guibase.GuiBaseApplication could not be loaded
CAUSED BY: java.lang.ClassNotFoundException: com.product.rm.common.guibase.GuiBaseApplication
Checking on the existing and working version, we could see that this class is loaded two more times as below but with $1 and $2 sign.
[Loaded com.product.rm.common.guibase.GuiBaseApplication$1 from file:/home/user/bcd/com.product.bss.vaadin/target/guibase-2.2.3-SNAPSHOT.jar]
[Loaded com.product.rm.common.guibase.GuiBaseApplication$2 from file:/home/user/bcd/com.product.bss.vaadin/target/guibase-2.2.3-SNAPSHOT.jar]
We checked and confirmed that these 2 classes are GuiBaseApplication$1 and GuiBaseApplication$2 are present in the guibase-2.2.4-SNAPSHOT.jar file but still class loading issue is there.
It will be very helpful if we get some directions for where to look further. What we can try to identify the cause and then resolve the issue.
it's was a Bug in vaadin check the page
https://floriansblog.wordpress.com/2015/04/30/vaadin-osgi-managing-the-classloader/
I am trying to use Eclipse to run a COMSOL model and I have read the guide from programming reference manual. However, Eclipse always report the error as follows,
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter at com.comsol.client.interfaces.b.(SourceFile:60) at com.comsol.client.interfaces.b.(SourceFile:39) at com.comsol.clientapi.engine.APIEngine$c.b(SourceFile:497) at com.comsol.clientapi.engine.APIEngine.a(SourceFile:115) at com.comsol.clientapi.engine.APIEngine.connect(SourceFile:98) at com.comsol.clientapi.engine.APIEngine.connect(SourceFile:87) at com.comsol.clientapi.engine.ClientModelUtil.connect(SourceFile:145) at com.comsol.clientapi.engine.ClientModelUtil.connect(SourceFile:133) at com.comsol.model.util.ModelUtil.connect(SourceFile:248) at PFCZM_3PBending_QuasiBrittle.main(PFCZM_3PBending_QuasiBrittle.java:16750) Caused by: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519) ... 10 more
I believe I have imported the JAR files correctly and set the path for the project and it seems that the error is due to lack of source file for COMSOL API JAR files. I have checked those JAR file and found they are indeed all class files without definition. How can I solve this problem? Thanks!
I have used java 1.9.0 and the path is correctly set in environment variable. Moreover,both Solr and java are in C drive. But its showing a consistent error:
Error: Could not find or load main class org.apache.solr.util.SolrCLI
Caused by: java.lang.ClassNotFoundException: org.apache.solr.util.SolrCLI
"Failed removing old solr logs"
Error: Could not find or load main class org.apache.solr.util.SolrCLI
Caused by: java.lang.ClassNotFoundException: org.apache.solr.util.SolrCLI
"Failed archiving old GC logs"
Error: Could not find or load main class org.apache.solr.util.SolrCLI
Caused by: java.lang.ClassNotFoundException: org.apache.solr.util.SolrCLI
"Failed archiving old console logs"
Error: Could not find or load main class org.apache.solr.util.SolrCLI
Caused by: java.lang.ClassNotFoundException: org.apache.solr.util.SolrCLI
"Failed rotating old solr logs"
Error: Unable to access jarfile start.jar
Error: Could not find or load main class org.apache.solr.util.SolrCLI
Help me solve this error..
The critical error in the logs seems to be " Unable to access jarfile start.jar".
Maybe this can help SLES Apache Solr start.jar, Unable to access jarfile
I'm trying to run Neo4j database with java but it gives me the following error :
java.lang.RuntimeException: Error starting org.neo4j.kernel.EmbeddedGraphDatabase, /home/matteo/neo4j-community-2.2.2/data/graph.db
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:334)
at org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:59)
at org.neo4j.graphdb.factory.GraphDatabaseFactory.newDatabase(GraphDatabaseFactory.java:108)
at org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(GraphDatabaseFactory.java:95)
at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:176)
at org.neo4j.graphdb.factory.GraphDatabaseFactory.newEmbeddedDatabase(GraphDatabaseFactory.java:67)
at Getter.main(Getter.java:46)
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.extension.KernelExtensions#2e9a2123' failed to initialize. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:489)
at org.neo4j.kernel.lifecycle.LifeSupport.init(LifeSupport.java:72)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:106)
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:330)
... 6 more
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.index.lucene.LuceneKernelExtension#1c3c1d18' failed to initialize. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:489)
at org.neo4j.kernel.lifecycle.LifeSupport.init(LifeSupport.java:72)
at org.neo4j.kernel.extension.KernelExtensions.init(KernelExtensions.java:74)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:483)
... 9 more
Caused by: java.lang.NoSuchFieldError: LUCENE_36
at org.neo4j.index.impl.lucene.LuceneDataSource.<clinit>(LuceneDataSource.java:88)
at org.neo4j.index.lucene.LuceneKernelExtension.init(LuceneKernelExtension.java:52)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:483)
... 12 more
Where is the problem??
Thank you very much!
Matteo
Since you're running embedded Neo4j this looks like you're missing lucene-core-3.6.2.jar on your classpath.
Best practice is to use a build system supporting transitive dependencies like gradle or maven. For those the most easy this is have a dependency on neo4j-community artifact, e.g. http://mvnrepository.com/artifact/org.neo4j/neo4j/2.2.5. This will pull in all other required jars.
I am running a grails test run-app all day with my application and it is fine. I type "grails prod war" to get a war, and dump it in the webapps folder of my tomcat install. Now i get the message like so:
11.11.2010 16:35:11 *ERROR* GrailsExceptionResolver: Executing action [index] of controller [ResumeController] caused e
xception: java.lang.NoClassDefFoundError: Could not initialize class org.docx4j.jaxb.Context (GrailsExceptionResolver.ja
va, line 72)
org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException: Executing action [index] of controll
er [ResumeController] caused exception: java.lang.NoClassDefFoundError: Could not initialize class org.docx4j.jaxb.Cont
ext
at org.jsecurity.web.servlet.JSecurityFilter.doFilterInternal(JSecurityFilter.java:382)
at org.jsecurity.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:180)
at java.lang.Thread.run(Unknown Source)
Caused by: org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.NoClassDefFoundError: Could not initialize
class org.docx4j.jaxb.Context
... 3 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.docx4j.jaxb.Context
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:599)
at org.docx4j.openpackaging.io.LoadFromZipNG.process(LoadFromZipNG.java:199)
at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:188)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:188)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:169)
at com.iai.skillsdb.DocxHelpers.DocxParser.openDocx4j(DocxParser.java:70)
at ResumeController$_closure8.doCall(ResumeController.groovy:164)
at ResumeController$_closure8.doCall(ResumeController.groovy)
at ResumeController.invokeMethod(ResumeController.groovy)
at ResumeController$_closure1.doCall(ResumeController.groovy:41)
at ResumeController$_closure1.doCall(ResumeController.groovy)
... 3 more
What is causing this? I have the docx4j jar in my WAR for sure, and it is there in the web-inf lib folder as well.
You're getting a java.lang.NoClassDefFoundError, not a java.lang.ClassNotFoundException. The class is being loaded, but a class that it depends on (directly or indirectly via another class) isn't there. You're most likely missing a jar that docx4j requires as a dependency.
Make sure that you have the correct version of docx4j and that there is absolutely no other version of docx4j in your classpath, there may be a version of this lib that did not have the 'Content' class implemented.