JEE shared library in WebLogic

2019-08-20 05:49发布

问题:

I am porting my application to WebLogic as an Enterprise Library so that my EJB and MDB can invoke code in it.

I have chosen a EAR packaging for both say Lib1.ear and Lib2.ear which contains APP-INF/lib directory and have 100's of jars in both. I also have updated the MANIFEST.MF of both to contains Specification-Version and Implementation-Version. Both are deployed successfully and available to be used.

Now I updated my ear which contains my EJB and MDB and added following in weblogic-application.xml;

 <wls:library-ref>
    <wls:library-name>Lib1</wls:library-name>
    <wls:specification-version>18</wls:specification-version>
</wls:library-ref>
<wls:library-ref>
    <wls:library-name>Lib2</wls:library-name>
    <wls:specification-version>18</wls:specification-version>
</wls:library-ref>

But when I am deploying my EAR (which constains EJB etc) it fails on the first step complaining that it does not find an interface which is defined and packaged in Lib1.ear shared lib as my one of my EJB implements that. I have enabled debug log but I am unable to find any information from WebLogic which directs me to the right path. All my EJB are initialising with the remote name etc but then I get a single line error in my log followed by a ClassNotfoundException;

<28-Nov-2017 15:26:18,005 o'clock GMT> <Error> <J2EE> <BEA-160228> <AppMerge failed to merge your application. If you are running AppMerge on the command-line, merge again with the -verbose option for more details. See the error message(s) below.>
weblogic.utils.compiler.ToolFailureException: com.xyz.abc.runtime.debugger.DebuggerListener
        at weblogic.application.compiler.FlowDriver.handleStateChangeException(FlowDriver.java:55)
        at weblogic.application.compiler.FlowDriver.nextState(FlowDriver.java:38)
        at weblogic.application.compiler.AppMerge.runBody(AppMerge.java:168)
        at weblogic.utils.compiler.Tool.run(Tool.java:159)
        at weblogic.utils.compiler.Tool.run(Tool.java:116)
        at weblogic.application.compiler.AppMerge.merge(AppMerge.java:198)
        at weblogic.deploy.api.internal.utils.AppMerger.merge(AppMerger.java:94)
        at weblogic.deploy.api.internal.utils.AppMerger.getMergedApp(AppMerger.java:58)
        at weblogic.deploy.api.model.internal.WebLogicDeployableObjectFactoryImpl.createDeployableObject(WebLogicDeployableObjectFactoryImpl.java:186)
        at weblogic.deploy.api.model.internal.WebLogicDeployableObjectFactoryImpl.createLazyDeployableObject(WebLogicDeployableObjectFactoryImpl.java:160)
        at weblogic.deploy.api.tools.SessionHelper.inspect(SessionHelper.java:781)
        at com.bea.console.actions.app.install.Flow$2.execute(Flow.java:530)
        at com.bea.console.utils.DeploymentUtils.runDeploymentAction(DeploymentUtils.java:5690)
        at com.bea.console.actions.app.install.Flow.appSelected(Flow.java:528)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.beehive.netui.pageflow.FlowController.invokeActionMethod(FlowController.java:870)
        at org.apache.beehive.netui.pageflow.FlowController.getActionMethodForward(FlowController.java:809)
        at org.apache.beehive.netui.pageflow.FlowController.internalExecute(FlowController.java:478)
        at org.apache.beehive.netui.pageflow.PageFlowController.internalExecute(PageFlowController.java:306)
        at org.apache.beehive.netui.pageflow.FlowController.execute(FlowController.java:336)
        at org.apache.beehive.netui.pageflow.internal.FlowControllerAction.execute(FlowControllerAction.java:52)
        at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
        at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.access$201(PageFlowRequestProcessor.java:97)
        at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor$ActionRunner.execute(PageFlowRequestProcessor.java:2044)
        at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors$WrapActionInterceptorChain.continueChain(ActionInterceptors.java:64)
        at org.apache.beehive.netui.pageflow.interceptor.action.ActionInterceptor.wrapAction(ActionInterceptor.java:184)
        at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors$WrapActionInterceptorChain.invoke(ActionInterceptors.java:50)
        at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors$WrapActionInterceptorChain.continueChain(ActionInterceptors.java:58)
        at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors.wrapAction(ActionInterceptors.java:87)
        at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processActionPerform(PageFlowRequestProcessor.java:2116)
        at com.bea.console.internal.ConsolePageFlowRequestProcessor.processActionPerform(ConsolePageFlowRequestProcessor.java:265)
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
        at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processInternal(PageFlowRequestProcessor.java:556)
        at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:853)
        at org.apache.beehive.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:631)
        at org.apache.beehive.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:158)
        at com.bea.console.internal.ConsoleActionServlet.process(ConsoleActionServlet.java:262)
        at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
        at com.bea.console.internal.ConsoleActionServlet.doGet(ConsoleActionServlet.java:134)
        at org.apache.beehive.netui.pageflow.PageFlowUtils.strutsLookup(PageFlowUtils.java:1199)
        at org.apache.beehive.netui.pageflow.PageFlowUtils.strutsLookup(PageFlowUtils.java:1129)
        at com.bea.portlet.adapter.scopedcontent.framework.internal.PageFlowUtilsBeehiveDelegate.strutsLookupInternal(PageFlowUtilsBeehiveDelegate.java:43)
        at com.bea.portlet.adapter.scopedcontent.framework.PageFlowUtils.strutsLookup(PageFlowUtils.java:108)
        at com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.executeAction(ScopedContentCommonSupport.java:707)
        at com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.processActionInternal(ScopedContentCommonSupport.java:141)
        at com.bea.portlet.adapter.scopedcontent.PageFlowStubImpl.processAction(PageFlowStubImpl.java:108)
        at com.bea.portlet.adapter.NetuiActionHandler.raiseScopedAction(NetuiActionHandler.java:111)
        at com.bea.netuix.servlets.controls.content.NetuiContent.raiseScopedAction(NetuiContent.java:181)
        at com.bea.netuix.servlets.controls.content.NetuiContent.raiseScopedAction(NetuiContent.java:167)
        at com.bea.netuix.servlets.controls.content.NetuiContent.handlePostbackData(NetuiContent.java:225)
        at com.bea.netuix.nf.ControlLifecycle$2.visit(ControlLifecycle.java:180)
        at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:324)
        at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
        at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
        at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
        at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
        at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
        at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
        at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
        at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
        at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
        at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
        at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
        at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
        at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
        at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
        at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
        at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
        at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
        at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
        at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
        at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
        at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
        at com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:130)
        at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:399)
        at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:361)
        at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:352)
        at com.bea.netuix.nf.Lifecycle.runInbound(Lifecycle.java:184)
        at com.bea.netuix.nf.Lifecycle.run(Lifecycle.java:159)
        at com.bea.netuix.servlets.manager.UIServlet.runLifecycle(UIServlet.java:465)
        at com.bea.netuix.servlets.manager.UIServlet.doPost(UIServlet.java:291)
        at com.bea.netuix.servlets.manager.UIServlet.service(UIServlet.java:219)
        at com.bea.netuix.servlets.manager.SingleFileServlet.service(SingleFileServlet.java:275)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        at com.bea.console.utils.MBeanUtilsInitSingleFileServlet.service(MBeanUtilsInitSingleFileServlet.java:64)
        at weblogic.servlet.AsyncInitServlet.service(AsyncInitServlet.java:125)
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:286)
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:260)
        at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:137)
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:350)
        at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
        at com.bea.console.internal.ParamFilter.doFilter(ParamFilter.java:38)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
        at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:32)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3701)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3667)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326)
        at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197)
        at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
        at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
        at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2443)
        at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2291)
        at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2269)
        at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1703)
        at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1663)
        at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:272)
        at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:352)
        at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:337)
        at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:57)
        at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
        at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:644)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:415)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:355)
