I am upgrading project from Java 8 to 11. In Java 8, functionality works fine but In Java 11, it gives runtime error. Any workaround? Any dependency needs to be added?
Getting following exception with Java 11:
Exception in thread "main" java.lang.NoClassDefFoundError: de/ruedigermoeller/serialization/FSTObjectInput
...
Caused by: java.lang.ClassNotFoundException: de.ruedigermoeller.serialization.FSTObjectInput
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 6 more
Found the root cause. The required dependency was excluded from one of jar in pom.xml and it was causing the issue.
<exclusion>
<groupId>de.ruedigermoeller</groupId>
<artifactId>fst</artifactId>
</exclusion>
Related
I am trying to use Elasticsearch with Spark but I am getting some errors.
i use Spark 3.0.1 and Elasticsearch 7.10.0 and elasticsearch-hadoop 7.1.0
scala version 2.12
someone can help me ?
Exception in thread "main" java.lang.NoClassDefFoundError: scala/Product$class
at org.elasticsearch.spark.sql.ElasticsearchRelation.<init>(DefaultSource.scala:215)
at org.elasticsearch.spark.sql.DefaultSource.createRelation(DefaultSource.scala:93)
at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:344)
at org.apache.spark.sql.DataFrameReader.loadV1Source(DataFrameReader.scala:297)
at org.apache.spark.sql.DataFrameReader.$anonfun$load$2(DataFrameReader.scala:286)
at scala.Option.getOrElse(Option.scala:189)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:286)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:232)
at net.jgp.books.spark.ch08.ElasticsearchToDatasetApp.start(ElasticsearchToDatasetApp.java:42)
at net.jgp.books.spark.ch08.ElasticsearchToDatasetApp.main(ElasticsearchToDatasetApp.java:18)
Caused by: java.lang.ClassNotFoundException: scala.Product$class
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 10 more```
My application was running fine with Wicket 7.6.0. But now I am facing below exception after migration from Wicket 7.6 to 8.5.
Caused by: java.lang.NoClassDefFoundError: org/apache/wicket/util/convert/converter/ZeroPaddingIntegerConverter
at org.apache.wicket.extensions.yui.calendar.DateTimeField.(DateTimeField.java:119)
Caused by: java.lang.ClassNotFoundException: org.apache.wicket.util.convert.converter.ZeroPaddingIntegerConverter
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1358)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
... 77 more
In my code nowhere used this class "ZeroPaddingIntegerConverter" but still getting this error for this class.
:
ZeroPaddingIntegerConverter class has been deprecated in Wicket 8.x version.
wicket-datetime module has been removed with Wicket 8 and moved to WicketStuff. In your code you are probably mixing the old wicket-datetime module (7.6.0) with Wicket 8.5. Just remove the old module and replace it with WicketStuff dependency:
<dependency>
<groupId>org.wicketstuff</groupId>
<artifactId>wicket-datetime</artifactId>
<version>8.5.0</version>
</dependency>
I'm trying trying to load Hibernate XML configuration on OpenJ9 (JDK14) but since JAXB are not longer part of the JDK I get this error:
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.ValidationEventHandler
I tried to follow some of the answers on: How to resolve java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException in Java 9 but it seems like none are working on OpenJ9 and when trying to include any of the dependencies I'm getting the following error:
Caused by: javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
- with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:278)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:421)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:721)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:662)
at org.hibernate.boot.cfgxml.internal.JaxbCfgProcessor.unmarshal(JaxbCfgProcessor.java:122)
... 5 more
Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:788)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1081)
at javax.xml.bind.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.java:122)
at javax.xml.bind.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.java:155)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:276)
... 9 more
I found the missing part in the puzzle, the javax.xml.bind.JAXBContextFactory needs to be set in the system property.
So the solution is adding JAXB to list of dependencies:
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.moxy</artifactId>
<version>2.7.3</version>
</dependency>
And then in the code (or when the JVM starts) set the system property to point to the right factory.
System.setProperty("javax.xml.bind.JAXBContextFactory", "org.eclipse.persistence.jaxb.JAXBContextFactory");
Last since I'm running in a custom classloader the ContextClassLoader has to be set otherwise the factory can't be found.
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
In our XPages project now we have to use Quartz Scheduler. I've tried to import all necessary jars which includes the following:
c3p0-0.9.5.2
log4j-1.2.16.jar
quartz-2.3.0-SNAPSHOT.jar
quartz-jobs-2.3.0-SNAPSHOT.jar
slf4j-api-1.7.7.jar
slf4j-log4j12-1.7.7.jar
I've imported all the jars to our project but when loading a page (which doesn't even call quartz or anything) I get the following exception:
Error 500
HTTP Web Server: Command Not Handled Exception
In a log I see:
01.12.19 2:04: Exception Thrown
java.lang.RuntimeException: com.ibm.xsp.FacesExceptionEx: org.apache.commons.logging.LogConfigurationException: java.lang.reflect.InvocationTargetException
at com.ibm.designer.runtime.domino.adapter.ComponentModule.initModule(ComponentModule.java:473)
at com.ibm.domino.xsp.module.nsf.NSFComponentModule.initModule(NSFComponentModule.java:498)
at com.ibm.domino.xsp.module.nsf.NSFService.createNSFModule(NSFService.java:752)
at com.ibm.domino.xsp.module.nsf.NSFService.loadModule(NSFService.java:735)
at com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:588)
at com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482)
at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:357)
at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:313)
at com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)
Caused by: com.ibm.xsp.FacesExceptionEx: org.apache.commons.logging.LogConfigurationException: java.lang.reflect.InvocationTargetException
at com.ibm.xsp.config.CLBootStrap.initContext(CLBootStrap.java:89)
at com.ibm.xsp.config.BootStrap.init(BootStrap.java:82)
at com.ibm.xsp.config.ConfigureCoreListener.contextInitialized(ConfigureCoreListener.java:39)
at com.ibm.designer.runtime.domino.adapter.ComponentModule.initModule(ComponentModule.java:465)
... 8 more
Caused by: org.apache.commons.logging.LogConfigurationException: java.lang.reflect.InvocationTargetException
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:532)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:272)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:414)
at org.apache.commons.digester.Digester.<init>(Digester.java:346)
at com.sun.faces.config.ConfigureListener.digester(ConfigureListener.java:1005)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:383)
at com.ibm.xsp.config.CLBootStrap.initContext(CLBootStrap.java:81)
... 11 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedConstructorAccessor1791.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:57)
at java.lang.reflect.Constructor.newInstance(Constructor.java:437)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:525)
... 17 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at org.apache.commons.logging.impl.Log4JLogger.<init>(Log4JLogger.java:102)
... 21 more
I suspect that this problem is related to Axis 1.4 log4j-1.2.8.jar incompatible with XPages?
I've tried to follow the advice and added the following to java.policy (section grant codeBase):
permission java.lang.RuntimePermission "setContextClassLoader";
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
But still with no luck.
What's the problem?
Thanks in advance
I've resolved the issue by adding all logging libraries:
log4j-1.2.16.jar
slf4j-api-1.7.7.jar
slf4j-log4j12-1.7.7.jar
to lib/ext
I just tried to use the jersey-server api in a java application.
It's a maven project and I already added the mysql-connector api which works fine.
When the application which is compressed into a jar (Intellij-Artifacts) runs, it throws the exception:
Exception in thread "main" java.lang.NoClassDefFoundError:
com/sun/jersey/api/container/httpserver/HttpServerFactory
at de.myleak.server.Server.init(Server.java:19)
at de.myleak.core.Core.init(Core.java:87)
at de.myleak.core.Core.<init>(Core.java:51)
at de.myleak.core.Core.main(Core.java:40)
Caused by: java.lang.ClassNotFoundException:
com.sun.jersey.api.container.httpserver.HttpServerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 4 more
I added the dependency to the pom.xml
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.19.4</version>
</dependency>
I also added the maven dependency in the project structure
screenshot