2 Replies Latest reply on Oct 19, 2017 7:51 AM by jackspa

    Dependency from Module to EAR

    jackspa

      Hi,

       

      Good Day....

       

      We are working on a project to migratate J2EE application from WAS 8.5 to JBOSS EAP 7.0 and we are new to JBOSS.

       

      Application bundle  with:

      1) EAR (WAR and EJB)

      2) Application Utility Jars and Persistence jars (Entity classes)

      3)Third party jar like log4j2.5,Jackson,hibernate,

       

      We created folder named sharedLib and maintained sharedLib/main/module.xml

       

      We moved all our  Application Utility Jars, Persistence jars, and  Third party jar to shardLib Module.

       

              <resource-root path="../SEC_BatchService_Contract-1.0.0.jar"/>

              <resource-root path="../SEC_DepartmentService_Contract-1.0.0.jar"/>

              <resource-root path="../SEC_LoginService_Contract-1.0.0.jar"/>

              <resource-root path="../SEC_MenuService_Contract-1.0.0.jar"/>

              <resource-root path="../SEC_ProcessesService_Contract-1.0.0.jar"/>

              <resource-root path="../SEC_SessionMaintenanceService_Contract-1.0.0.jar"/>

              <resource-root path="../SEC_SessionService_Contract-1.0.0.jar"/>

              <resource-root path="../SecurityInterfaceServices_Contract-1.0.0.jar"/>

              <resource-root path="../SEC_UserAuthoriser_Contract-1.0.0.jar"/>

              <resource-root path="../SEC_UserMaintenanceService_Contract-1.0.0.jar"/>

              <resource-root path="../SEC_UserRole_Contract-1.0.0.jar"/>

              <resource-root path="../SystemUtility_Contract-1.0.0.jar"/>

              <resource-root path="../WorkFlow_Contract-1.0.0.jar"/>

              <resource-root path="../Application_Contract-1.0.0.jar"/>

              <resource-root path="../BootStrapService_Contract-1.0.0.jar"/>

              <resource-root path="../Intergration_Contract-1.0.0.jar"/>

              <resource-root path="../Logger_Contract-1.0.0.jar"/>

              <resource-root path="../Persistence_Contract-1.0.0.jar"/>

              <resource-root path="/apps/SGDEV/config/SEC/product/thirdParty/Logger_Contract-1.0.0.jar"/>

              <resource-root path="/apps/SGDEV/config/SEC/product/thirdParty/antlr-2.7.7.jar"/>

              <resource-root path="/apps/SGDEV/config/SEC/product/thirdParty/btf-1.2.jar"/>

              <resource-root path="/apps/SGDEV/config/SEC/product/thirdParty/com.ibm.websphere.appserver.api.json-1.0.13.jar"/>

              <resource-root path="/apps/SGDEV/config/SEC/product/thirdParty/commons-codec-1.3.jar"/>

              <resource-root path="/apps/SGDEV/config/SEC/product/thirdParty/commons-httpclient-3.0.jar"/>

              <resource-root path="/apps/SGDEV/config/SEC/product/thirdParty/cors-filter-2.5.jar"/>

              <resource-root path="/apps/SGDEV/config/SEC/product/thirdParty/disruptor-3.0.0.jar"/>

              <resource-root path="/apps/SGDEV/config/SEC/product/thirdParty/dom4j-1.6.1.jar"/>

              <resource-root path="/apps/SGDEV/config/SEC/product/thirdParty/guava-19.0.jar"/>

              <resource-root path="/apps/SGDEV/config/SEC/product/thirdParty/hibernate-commons-annotations-4.0.5.Final.jar"/>

              <resource-root path="/apps/SGDEV/config/SEC/product/thirdParty/hibernate-core-4.2.7.Final.jar"/>

              <resource-root path="/apps/SGDEV/config/SEC/product/thirdParty/hibernate-jpa-2.0-api-1.0.1.Final.jar"/>

              <resource-root path="/apps/SGDEV/config/SEC/product/thirdParty/jackson-annotations-2.7.3.jar"/>

              <resource-root path="/apps/SGDEV/config/SEC/product/thirdParty/jackson-core-2.7.3.jar"/>

              <resource-root path="/apps/SGDEV/config/SEC/product/thirdParty/jackson-coreutils-1.8.jar"/>

       

              And   APP_EAR/META-INF/MANIFEST.MF

                        Manifest-Version: 1.0

                        Dependencies: sharedLib

       

      We are not facing any issue while invoking sharedLib Module files from EAR. But files which is resides in sharedLib not able to access EJB jar of EAR.

       

      Example WAR -----> EJB--> sharedLib (Module) Fine

                     WAR -----> EJB1--> sharedLib ---> EJB2.jar Failed with NoClassDifferror.  (not able to access any class of EJB jar POJO classes.)

       

      can we invoke EAR EJB Jar from  sharedLib (Isolated Module)

       

      Error :

       

      Flow : Rest Service ----> EJB.jar ---> EJB.jar --->   sharedLib ---> EJB

       

      Caused by: java.lang.NoClassDefFoundError: scb/technical/bootstrap/process/SystemProperties                ----------------(POJO Class resides in EJB JAR) --------------

              at scb.technical.security.service.util.SecurityUtility.convertDateToUserTZ(SecurityUtility.java:257) ----------------------(POJO Class resides in sharedLib Module)----------------------

              at scb.technical.security.service.LoginServiceBean.validateLogin(LoginServiceBean.java:161) ------------------------(SessionBean  resides in EJB JAR)----------------------------

              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.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

              at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)

              at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:82)

              at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:93)

              at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

              at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

              at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)

              at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:64)

              at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:83)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

              at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

              at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

              at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

              at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:52)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

              at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

              at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:254)

              ... 212 more

      Caused by: java.lang.ClassNotFoundException: scb.technical.bootstrap.process.SystemProperties from [Module "sharedLib:main" from local module loader @66133adc (finder: local module finder @7bfcd12c (roots: /jboss/eap/7.0/jboss-eap/modules,/jboss/eap/7.0/jboss-eap/modules/system/layers/base/.overlays/layer-base-jboss-eap-7.0.6.CP,/jboss/eap/7.0/jboss-eap/modules/system/layers/base))]

       

      Server : JBOSS EAP 7.0

       

      Thanks

      Viswa..

        • 1. Re: Dependency from Module to EAR
          ctomc

          module system uses in a way a static graph, where modules in it can only depend on other modules in this static graph.

           

          Now deployments as such are dynamic and where they can depend on static modules (everything in modules/ folder), they cannot be accessed from static modules.

           

          For example your module would not resolve its own dependencies if it would depend on deployment and deployment was not present.

          • 2. Re: Dependency from Module to EAR
            jackspa

            Thanks Tomaz Cerar,

             

            But this logic working fine in WAS platform. Only we are facing this issue in JBOSS Environment. In WAS both PARENT and isolated shared library mananged by single class loader. Looks in JBOSS, there is no such class loader to load both Static and Dynamic classes under same class loader hierarchy..