10 Replies Latest reply on Nov 14, 2012 11:36 AM by dudeb

    Spring and JBoss AS7

    shep

      I have been working on migrating an application that utilizes spring 2.5.6 and runs on a Jetty server instance over to JBoss AS 7.  This so far has not been an easy task.  I started at AS 6 and have jumped to AS 7 with more success.  However I am hitting an issue loading my spring context files that has to do with depencies.

       

      Here is the error:

       

      Initializing Spring root WebApplicationContext

      16:29:33,246 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/accunurse]] (MSC service thread 1-7

      ) Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoade

      rListener: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resourceQueueService'

      : Injection of resource methods failed; nested exception is org.springframework.beans.factory.BeanCreationException: Err

      or creating bean with name 'queueProcessorChain' defined in ServletContext resource [/WEB-INF/spring/context-queue.xml]:

      Cannot resolve reference to bean 'queueSelfHarmService' while setting constructor argument with key [15]; nested except

      ion is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'queueSelfHarmService': In

      jection of resource methods failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error c

      reating bean with name 'pageSender': Injection of resource methods failed; nested exception is org.springframework.beans

      .factory.NoSuchBeanDefinitionException: No unique bean of type [com.vocollecthealthcare.yosemite.device.DeviceDatastore]

      is defined: Unsatisfied dependency of type [interface com.vocollecthealthcare.yosemite.device.DeviceDatastore]: expecte

      d at least 1 matching bean

              at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnno

      tationBeanPostProcessor.java:305) [spring-2.5.6.jar:]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCap

      ableBeanFactory.java:998) [spring-2.5.6.jar:]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCap

      ableBeanFactory.java:472) [spring-2.5.6.jar:]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBea

      nFactory.java:409) [spring-2.5.6.jar:]

              at java.security.AccessController.doPrivileged(Native Method) [:1.6.0_25]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapab

      leBeanFactory.java:380) [spring-2.5.6.jar:]

              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) [spri

      ng-2.5.6.jar:]

              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegis

      try.java:222) [spring-2.5.6.jar:]

              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) [spring

       

       

      I am not sure why I am getting this in JBoss.  The spring context files work fine on the Jetty server why doesn't it work in JBoss.  Do I need some additional JBoss specific mappings somewhere?   All documentation seems to point at older JBoss versions and I am not sure where to go from here.

       

      Also, to deploy in JBoss I am using an exploded war directory structure.  My war deploys but doesn't start.

       

      Any guidance on this would be great.

        • 1. Re: Spring and JBoss AS7
          jaikiran

          Where is the interface com.vocollecthealthcare.yosemite.device.DeviceDatastore and its implementing class located in the .war?

          • 2. Re: Spring and JBoss AS7
            shep

            In a jar file under the lib directory.

            • 3. Re: Spring and JBoss AS7
              jaikiran

              and the lib directory is in .war/WEB-INF?

              • 4. Re: Spring and JBoss AS7
                shep

                Correct.

                • 5. Re: Spring and JBoss AS7
                  shep

                  I fixed this by adding an additional xml file with bean mappings for each of the missing exceptions as such:

                   

                  <bean id="deviceDatastore" parent="abstractManager" autowire="byName">

                   

                   

                       <property name="proxyInterfaces" value="com.vocollecthealthcare.yosemite.device.DeviceDatastore"/>

                   

                   

                   

                   

                  </bean>

                   

                  • 6. Re: Spring and JBoss AS7
                    nilshan

                    Hello

                     

                    I am deploying EAR on JBOSS 7 AS. The Ear contains EJB Jars and WAR file. ( I am using Hibernate-3 and spring 3.1).

                     

                    I am facing below issue..

                     

                    21:15:50,528 INFO  [org.jboss.as.osgi] (MSC service thread 1-7) JBAS011907: Register module: Module .................

                    21:15:54,513 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-5) Error listenerStart

                    21:15:54,513 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-5) Context [/health] startup failed due to previous errors

                    21:15:54,544 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.web.deployment.default-host./health: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./health: JBAS018040: Failed to start context

                        at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:95)

                        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

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

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

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

                     

                    Can someone please point me the cause for the same ?

                     

                    Thanks

                    • 7. Re: Spring and JBoss AS7
                      ctomc

                      Hi,

                      what you have is totaly different issue. so please create a new thread.

                      I think you problem has to do something with configuraton.

                       

                      please create new thread and post as much information about your application and attach full boot log.

                       

                       

                      --

                      tomaz

                      • 8. Re: Spring and JBoss AS7
                        dudeb

                        Hi Nilsan,

                         

                        I have exactly the same problem with a "JBAS018040: Failed to start context"

                         

                        Did you find a solution?

                         

                        DudeB

                        • 9. Re: Spring and JBoss AS7
                          nilshan

                          hi,

                           

                          In the web.xml file I registered the spring context listerner which inturn was loading the spring configuration ( registering beans). while registering bean it was failing for the hibernate stuff. I had to provide the proper dependencies in jboss-deployment-structure.xml file.  This solved my problem.

                           

                          Hope this helps. ( Also, can you please debug in this direction which may help you to identify the cause. ) ( Possibly you might be on that same track )

                           

                          Please send me the error log.

                           

                          Thanks,

                          Nilshan.

                          • 10. Re: Spring and JBoss AS7
                            dudeb

                            Hi,

                             

                            I upgraded from Spring 2.5.6 to Spring 3.1.1.RELEASE and that fixed the issue for me.

                             

                            In doing so I made sure to update the DTD spec to Spring 3 in the spring-servlet.xml file.

                             

                            The dependencies on ironjacamar needed to be in jboss-deployment-structure.xml too.

                             

                            Thanks,

                            BK