1 Reply Latest reply on Apr 17, 2015 11:08 PM by SANJAY GAUTAM

    Module classloading problems with jboss-deployment-structure.xml in .ear file

    Arjun Yerla Newbie

      Hi,

       

      I am trying to deploy ear which contains single war which depends on resteasy, cxf, spring and IBatis I am trying to use resteasy and cxf dependencies provided by jboss eap module. For spring integration I create another module 'org.springframework.spring' to fix XML schema validation, as suggested in other forum threads. I was able to deploy it succesfully on JBoss EAP 6.0.1 but when I try to call any service I am getting ava.lang.ClassNotFoundException

       

       

      Any suggestions?

       

       

      The ear structure looks like:

      ------------------------------------------

      META-INF/application.xml

      META-INF/MANIFEST.MF

      META-INF/jboss-deployment-structure.xml

      demo-1.1.21-SNAPSHOT.war

       

       

      the war structure looks like:

      ------------------------------------------

      WEB-INF/web.xml

      WEB_INF/lib/ all third party jars and application jars

      WEB_INF/classes/logback.xml

      WEB_INF/classes/cxf-servlet.xml

       

      --------------------------------------------

       

      jboss-deployment-strcture.xml

      -----------------------------------------

       

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">

      <sub-deployment name="demo-1.1.21-SNAPSHOT.war">

        <exclusions>

        <module name="org.slf4j" />

        <module name="org.slf4j.impl" />

        </exclusions>

        <dependencies>

        <module name="org.apache.cxf" />

        <module name="org.apache.cxf.impl" />

        <module name="org.springframework.spring">

        <imports>

        <include path="META-INF**" />

        <include path="org**" />

        </imports>

        </module>

        </dependencies>

        <local-last value="true" />

        </sub-deployment>

      </jboss-deployment-structure>

       

       

      ExceptionStackTrace:

      ------------------------------------------------------

      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionLogDataService' defined in class path resource [DATA_ACCESS_LAYER-data-dao.xml]: Cannot resolve reference to bean 'transactionLogDAOFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionLogDAOFactory' defined in class path resource [DATA_ACCESS_LAYER-data-dao.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.demo.transaction.logging.dao.impl.oracle.TransactionLogDAOFactory]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/iba

      tis/common/xml/NodeletException

              at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:630) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:148) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) [spring-context-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) [spring-context-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) [spring-context-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93) [spring-context-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at com.demo.transaction.logging.DemoTransactionLogging.<init>(DemoTransactionLogging.java:64) [demo-service-transaction-logging-1.1.21-SNAPSHOT.jar:]

              at com.demo.transaction.logging.DemoTransactionLogging.<clinit>(DemoTransactionLogging.java:33) [demo-service-transaction-logging-1.1.21-SNAPSHOT.jar:]

              ... 45 more

      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionLogDAOFactory' defined in class path resource [DATA_ACCESS_LAYER-data-dao.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.demo.transaction.logging.dao.impl.oracle.TransactionLogDAOFactory]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/ibatis/common/xml/NodeletException

              at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:288) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              ... 63 more

      Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.demo.transaction.logging.dao.impl.oracle.TransactionLogDAOFactory]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/ibatis/common/xml/NodeletException

              at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:108) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:280) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              ... 72 more

      Caused by: java.lang.NoClassDefFoundError: com/ibatis/common/xml/NodeletException

              at com.demo.transaction.logging.dao.impl.oracle.TransactionLogDAOFactory.<init>(TransactionLogDAOFactory.java:34) [demo-service-transaction-logging-1.1.21-SNAPSHOT.jar:]

              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.6.0_45]

              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) [rt.jar:1.6.0_45]

              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [rt.jar:1.6.0_45]

              at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [rt.jar:1.6.0_45]

              at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]

              ... 74 more

      Caused by: java.lang.ClassNotFoundException: com.ibatis.common.xml.NodeletException from [Module "org.springframework.spring:main" from local module loader @b0a3f5 (roots: C:\tools\ais-jbosseap6\modules)]

              at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

              at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

              ... 80 more

       

       

       

       

      PS: when I exclude all JBoss provided dependencies and use jars from EAR/WAR/WEB-INF/lib every thing works fine. But when I try to use JBoss provided dependencies I am facing the issue.