Hello,
I created a simple web application and added log4J's jar in my lib folder and it seems to work fine. Then i created a Ejb module and did the same thing of adding jar file in my classpath, but i am getting this error :-
Caused by: javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean: java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at com.sun.ejb.containers.BaseContainer.checkExceptionClientTx(BaseContainer.java:4929)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4761)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1955)
... 94 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at common.Utils.getRssFeed(Utils.java:128)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1052)
at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1124)
at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5243)
at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:615)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797)
at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:567)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:157)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:139)
at sun.reflect.GeneratedMethodAccessor102.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:858)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:367)
at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5215)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5203)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:190)
... 92 more
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
at com.sun.enterprise.loader.ASURLClassLoader.findClassData(ASURLClassLoader.java:736)
at com.sun.enterprise.loader.ASURLClassLoader.findClass(ASURLClassLoader.java:626)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 113 more
I don't even have any other version of log4j in classpath. Any idea why is this error coming?
Actually first i created a Enterprise application and everything seemed to work fine. But then, i copied files from my enterprise application's ejb module to a separate module and since then these errors are coming. This is in my build-impl.xml :-
<target depends="compile" name="library-inclusion-in-archive">
<copyfiles files="${libs.Log4J.classpath}" todir="${build.classes.dir}"/>
</target>
<target depends="compile" name="library-inclusion-in-manifest">
<copyfiles files="${libs.Log4J.classpath}" todir="${dist.ear.dir}/lib"/>
<manifest file="${build.ear.classes.dir}/META-INF/MANIFEST.MF" mode="update"/>
</target>
Don't know why is this pointing to ear instead of jar. Is there any problem with the above statement? How do i resolve this? I am using Netbeans 6.8
Thanks in advance :)
EDIT :-
The structure of my ejb module is :-
mymodule.jar
|_mypackage
| |_myclass.class
|
|_META_INF
| |_MANIFEST.MF
| |_persistence.xml
| |_sun-ejb-jar.xml
|
|_log4j-1.2.16.jar
The contents of my MANIFEST.MF is :-
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 14.1-b02 (Sun Microsystems Inc.)
Class-Path: log4j-1.2.16.jar
There is no application.xml
2nd Edit If i place lib file in my appserver/lib directory, it works fine. Why can't i make use of external jar files from within my project?