问题
In my JSF project workspace, I have a Java project A and a Weblogic EJB project B that uses the Java project.
On generating the EAR I can see that the jar for Project A and B are there in the EAR as well as that of other projects in the workspace.
However, on trying to access class from A in B i am getting a class not found exception.
The Ejb Project B has the managedbean/dao/ejb/delegate
and at this point the EJB is not getting called at all. The managedbean is instantiated and from another action call I am calling the method(loadWorklist) from where the offending class is called.
Is there any specific setting I am missing?
Note this is deployed as EAR in weblogic 9.2 in UNIX server. All required jars are loaded from inside the EAR at runtime only the classes in project A is missing.
Stack trace from the error:
javax.faces.FacesException: Error calling action method of component with id worklistForm:_idJsp131
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
at javax.faces.component.UICommand.broadcast(UICommand.java:109)
at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
Truncated. see log file for complete stacktrace
javax.faces.el.EvaluationException: Exception while invoking expression #{worklistManagedBean.loadWorklist}
at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:156)
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:61)
at javax.faces.component.UICommand.broadcast(UICommand.java:109)
at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
Truncated. see log file for complete stacktrace
java.lang.NoClassDefFoundError: com/tcs/nextgen/workflow/util/WorkflowUtil
at com.ultimatix.nextgen.worklist.managedbean.WorklistManagedBean.loadWorklist(WorklistManagedBean.java:36)
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:585)
Truncated. see log file for complete stacktrace
Ear structure:
EAR
|
|-META-INF
|-library1.jar
|-library2.jar
|-A.jar
|-B.jar
Since this is an existing legacy app, jars are not in APP-INF/lib.
回答1:
If module B
uses classes from module A
, then module A
must be declared in the class path in the MANIFEST.MF
of module B
. The class path entries in this file is relative, so since the modules are at the same level, you can just specifiy A.jar
. Other common libraries can be put in APP-INF/lib
and will be automatically added to the class path. This however, is WebLogic specific behaviour.
来源:https://stackoverflow.com/questions/16234566/class-not-found-exception-from-weblogic-9-2