EJB cannot locate the log 4j in the classpath - log4j

on my WAS 6.1, I have an EJb deployed in an EAR and the EJb uses log4j. I am getting this error while trying to call EJb through a remote client:
Caused by: java.lang.NoClassDefFoundError: org.apache.log4j.Priority
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:69)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:131)
at com.bmo.olbb.prs.integration.service.util.PRSUtil.<clinit>(PRSUtil.java:13)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:196)
... 10 more
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Priority
Inside the installedapps directroy, in the EAR folder, I have the EJB jar and also log4j-1.2.15.jar. So why am I getting this? The otehr thing is how can it be ClassNotFoundException and NoClassDefFoundError at the same time?

Did you add the log4j jar to your EJB jar's meta-inf/Manifest.mf file?
Manifest-Version: 1.0
Class-Path: log4j-1.2.15.jar

Related

Primefaces Extension 11 NoClassDefFoundError EditorOptions

Runtime error when running primefaces-extension 11 component monacoEditor on JBoss EAP 7.3
Stacktrace:
Caused by: javax.faces.FacesException: Cant instantiate class: org.primefaces.extensions.component.monacoeditor.MonacoEditorInline.
at com.sun.faces.application.ApplicationImpl.newThing(ApplicationImpl.java:1738)
at com.sun.faces.application.ApplicationImpl.createComponentApplyAnnotations(ApplicationImpl.java:1893)
... 105 more
Caused by: java.lang.NoClassDefFoundError: org/primefaces/extensions/model/monacoeditor/EditorOptions
at org.primefaces.extensions.component.monacoeditor.MonacoEditorBase.<init>(MonacoEditorBase.java:57)
at org.primefaces.extensions.component.monacoeditor.MonacoEditorInline.<init>(MonacoEditorInline.java:57)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
I also use
<dependency>
<groupId>org.primefaces.extensions</groupId>
<artifactId>resources-monacoeditor</artifactId>
<version>11.0.4</version>
</dependency>
Primefaces 11, Primefaces-exstension 11.0.4, resources-monacoeditor 11.0.4, mojarra 2.1.28, Jboss EAP 7.3
I solve the problem. Our project is an EAR and we use monaco editor and resources-monacoeditor in one of the module of the EAR that produce a WAR. When put the resources-monacoeditor library also in the main pom (pom of the EAR, parent pom) error is solved

Karaf bundle using ch.qos.logback , log4j org/apache/logging/log4j/util/ReflectionUtil

I have an osgi 6.0.0 project which uses logback and slf4j.
Currently I am implementing a bundle which depends on an external jar which uses
org.apache.logging.log4j
during the command line execution the bundle my karaf console freezes by displaying this error :
Exception in thread "Karaf local console user karaf" java.lang.NoClassDefFoundError: org/apache/logging/log4j/util/ReflectionUtil
at org.apache.logging.log4j.core.impl.ThrowableProxy.(ThrowableProxy.java:145)
at org.apache.logging.log4j.core.impl.ThrowableProxy.(ThrowableProxy.java:125)
at org.apache.logging.log4j.core.impl.MutableLogEvent.getThrownProxy(MutableLogEvent.java:338)
at org.ops4j.pax.logging.log4j2.internal.PaxLoggingEventImpl.getThrowableStrRep(PaxLoggingEventImpl.java:76)
at org.apache.karaf.log.core.internal.KarafLogEvent.(KarafLogEvent.java:45)
at org.apache.karaf.log.core.internal.LogServiceImpl.doAppend(LogServiceImpl.java:177)
at org.ops4j.pax.logging.log4j2.internal.PaxAppenderProxy.doAppend(PaxAppenderProxy.java:65)
at org.ops4j.pax.logging.log4j2.appender.PaxOsgiAppender.append(PaxOsgiAppender.java:82)
at org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:156)
at org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:129)
at org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:120)
at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:84)
at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:448)
at org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:433)
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:417)
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:403)
at org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:63)
at org.apache.logging.log4j.core.Logger.logMessage(Logger.java:146)
at org.ops4j.pax.logging.log4j2.internal.PaxLoggerImpl.doLog0(PaxLoggerImpl.java:151)
at org.ops4j.pax.logging.log4j2.internal.PaxLoggerImpl.doLog(PaxLoggerImpl.java:144)
at org.ops4j.pax.logging.log4j2.internal.PaxLoggerImpl.error(PaxLoggerImpl.java:192)
at org.ops4j.pax.logging.internal.TrackingLogger.error(TrackingLogger.java:96)
at org.ops4j.pax.logging.slf4j.Slf4jLogger.error(Slf4jLogger.java:953)
at org.apache.karaf.shell.support.ShellUtil.logException(ShellUtil.java:152)
at org.apache.karaf.shell.impl.console.ConsoleSessionImpl.doExecute(ConsoleSessionImpl.java:474)
at org.apache.karaf.shell.impl.console.ConsoleSessionImpl.run(ConsoleSessionImpl.java:407)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.util.ReflectionUtil not found by org.apache.logging.log4j.api [112]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1639)
at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1414)
at org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1660)
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1590)
at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 27 more
I found the solution, the class org/apache/logging/log4j/util/ReflectionUtil no longer exists as of 2.9.0.
i just have to use a version lower than this one

