I got this exception:
SEVERE: Exception sending context initialized event to listener instance of class utils.DBConfig
java.lang.NoClassDefFoundError: org/jboss/logging/Logger
at org.hibernate.jpa.HibernatePersistenceProvider.<clinit>(HibernatePersistenceProvider.java:38)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at javax.persistence.spi.PersistenceProviderResolverHolder$DefaultPersistenceProviderResolver.getPersistenceProviders(PersistenceProviderResolverHolder.java:99)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:75)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at utils.DBConfig.contextInitialized(DBConfig.java:22)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5003)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5517)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.jboss.logging.Logger
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1858)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1709)
... 19 more
I have added to build following jar files:
javax.persistence.jar
hibernate-entitymanager.jar
Someone know how to fix it?
You miss the jboss-common.jar add it to your classpath.
If you use Maven:
il you have "java.lang.NoClassDefFoundError xxxxxx" error, you search in google: "maven xxxxxx". you find http://mvnrepository.com/artifact/...
copy/paste the dependency in pom.xml file.
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<version>3.3.0.Final</version>
</dependency>
Download a newer version of that Jar file from the Maven Repository and put it in your lib directory. Better use Maven.
Related
I have started using IntelliJ for my projects recently. I was trying to develop a simple maven project and got stuck into issue. I was trying to play around with kakfa-clients. Here is my dependencies
<dependencies>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>2.5.0</version>
</dependency>
</dependencies>
I tried doing maven clean and install. I see the following error after I execute the code.
C:\KB\SDA>java -cp target/SDA-1.0-SNAPSHOT.jar org.example.code.Demo
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/kafka/clients/producer/Producer
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.kafka.clients.producer.Producer
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)
... 7 more
However I could see the kafka-clients:2.5.0 is available in the External Libraries folder
I would like to know what could have gone wrong. Any hint would definitely help.
Java version 8
IntellJ 2020.1
Kafka-Client itself is dependent on other dependencies. Have a look here https://mvnrepository.com/artifact/org.apache.kafka/kafka-clients/2.5.0
Give a shot by including other jars in the classpath.
java -cp target/*.jar:. org.example.code.Demo
We are trying to deploy a spring-based Java application to Bluemix using the Liberty for Java buildpack. We see the error below. We are not even using the org.apache.tiles package. The same application build works fine on a development Tomcat server.
Stack Dump = java.lang.NoClassDefFoundError: org.apache.tiles.el.ScopeELResolver
at java.lang.J9VMInternals.prepareClassImpl(Native Method)
at java.lang.J9VMInternals.prepare(Unknown Source)
at java.lang.Class.getDeclaredMethods(Unknown Source)
at com.ibm.wsspi.injectionengine.MethodMap.getMethods(MethodMap.java:150
)
at com.ibm.wsspi.injectionengine.MethodMap.getAllDeclaredMethods(MethodM
ap.java:86)
at com.ibm.ws.injectionengine.InjectionProcessorManager.getAllDeclaredMe
thods(InjectionProcessorManager.java:430)
at com.ibm.ws.injectionengine.InjectionProcessorManager.processAnnotatio
ns(InjectionProcessorManager.java:231)
at com.ibm.ws.injectionengine.AbstractInjectionEngine.processInjectionMe
taData(AbstractInjectionEngine.java:514)
at com.ibm.ws.injectionengine.osgi.internal.OSGiInjectionEngineImpl.proc
essInjectionMetaData(OSGiInjectionEngineImpl.java:239)
at com.ibm.ws.injectionengine.ReferenceContextImpl.processImpl(Reference
ContextImpl.java:633)
at com.ibm.ws.injectionengine.ReferenceContextImpl.process(ReferenceCont
extImpl.java:305)
at com.ibm.ws.injectionengine.osgi.internal.OSGiReferenceContextImpl.pro
o
cess(OSGiReferenceContextImpl.java:31)
at com.ibm.ws.webcontainer.osgi.webapp.WebApp.commonInitializationStart(
WebApp.java:254)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:1038)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6565)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVi
rtualHost.java:468)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApplication(D
ynamicVirtualHost.java:463)
at com.ibm.ws.webcontainer.osgi.WebContainer.startWebApplication(WebCont
ainer.java:1051)
at com.ibm.ws.webcontainer.osgi.WebContainer.access$000(WebContainer.jav
a:104)
at com.ibm.ws.webcontainer.osgi.WebContainer$2.run(WebContainer.java:870
)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.tiles.el.ScopeELResolver
at com.ibm.ws.classloading.internal.AppClassLoader.findClassCommonLibrar
yClassLoaders(AppClassLoader.java:499)
at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoa
der.java:282)
at java.lang.ClassLoader.loadClassHelper(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadCla
ss(AppClassLoader.java:477)
SEVERE: Exception sending context initialized event to listener
instance of class
org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at
org.springframework.core.CollectionFactory.(CollectionFactory.java:64)
at
org.springframework.web.context.ContextLoader.(ContextLoader.java:153)
at
org.springframework.web.context.ContextLoaderListener.createContextLoader(ContextLoaderListener.java:53)
at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:44)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4544)
at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5016)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1035)
at
org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:738)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1035)
at
org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:289)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
at
org.apache.catalina.core.StandardService.startInternal(StandardService.java:442)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
at
org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:674)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
at org.apache.catalina.startup.Catalina.start(Catalina.java:596) 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.catalina.startup.Bootstrap.start(Bootstrap.java:303) at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431) Caused
by: java.lang.ClassNotFoundException:
org.apache.commons.logging.LogFactory 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) ... 24 more
I am using tom cat- 7, Maven version is 4.0.0
Can you please suggest me on this..
Thanks in advance
commons-logging dependency is missing. it should be in lib directory or in pom dependency declaration.
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
you need check commons-logging-1.2.jar in you tomcat lib.
some dependency jar is in you project .but may not in tomcat.
I am working on a website using struts2 framework. I tried to run the code but then I encountered an error as below
SEVERE: Exception sending context initialized event to listener instance of class org.apache.struts2.tiles.StrutsTilesListener
java.lang.NoClassDefFoundError: org/apache/tiles/context/TilesRequestContextFactory
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2944)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1208)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
at org.apache.tiles.jsp.context.JspTilesContextFactory.<init>(JspTilesContextFactory.java:51)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.apache.tiles.context.ChainedTilesContextFactory.init(ChainedTilesContextFactory.java:84)
at org.apache.struts2.tiles.StrutsTilesContainerFactory$StrutsTilesContextFactory.init(StrutsTilesContainerFactory.java:79)
at org.apache.struts2.tiles.StrutsTilesContainerFactory.storeContainerDependencies(StrutsTilesContainerFactory.java:55)
at org.apache.tiles.factory.TilesContainerFactory.initializeContainer(TilesContainerFactory.java:231)
at org.apache.tiles.factory.TilesContainerFactory.createTilesContainer(TilesContainerFactory.java:198)
at org.apache.tiles.factory.TilesContainerFactory.createContainer(TilesContainerFactory.java:163)
at org.apache.tiles.web.startup.TilesListener.createContainer(TilesListener.java:90)
at org.apache.struts2.tiles.StrutsTilesListener.createContainer(StrutsTilesListener.java:70)
at org.apache.tiles.web.startup.TilesListener.contextInitialized(TilesListener.java:57)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.tiles.context.TilesRequestContextFactory
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1718)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
... 31 more
It's a 404 error but I don't know why because I included all the tile libraries. Specifically, I am using struts2-core-2.1.6.jar and tiles-core-2.0.6.jar, build path is included and tiles listener is configured
<listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>
More details: I am using struts-2.3.16.1 library and included
tiles-api-2.1.2.jar
tiles-compat-3.0.1.jar
tiles-core-2.0.6.jar
tiles-jsp-2.1.2.jar
tiles-servlet-3.0.1.jar
commons-beanutils-1.8.0.jar
commons-digester-2.0.jar
struts2-tiles-plugin-2.3.16.1.jar
in WEB-INF/lib
I have compile my xsd doc and begun to write junit tests for my wrapper.
When I call marshal I get the stack trace below. I was surprised to have an eclipse class not found. (org.eclipse.persistence.jaxb.JAXBContextFactory)
What am I missing from my classpath? Or is there something else I am missing?
I am running eclipse indigo 3.7.2.
My classpath include the following jars:
jaxb-api.jar, jaxb-impl.jar, jaxb-xjc.jar, jaxb1impl.jar, jsr173_1.0_api.jar,
My compiler is set to java 6 compatability.
1 [main] WARN com.bellsouth.snt.cnmp.dao.csp.CspInputMarshaller - Cannot marshal xml data
javax.xml.bind.JAXBException: Provider org.eclipse.persistence.jaxb.JAXBContextFactory not found
- with linked exception:
[java.lang.ClassNotFoundException: org.eclipse.persistence.jaxb.JAXBContextFactory]
at javax.xml.bind.ContextFinder.newInstance(Unknown Source)
at javax.xml.bind.ContextFinder.find(Unknown Source)
at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
at com.bellsouth.snt.cnmp.dao.csp.CspInputMarshaller.jaxbMarshal(CspInputMarshaller.java:69)
at com.bellsouth.snt.cnmp.dao.csp.CspInputMarshaller.marshal(CspInputMarshaller.java:46)
at com.bellsouth.snt.cnmp.dao.csp.CspInputMarshallerTest.testGetUserRequest(CspInputMarshallerTest.java:25)
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 junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException: org.eclipse.persistence.jaxb.JAXBContextFactory
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 javax.xml.bind.ContextFinder.safeLoadClass(Unknown Source)
... 26 more
UPDATE: a manual workaround
The missing jar file is jaxb-impl.jar It is in my class path included from the jars in the ear project. If I add jaxb-impl.jar in the classpath ahead of the default classpath. it runs fine.
In other project in my same workspace I do not have this issue.
you may need the following dependencies, if you are using Maven,please refer to the following dependencies:
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.moxy</artifactId>
<version>2.6.8</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.11</version>
</dependency>