4 Replies Latest reply on Oct 3, 2012 10:33 PM by Nico Nico

    Jboss 7 modules and lib inside war conflict

    Nico Nico Newbie

      I'm migrating my application to Jboss 7.1 and I'm having same problem using jboss modules for a war file that use spring 3.1 and hibernate 4.

       

      If I include all of the hibernate/spring files inside the lib directory, the application works. But if I tried to configure jboss-deployment-structure.xml to use the org.hibernate module and not include hibernate jars inside lib folder, this error appear.

       

       

      17:38:47,154 ERROR [org.hibernate.internal.SessionFactoryImpl] (MSC service thread 1-1) HHH000302: Unable to construct current session context [org.springframework.orm.hibernate4.SpringSessionContext]: org.hibernate.service.classloading.spi.ClassLoadingException: Unable to load class [org.springframework.orm.hibernate4.SpringSessionContext]

          at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:141) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]

          at org.hibernate.internal.SessionFactoryImpl.buildCurrentSessionContext(SessionFactoryImpl.java:1491) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]

          at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:502) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]

          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1746) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]

          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1784) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]

          at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:242) [spring-orm-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:372) [spring-orm-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:357) [spring-orm-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]

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

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

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

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

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

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

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

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

          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1360) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]

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

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

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

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

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

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

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

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

          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1360) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]

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

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

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

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

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

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

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

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

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

          at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383) [spring-web-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283) [spring-web-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) [spring-web-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.appfuse.webapp.listener.StartupListener.contextInitialized(StartupListener.java:51) [classes:]

          at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3394) [jbossweb-7.0.17.Final.jar:]

          at org.apache.catalina.core.StandardContext.start(StandardContext.java:3856) [jbossweb-7.0.17.Final.jar:]

          at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:89) [jboss-as-web-7.1.3.Final.jar:7.1.3.Final]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_18]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_18]

          at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_18]

      Caused by: java.lang.ClassNotFoundException: Could not load requested class : org.springframework.orm.hibernate4.SpringSessionContext

          at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl$1.findClass(ClassLoaderServiceImpl.java:99) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]

          at java.lang.ClassLoader.loadClass(ClassLoader.java:307) [rt.jar:1.6.0_18]

          at java.lang.ClassLoader.loadClass(ClassLoader.java:248) [rt.jar:1.6.0_18]

          at java.lang.Class.forName0(Native Method) [rt.jar:1.6.0_18]

          at java.lang.Class.forName(Class.java:247) [rt.jar:1.6.0_18]

          at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:138) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]

          ... 50 more

       

       

       

       

      It seems that the hibernate module jars does not see the spring jars located inside the war lib folder. Is there any correct way to configure this to work, or do I need to include all of the jars file inside lib folder?

       

      Thanks in advance!