java.lang.NoClassDefFoundError: org/apache/commons/collections/map/ReferenceMap error with commons-collections-2.1

My project used below mentions jars:
commons-collections-2.1.jar
myfaces-api-1.1.3.jar
myfaces-impl-1.1.3.jar
and jsf version 1.1 but getting this error:
java.lang.NoClassDefFoundError: org/apache/commons/collections/map/ReferenceMap
and commons-collection jar is available at runtime.

Configuring slf4j and log4j correctly on WebSphere 8.5

WHat's the correct way to configure slf4j + log4j on WebSphere 8.5.
My approach was:
* Include slf4j-api in WEB-INF\lib of the war files of the applications
* Include the binding ja slf4j-log4j in WebSphere lib
* Include log4j.xml in JVM classpath external to the war file.
Only problem is that it doesn't work. It fails with an error on initializing.
Guess my approach is wrong?
Thanks for any assistance!
Here's the stack trace. Note that slfj-api is found in WEB-INF\lib of the WAR file:
Caused by: java.lang.NoClassDefFoundError: org.slf4j.spi.LoggerFactoryBinder
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:295)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:154)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:711)
at java.net.URLClassLoader.access$400(URLClassLoader.java:92)
at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:1159)
at java.security.AccessController.doPrivileged(AccessController.java:314)
at java.net.URLClassLoader.findClass(URLClassLoader.java:594)
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:204)
at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:116)
at java.lang.ClassLoader.loadClass(ClassLoader.java:690)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:616)
at java.lang.ClassLoader.loadClass(ClassLoader.java:690)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:584)
at java.lang.ClassLoader.loadClass(ClassLoader.java:690)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:584)
at java.lang.ClassLoader.loadClass(ClassLoader.java:690)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254)
at no.klp.minside.handler.SoapLoggingHandler.<clinit>(SoapLoggingHandler.java:28)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:236)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:80)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:57)`enter code here`
at java.lang.reflect.Constructor.newInstance(Constructor.java:539)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:110)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:280)
... 113 more
Caused by: java.lang.ClassNotFoundException: org.slf4j.spi.LoggerFactoryBinder
at java.net.URLClassLoader.findClass(URLClassLoader.java:599)
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:204)
at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:116)
at java.lang.ClassLoader.loadClass(ClassLoader.java:690)
... 147 more

java.lang.NoClassDefFoundError: org/ajax4jsf/resource/InternetResourceBuilder

My application, which uses JSF 2 and Richfaces 3.3.3, and mojarra 2.0.2 works fine on Glassfish 3.1 , but whenever i port it on Tomcat 7.0.10, every time i get one or the other problem.
It started with failure to detect jsf_core.tld , followed by some JSF rendering issue and finally this one.
Lastly i found some which i m mentioning here and which i cannot find a way around to fix.
Mar 31, 2011 8:57:52 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! org/ajax4jsf/resource/InternetResourceBuilder
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:294)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4651)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5154)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5149)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! org/ajax4jsf/resource/InternetResourceBuilder
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:357)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:226)
... 8 more
Caused by: java.lang.NoClassDefFoundError: org/ajax4jsf/resource/InternetResourceBuilder
at org.ajax4jsf.renderkit.ChameleonRenderKitFactory.<init>(ChameleonRenderKitFactory.java:62)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java:586)
at javax.faces.FactoryFinder.getImplementationInstance(FactoryFinder.java:472)
at javax.faces.FactoryFinder.access$400(FactoryFinder.java:139)
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:796)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:306)
at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:294)
at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:213)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:338)
... 9 more
You've the RichFaces impl JAR file, but not the RichFaces API JAR in the runtime classpath.
The stacktrace is evidence of this:
Caused by: java.lang.NoClassDefFoundError: org/ajax4jsf/resource/InternetResourceBuilder
at org.ajax4jsf.renderkit.ChameleonRenderKitFactory.<init>(ChameleonRenderKitFactory.java:62)
The at org.ajax4jsf.renderkit.ChameleonRenderKitFactory line indicates that this particular class was successfully loaded and executed (otherwise it wouldn't have shown up as an at xxx in the stacktrace at all). This class is part of RichFaces impl JAR file. The InternetResourceBuilder is in turn part of the RichFaces API JAR file. This is apparently missing in the runtime classpath. At least, that's just exactly what the exception is telling us.
From the exception it seems that Richfaces cannot be found. Put the jar in your classpath (for Tomcat WEB-INF/lib or WEB-INF/classes) and try again.

Resources