11 Replies Latest reply on Sep 19, 2006 6:07 AM by jjr24

    Hot Deployment using jboss deployer

    brobertarch

      I wanted to use jboss/deployer to add spring functionality but hot deploy does not work.

      Why I wanted to use JBoss/Deployer?
      - Because it looked like an official deployer like Hibernate deployer in deploy folder when using JBoss 4.0.2
      - Because just by ending my spring config file name with -spring.xml and putting

      <description>BeanFactory=(mySpringBean-pojo)</description>
      tag and packaging it in my jar file all of it using maven2 was wonderful.

      Unfortunately it does not work when re-HOT-deploying my ears.

      I use 3 approaches:
      - 1) from Rod Harrop ProSpring book hoping it would be portable from JBoss to Geronimo. By using
      org.springframework.ejb.support.AbstractJmsMessageDrivenBean;
      it didn't work. see problem cause below
      - 2) from JBoss/Deployer same thing. I do know that jboss deployer is intended to be used with EJB3 but it still works by calling
      org.jboss.spring.factory.NamedXmlBeanFactory bfl = (org.jboss.spring.factory.NamedXmlBeanFactory)initialContext.lookup("my-spring-pojo");
       dispatchManager = (DispatchManager) bfl.getBean("myDispatchManager");
      

      - 3) Than I gave up and used a simple MBean that loads the spring mbeans as JNDI objects. From an MBean sample we had to modify to use Durable WS MQ Topics.
      http://wiki.jboss.org/wiki/Wiki.jsp?page=UsingWebSphereMQSeriesWithJBossASPartI
      and Hot deploy works. I won't know the impact on the memory yet but I'll try to find out by using MBean console monitors.

      Problem Caused by WeakReferenceMonitor.ReleaseListener?
      What I noticed is that the beans are released just before ehcache when using Hibernate from Spring.

      11:31:58,365 WARN [Configurator] No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: null
      11:31:58,365 ERROR [LogInterceptor] TransactionRolledbackLocalException in method: public abstract void javax.jms.Messag
      11:32:00,474 INFO [NamedXmlBeanFactory] Destroying singletons in factory {org.jboss.spring.factory.NamedXmlBeanFactory


      By using an in house MBean [than can be ported to a Geronimo GBean ], I resolved my problem but wanted to know if someone has faced the same problem.


        • 1. Re: Hot Deployment using jboss deployer
          alesj

          >> Unfortunately it does not work when re-HOT-deploying my ears.

          What exactly doesn't work?

          I currently use it with my portal app , where we re-deploy stuff all the time.

          I can send you a new release, which also supports application context, not just bean factory.

          Rgds, Ales

          • 2. Re: Hot Deployment using jboss deployer
            brobertarch

            AlesJ,

            Thanks for your quick answer.

            I forgot to mention that the 3rd simple solution does not destroy singletons.
            That?s why it always works.

            By destroying singletons, I have an exception that is hard to track since it is hidden by all the JCA MDB interceptors. It applys to the 3 implementations.

            Can I have the latest deployer?
            I am definitely interested with having the latest spring Deployer version since I am focusing on it right now.

            Thanks,
            Brice

            Exception:

            11:47:47,889 ERROR [JMSContainerInvoker] Exception in JMSCI message listener
            javax.ejb.TransactionRolledbackLocalException: Could not instantiate bean; CausedByException is:
            Could not instantiate bean
            at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:232)
            at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
            at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
            at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:94)
            at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)




            • 3. Re: Hot Deployment using jboss deployer
              alesj

              What exactly are you trying to do with JMS?

              I'm using the following stuff with JBossAS and it works really great for me.

              @Consumer(activateConfig =
               {
               @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
               @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/mdpojo")
               })
              @Interceptors(value = SpringPassivationInterceptor.class)
              public class AsynchManagerImpl implements AsynchManager, Serializable {
              
               @Spring(jndiName = "en-pojo", bean = "searcherCreator")
               private transient SearcherCreator searcherCreator;
              
               @Spring(jndiName = "en-pojo", bean = "fileIndexSource")
               private transient FileIndexer fileIndexer;
              
               private transient Log logger;
              
               protected Log getLog() {
               if (logger == null) {
               logger = LogFactory.getLog(getClass());
               }
               return logger;
               }
              
               public void initializeSearch() {
               synchronized (searcherCreator) {
               if (!searcherCreator.isInitialized()) {
               IndexSource[] indexSources = searcherCreator.getIndexSources();
               Set<File> indexPaths = new TreeSet<File>();
               for(IndexSource is : indexSources) {
               try {
               is.addDocuments(indexPaths);
               } catch(Exception e) {
               getLog().error("Failed to build index source: " + is.getClass().getName());
               }
               }
               searcherCreator.setInitialized(true);
               }
               }
               }
              }
              


              If you give me your email, I can send you my current spring.deployer archive.

              Rgds, Ales


              • 4. Re: Hot Deployment using jboss deployer
                brobertarch
                • 5. Re: Hot Deployment using jboss deployer
                  alesj

                  Sent.

                  >> What exactly are you trying to do with JMS?

                  Debug why this is thrown: Could not instantiate bean

                  • 6. Re: Hot Deployment using jboss deployer
                    brobertarch

                    Ales,

                    Thanks for the jar but it didn't work the MBean couldn't be loaded.

                    I use JBoss 4.0.2, Spring 1.2.5, Hibernate 3.1, MQ Series is used for JMS can't use betas at a customer site.

                    Therefore I don't use EJB3 and try to minimize bugs of new features or non mature products. Since it happens to all 3 solutions I still have to investigate.
                    It might be a Spring issue.

                    Thanks for your help and time

                    • 7. Re: Hot Deployment using jboss deployer
                      brobertarch

                      Ales,

                      For some reasons, your email went to my bulk folder (you might have BCCed somebody). I didn't see your email related to jboss.xml.

                      the MBean is now loaded and I can get some interesting trace see below.
                      I need some time to investigate now.

                      Thanks again.

                      13:57:27,975 WARN [Configurator] No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the cla
                      sspath: null
                      13:57:27,975 INFO [DefaultListableBeanFactory] Destroying singletons in factory {org.springframework.beans.factory.supp
                      ort.DefaultListableBeanFactory defining beans [dispatchDataSource,devTCF,starskyTCF,integTCF,beepTopic,beepJmsTemplate,h
                      ibernateSessionFactory,hibernatePremiumTransactionCustomPersistenceDao,hibernateCustomRulesDao,pojoPremiumTransactionBP,
                      archDispatchManager]; root of BeanFactory hierarchy}
                      13:57:27,975 ERROR [MainDeployer] could not create deployment: file:/C:/opt/bin/jboss/jboss-4.0.2/server/beep/tmp/deploy
                      /tmp59358beep-0.1.ear-contents/beep-mdb-0.1.jar-contents/beep-spring.xml
                      org.jboss.deployment.DeploymentException: Error creating bean with name 'hibernateSessionFactory' defined in URL [file:/
                      C:/opt/bin/jboss/jboss-4.0.2/server/beep/tmp/deploy/tmp59358beep-0.1.ear-contents/beep-mdb-0.1.jar-contents/beep-spring.
                      xml]: Initialization of bean failed; nested exception is org.hibernate.cache.CacheException: net.sf.ehcache.CacheExcepti
                      on: Cannot configure CacheManager: null; - nested throwable: (org.springframework.beans.factory.BeanCreationException: E
                      rror creating bean with name 'hibernateSessionFactory' defined in URL [file:/C:/opt/bin/jboss/jboss-4.0.2/server/beep/tm
                      p/deploy/tmp59358beep-0.1.ear-contents/beep-mdb-0.1.jar-contents/beep-spring.xml]: Initialization of bean failed; nested
                       exception is org.hibernate.cache.CacheException: net.sf.ehcache.CacheException: Cannot configure CacheManager: null)
                       at org.jboss.spring.deployment.SpringDeployer.create(SpringDeployer.java:123)
                       at org.jboss.deployment.MainDeployer.create(MainDeployer.java:918)
                       at org.jboss.deployment.MainDeployer.create(MainDeployer.java:910)
                       at org.jboss.deployment.MainDeployer.create(MainDeployer.java:910)
                       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:774)
                       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
                       at sun.reflect.GeneratedMethodAccessor42.invoke(Unknown Source)
                       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                      


                      • 8. Re: Hot Deployment using jboss deployer
                        brobertarch

                        To end this thread, all 3 solutions work:
                        It was a Class Loading issue.

                        I have kind of knew this but keep forgetting that, not like WebSphere, there is no Parent/Child configuration for Class Loading.

                        Using Maven2 and putting a Hivernate 3.1 jar in my EAR is not enough, since JBoss 4.0.2 comes with hibernate.deployer folder which has an older Hibernate version by default.

                        ClassLoader Hierarchy is:
                        1) /server//lib folder
                        2) /server//deploy Deployer folders
                        3) EARs

                        Parent class loader is considered first and there does not seem to have parent/child class loading delegation.

                        Thanks for your help
                        Ales: I used the older version of Spring Deployer the new version you sent didn't seem to work. Sorry no time to investigate

                        • 9. Re: Hot Deployment using jboss deployer
                          bill.burke

                          There is Parent/Child configuration for Class Loading.

                          Search for loader-repository in our documentation.

                          Scoped classloading with choice of Parent or Child first class lookup.

                          • 10. Re: Hot Deployment using jboss deployer
                            brobertarch

                            Bill,

                            Thanks for your quick answer it was a hot week delivering sleeplessly and I now can go back to hot redeployment issues.

                            Found this and will definetely let you know the outcome.
                            http://www.jboss.org/wiki/Wiki.jsp?page=ClassLoadingConfiguration
                            http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossClassLoadingUseCases


                            Brice

                            • 11. Re: Hot Deployment using jboss deployer
                              jjr24

                              Hi brobertarch,
                              Did you resolve your last problem (ie Cannot configure CacheManager : null)
                              I have the same problem in a ear.
                              Thanks
                              JJR24