3 Replies Latest reply on May 18, 2006 10:29 AM by alesj

    Unable to hot-deploy EJB/Spring/Hibernate application in JBo

    msmolyak

      Hello,

      I have an application which uses Hibernate in the data access tier fronted with Spring DAOs. On top of this standard architecture I added a thin EJB layer: Stateless Session EJBs wrapping the Spring business objects. The application deploys and runs fine. I am able to run a client Java program calling a method on a session bean which works correctly.

      When I try to redeploy this application without restarting JBoss, and run my client again I get the error below. Restarting the server fixes the problem.

      Any help in resolving the hot deployment issue is greatly appreciated.

      Michael Smolyak

      17:19:27,684 INFO [STDOUT] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'CruiseSessionFactory' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is org.hibernate.cache.CacheException: net.sf.ehcache.CacheException: Cannot configure CacheManager: null
      17:19:27,731 INFO [STDOUT] org.hibernate.cache.CacheException: net.sf.ehcache.CacheException: Cannot configure CacheMan
      ager: null
      at org.hibernate.cache.EhCacheProvider.start(EhCacheProvider.java:127)
      at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:167)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1055)
      at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:767)
      at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:693)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1003)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:348)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:176)
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:105)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:957)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:768)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:330)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:275)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:317)
      at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:80)
      at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:65)
      at org.springframework.context.access.ContextJndiBeanFactoryLocator.createBeanFactory(ContextJndiBeanFactoryLocator.java:86)
      at org.springframework.context.access.ContextJndiBeanFactoryLocator.useBeanFactory(ContextJndiBeanFactoryLocator.java:70)
      at org.springframework.ejb.support.AbstractEnterpriseBean.loadBeanFactory(AbstractEnterpriseBean.java:117)
      at org.springframework.ejb.support.AbstractStatelessSessionBean.ejbCreate(AbstractStatelessSessionBean.java:63)
      at com.jetson.test.biz.CustomerManagerBean.ejbCreate(CustomerManagerBean.java:58)
      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:324)
      at org.jboss.ejb.StatelessSessionEnterpriseContext.(StatelessSessionEnterpriseContext.java:63)
      at org.jboss.ejb.plugins.StatelessSessionInstancePool.create(StatelessSessionInstancePool.java:35) at org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.java:161) at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invokeHome(StatelessSessionInstanceInterceptor.java:78)

        • 1. Re: Unable to hot-deploy EJB/Spring/Hibernate application in
          alesj

          This is not Spring/Hibernate used in JBossAS forum.

          Read what this forum is about:
          http://java.sys-con.com/read/180386.htm

          Rgds, Ales

          • 2. Re: Unable to hot-deploy EJB/Spring/Hibernate application in
            msmolyak

            Thank you for clarification, Ales.

            I like the approach of building a special Spring deployer; we may adopt it. Still, my application resolves the same issue as the one discussed in your article, integration of EJB and Spring. It takes a more traditional approach for that task though by reading applicationContext.xml from a class path for each Session bean. The advantage of your approach, I suppose, is that the loading of teh application context will happen only once.

            I beleive that reading applicationContext.xml and placing it in the JNDI tree is not dependent on EJB 3.0 and can be done with EJB 2.1, correct?

            Michael

            • 3. Re: Unable to hot-deploy EJB/Spring/Hibernate application in
              alesj

               


              I beleive that reading applicationContext.xml and placing it in the JNDI tree is not dependent on EJB 3.0 and can be done with EJB 2.1, correct?


              Yep.
              You can easily use just the basic (non EJB3) JBoss/Spring integration stuff - reading your Spring XML file and placing its bean factory under JNDI name.

              Then in your session bean you can pull out (from JNDI) this stuff and use it as you like.