Caused by: java.lang.ClassNotFoundException: com.xyz.abc.runtime.debugger.DebuggerListener
        at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:1029)
        at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:990)
        at weblogic.utils.classloaders.GenericClassLoader.doFindClass(GenericClassLoader.java:611)
        at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:543)
        at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:496)
        at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:473)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at weblogic.utils.classloaders.GenericClassLoader.defineClassInternal(GenericClassLoader.java:1113)
        at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:1046)
        at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:1038)
        at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:990)
        at weblogic.utils.classloaders.GenericClassLoader.doFindClass(GenericClassLoader.java:611)
        at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:543)
        at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:496)
        at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:473)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at weblogic.j2ee.wsee.compiler.WSEEModuleHelper.loadAndAppendOtherLinks(WSEEModuleHelper.java:164)
        at weblogic.j2ee.wsee.compiler.WSEEModuleHelper.processAnnotations(WSEEModuleHelper.java:186)
        at weblogic.wsee.tools.WSEEEJBToolsModuleExtension.processAnnotations(WSEEEJBToolsModuleExtension.java:121)
        at weblogic.wsee.tools.WSEEEJBToolsModuleExtension.merge(WSEEEJBToolsModuleExtension.java:87)
        at weblogic.application.compiler.flow.MergeModuleFlow.compile(MergeModuleFlow.java:44)
        at weblogic.application.compiler.FlowDriver$FlowStateChange.next(FlowDriver.java:70)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
        at weblogic.application.compiler.FlowDriver.nextState(FlowDriver.java:37)
        at weblogic.application.compiler.BaseMerger.merge(BaseMerger.java:20)
        at weblogic.application.compiler.flow.AppMergerFlow.mergeInput(AppMergerFlow.java:75)
        at weblogic.application.compiler.flow.AppMergerFlow.compile(AppMergerFlow.java:40)
        at weblogic.application.compiler.FlowDriver$FlowStateChange.next(FlowDriver.java:70)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
        at weblogic.application.compiler.FlowDriver.nextState(FlowDriver.java:37)
        ... 116 more

Am I missing anything?

回答1:

Just to answer for others so that they can get this done quickly. If shared lib is packaged as WAR can only be referenced by other WAR's not an EAR. So I updated my package to be an EAR. As I stated above all I wanted to share my libs which are POJO's I had to use following structure and my EAR was able to see classes successfully.

    LIB1.ear
    META-INF
        application.xml
        weblogic-application.xml
        MANIFEST.MF
    APP-INF
        lib
            *.jar (all pojo's here and WebLogic will add these into Application Classpath)
    dummyejb-1.0.0.jar  (just so that I can deploy this ear in server otherwise it won't continue)