7 Replies Latest reply on Mar 28, 2013 10:02 AM by jrantav

    JBoss 5.1.0 and Multiple EARs and EJBs using the SpringBeanAutowiringInterceptor issue

    Kyle Bober Newbie

      I have two EARs that contain unique WAR and EJB JAR files.

      Each EAR contains a beanRefContext.xml file that I have wired up to multiple applicationContext files to use Autowiring in my EJB implementation classes.

      My EARs are configured to be isolated in the JBoss EAR deployer.

      Each of my EJBs is configured to use the @Interceptors(SpringBeanAutowiringInterceptor.class)

       

      EAR 1

      --- WAR1

      --- EJB1 JAR

      EAR 2

      --- WAR2

      --- EJB2 JAR

       

      My issues is when I deploy both of these EARs in the same JBoss instance and attempt to have EJB1 call EJB2 via a remote EJB call I receive the following exception:

       

      {code}Caused by: java.lang.RuntimeException: org.springframework.beans.factory.access.BootstrapException: Unable to return specified BeanFactory instance: factory key [null], from group with resource name [classpath*:beanRefContext.xml]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.springframework.beans.factory.BeanFactory] is defined: expected single bean but found 2{code}

       

      This exception is thrown from EJB1 when it attemps to make a remote ejb call to EJB2. To verify that this is an issue with Spring Integration I removed the @Interceptors(SpringBeanAutowiringInterceptor.class) from EJB2 and returned some dummy data and it worked fine. It seems this issue revolves around the SpringBeanAutowiringInterceptor.class.

       

      Any help here resolving this issue would be much appreciated!

       

      Here are the beanRefContext.xml files which are include in the root of the EAR files.

       

      EAR1

      <?xml version="1.0" encoding="UTF-8"?>
      <beans
          xmlns="http://www.springframework.org/schema/beans"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:jee="http://www.springframework.org/schema/jee"
          xmlns:aop="http://www.springframework.org/schema/aop"
          xmlns:tx="http://www.springframework.org/schema/tx"   
          xsi:schemaLocation="
           http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
           http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">

       

          <bean id="ear1-context" class="org.springframework.context.support.ClassPathXmlApplicationContext">
              <constructor-arg>
                  <list>
                      <value>ejb1-applicationContext.xml</value>               
                      <value>dao1-applicationContext.xml</value>
                  </list>
              </constructor-arg>        
          </bean>
      </beans>

       

      EAR2

      <?xml version="1.0" encoding="UTF-8"?>
      <beans
           xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:jee="http://www.springframework.org/schema/jee"
           xmlns:aop="http://www.springframework.org/schema/aop"
           xmlns:tx="http://www.springframework.org/schema/tx"   
           xsi:schemaLocation="
            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
            http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
            http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">

       

          <bean id="ear2-context">
               <constructor-arg>
                   <list>
                       <value>ejb2-applicationContext.xml</value>               
                       <value>dao2-applicationContext.xml</value>
                   </list>
               </constructor-arg>        
           </bean>
      </beans>

       

      -Kyle

        • 1. Re: JBoss 5.1.0 and Multiple EARs and EJBs using the SpringBeanAutowiringInterceptor issue
          Marius Bogoevici Expert

          Looks odd. Are you sure that the deployments include the beanRefContext.xml file only once (also considering JARs)? What really happens there is that the application context for EJB2 is constructed with both XMLs so I am wondering if both of them are included in the EAR.

           

          Can you try to deploy only EJB2 and invoke it remotely (without EAR1 being present) and see what happens? If you're still seeing issues then EAR2 might be at fault.

           

          Also, how do you deploy Spring - shared lib or included with each EAR?

          • 2. Re: JBoss 5.1.0 and Multiple EARs and EJBs using the SpringBeanAutowiringInterceptor issue
            Kyle Bober Newbie

            Thanks for you prompt reply Marius!

            Each EAR contains a unique beanRefContext.xml file. Each beanRefContext.xml file contains a unique list of applicationContext.xml files that are associated with the EJB JARs. So each EAR that is being deployed to JBoss does contain only one instance of the beanRefContext.xml file.

             

            Each EAR file contains a single shared spring.jar located in a common lib directory shared by all WARs and JARs.

             

            We have JBoss EAR deployer configured to not isolate the EAR classloader as well. In case this helps.

             

            We are also using the Apache CXF WebService stack for JBoss version 3.2.0.GA.
            Since both of our EJBs are also configured as WebServices using applicable JAX-WS annotations. I use the following in my web.xml to configure the Spring Context Load Listener:

             

            WAR1 web.xml

             

                <!-- Adding the Spring Context Listener. Initialize Spring Context -->
                <listener>
                    <listener-class> org.springframework.web.context.ContextLoaderListener</listener-class>
                </listener>
                <!-- Context file location of Spring -->
                <context-param>
                    <param-name>contextConfigLocation</param-name>       
                    <param-value>classpath:dao1-applicationContext.xml,classpath:ejb1-applicationContext.xml</param-value>
                </context-param>

             

            WAR2 web.xml

             

                <!-- Adding the Spring Context Listener. Initialize Spring Context -->
                <listener>
                    <listener-class> org.springframework.web.context.ContextLoaderListener</listener-class>
                </listener>
                <!-- Context file location of Spring -->
                <context-param>
                    <param-name>contextConfigLocation</param-name>       
                    <param-value>classpath:dao2-applicationContext.xml,classpath:ejb2-applicationContext.xml</param-value>
                </context-param>

             


            I cleared the following folders from my JBoss 5.1.0 instance:

             

            server/default/tmp
            server/default/work

             

            Next I deployed EAR2 and ran remote calls to EJB2 via a remote ejb test client call and it worked. I also ran a SOAP request against the same method and that worked successfully as well.

             

            Next I deployed EAR1 and ran a remote call on EJB1 via a remote ejb test client call and it failed with the following exception:
            org.springframework.beans.factory.BeanCreationException: Autowiring of fields/methods failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.thesearchagency.service.msdc.adapter.IChannelServiceAdapter com.thesearchagency.service.msdc.impl.MSDConfigurationService.theChannelServiceAdapter; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.thesearchagency.service.msdc.adapter.IChannelServiceAdapter] is defined: Unsatisfied dependency of type [interface com.thesearchagency.service.msdc.adapter.IChannelServiceAdapter]: expected at least 1 matching bean

             

            I also ran a SOAP request against the same method and that worked successfully. Which is odd!

             

            The really fun thing now is if I undeploy all the EARs and then just redeploy EAR2 with EJB2 and attempt to call the EJB Remotely again via the remote ejb client call I receive the following exception:

             

            java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Autowiring of fields/methods failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.thesearchagency.dao.channel.manager.ChannelPersistentManager com.thesearchagency.service.channel.impl.ChannelService.theChannelPersistentManager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.thesearchagency.dao.channel.manager.ChannelPersistentManager] is defined: Unsatisfied dependency of type [class com.thesearchagency.dao.channel.manager.ChannelPersistentManager]: expected at least 1 matching bean
                at org.jboss.ejb3.EJBContainer.invokeCallback(EJBContainer.java:1123)
                at org.jboss.ejb3.EJBContainer.invokePostConstruct(EJBContainer.java:1133)
                at org.jboss.ejb3.EJBContainer.invokePostConstruct(EJBContainer.java:1144)
                at org.jboss.ejb3.pool.AbstractPool.create(AbstractPool.java:93)
                at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:56)
                at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:51)
                at org.jboss.ejb3.pool.ThreadlocalPool.create(ThreadlocalPool.java:53)
                at org.jboss.ejb3.pool.ThreadlocalPool.get(ThreadlocalPool.java:93)
                at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:58)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:421)
                at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53)
                at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
                at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
                at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891)
                at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:744)
                at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:697)
                at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:524)
                at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:232)
            Caused by: org.springframework.beans.factory.BeanCreationException: Autowiring of fields/methods failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.thesearchagency.dao.channel.manager.ChannelPersistentManager com.thesearchagency.service.channel.impl.ChannelService.theChannelPersistentManager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.thesearchagency.dao.channel.manager.ChannelPersistentManager] is defined: Unsatisfied dependency of type [class com.thesearchagency.dao.channel.manager.ChannelPersistentManager]: expected at least 1 matching bean
                at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.processInjection(AutowiredAnnotationBeanPostProcessor.java:274)
                at org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor.autowireBean(SpringBeanAutowiringInterceptor.java:101)
                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:597)
                at org.jboss.ejb3.interceptors.aop.LifecycleCallbackInterceptorMethodInterceptor.invoke(LifecycleCallbackInterceptorMethodInterceptor.java:80)
                at org.jboss.aop.joinpoint.ConstructionInvocation.invokeNext(ConstructionInvocation.java:79)
                at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:88)
                at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_31757291.invoke(InvocationContextInterceptor_z_setup_31757291.java)
                at org.jboss.aop.joinpoint.ConstructionInvocation.invokeNext(ConstructionInvocation.java:79)
                at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
                at org.jboss.aop.joinpoint.ConstructionInvocation.invokeNext(ConstructionInvocation.java:79)
                at org.jboss.ejb3.EJBContainer.invokeCallback(EJBContainer.java:1119)
                at org.jboss.ejb3.EJBContainer.invokePostConstruct(EJBContainer.java:1133)
                at org.jboss.ejb3.EJBContainer.invokePostConstruct(EJBContainer.java:1144)
                at org.jboss.ejb3.pool.AbstractPool.create(AbstractPool.java:93)
                at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:56)
                at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:51)
                at org.jboss.ejb3.pool.ThreadlocalPool.create(ThreadlocalPool.java:53)
                at org.jboss.ejb3.pool.ThreadlocalPool.get(ThreadlocalPool.java:93)
                at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:58)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:421)
                at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53)
                at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
                at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
                at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891)
                at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:744)
                at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:697)
                at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:524)
                at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:232)
                at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:211)
                at org.jboss.remoting.Client.invoke(Client.java:1724)
                at org.jboss.remoting.Client.invoke(Client.java:629)
                at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:60)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
                at $Proxy7.invoke(Unknown Source)
                at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)
                at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
                at $Proxy6.findAll(Unknown Source)
                at com.thesearchagency.service.channel.ChannelServiceTest.testFindAll(ChannelServiceTest.java:34)
                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:585)
                at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
                at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
                at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
                at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
                at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
                at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
                at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
                at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
                at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
                at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
                at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
                at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
                at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
                at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
                at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:72)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
                at $Proxy7.invoke(Unknown Source)
                at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)
                at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
                at $Proxy6.findAll(Unknown Source)
                at com.thesearchagency.service.channel.ChannelServiceTest.testFindAll(ChannelServiceTest.java:34)
                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:585)
                at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
                at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
                at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
                at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
                at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
                at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
                at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
                at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
                at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
                at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
                at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
                at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
                at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
                at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
            Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.thesearchagency.dao.channel.manager.ChannelPersistentManager com.thesearchagency.service.channel.impl.ChannelService.theChannelPersistentManager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.thesearchagency.dao.channel.manager.ChannelPersistentManager] is defined: Unsatisfied dependency of type [class com.thesearchagency.dao.channel.manager.ChannelPersistentManager]: expected at least 1 matching bean
                at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:435)
                at org.springframework.beans.factory.annotation.InjectionMetadata.injectFields(InjectionMetadata.java:105)
                at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.processInjection(AutowiredAnnotationBeanPostProcessor.java:270)
                at org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor.autowireBean(SpringBeanAutowiringInterceptor.java:101)
                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:597)
                at org.jboss.ejb3.interceptors.aop.LifecycleCallbackInterceptorMethodInterceptor.invoke(LifecycleCallbackInterceptorMethodInterceptor.java:80)
                at org.jboss.aop.joinpoint.ConstructionInvocation.invokeNext(ConstructionInvocation.java:79)
                at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:88)
                at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_31757291.invoke(InvocationContextInterceptor_z_setup_31757291.java)
                at org.jboss.aop.joinpoint.ConstructionInvocation.invokeNext(ConstructionInvocation.java:79)
                at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
                at org.jboss.aop.joinpoint.ConstructionInvocation.invokeNext(ConstructionInvocation.java:79)
                at org.jboss.ejb3.EJBContainer.invokeCallback(EJBContainer.java:1119)
                at org.jboss.ejb3.EJBContainer.invokePostConstruct(EJBContainer.java:1133)
                at org.jboss.ejb3.EJBContainer.invokePostConstruct(EJBContainer.java:1144)
                at org.jboss.ejb3.pool.AbstractPool.create(AbstractPool.java:93)
                at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:56)
                at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:51)
                at org.jboss.ejb3.pool.ThreadlocalPool.create(ThreadlocalPool.java:53)
                at org.jboss.ejb3.pool.ThreadlocalPool.get(ThreadlocalPool.java:93)
                at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:58)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:421)
                at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53)
                at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
                at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
                at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891)
                at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:744)
                at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:697)
                at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:524)
                at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:232)
            Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.thesearchagency.dao.channel.manager.ChannelPersistentManager] is defined: Unsatisfied dependency of type [class com.thesearchagency.dao.channel.manager.ChannelPersistentManager]: expected at least 1 matching bean
                at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:613)
                at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:412)
                ... 47 more

             

            It seems that something is severaly getting messed up when deploying and undeploying multiple EARs containing individual beanRefContext.xml files unique to each EAR configuration.

             

            Thanks again for your help! I would really like to get to the bottom of this issue!

            Kyle S. Bober

            • 3. Re: JBoss 5.1.0 and Multiple EARs and EJBs using the SpringBeanAutowiringInterceptor issue
              Kyle Bober Newbie

              Does anyone have any thorughts and/or ideas regarding this issue? In the meantime I am going to attempt to put together an example of two individual EARs and upload them so anyone who interested can reproduce this issue.

               

              Regards,

              Kyle S. Bober

              • 4. Re: JBoss 5.1.0 and Multiple EARs and EJBs using the SpringBeanAutowiringInterceptor issue
                Marius Bogoevici Expert

                Looking quickly at your examples: it seems like the main reason why this is happenning is the lack of isolation between the EARs, so that both beanRefContext.xml files are seen on the CP when ContextSingletonBeanFactoryLocator is trying to load resources as "classpath*:beanRefContext.xml" (hence the complaint that the context is not unique).

                1 of 1 people found this helpful
                • 5. Re: JBoss 5.1.0 and Multiple EARs and EJBs using the SpringBeanAutowiringInterceptor issue
                  Kyle Bober Newbie

                  I agree Marius. I think it has to do with the isolation at the EAR level. I have set the EAR classloader isolation to true as such in the ear-deployer-jboss-beans.xml file:

                   

                  <bean name="EARClassLoaderDeployer">
                        <!-- A flag indicating if ear deployments should have their own scoped
                           class loader to isolate their classes from other deployments.
                        -->     
                        <property name="isolated">true</property>
                     </bean>

                   

                  This now causes another issue to rear its ugly head. When I attempt to deploy my EAR now I receive the following exception:

                   

                  11:25:11,500 INFO  [[/ChannelService]] Initializing Spring root WebApplicationContext
                  11:25:11,500 INFO  [ContextLoader] Root WebApplicationContext: initialization started
                  11:25:11,562 INFO  [ClassPathXmlApplicationContext] Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@1501c9a: display name [org.springframework.context.support.ClassPathXmlApplicationContext@1501c9a]; startup date [Tue Jun 01 11:25:11 EDT 2010]; root of context hierarchy
                  11:25:11,656 INFO  [XmlBeanDefinitionReader] Loading XML bean definitions from URL [vfszip:/C:/ApplicationServers/jboss-5.1.0.GA/server/default/deploy/channel-service-0.0.1--SNAPSHOT.ear/beanRefContext.xml]
                  11:25:11,718 INFO  [ClassPathXmlApplicationContext] Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@1501c9a]: org.springframework.beans.factory.support.DefaultListableBeanFactory@afacf1
                  11:25:11,734 INFO  [DefaultListableBeanFactory] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@afacf1: defining beans [ear.context]; root of factory hierarchy
                  11:25:11,812 INFO  [VFSClassPathXmlApplicationContext] Refreshing org.jboss.spring.vfs.context.VFSClassPathXmlApplicationContext@3e68f4: display name [org.jboss.spring.vfs.context.VFSClassPathXmlApplicationContext@3e68f4]; startup date [Tue Jun 01 11:25:11 EDT 2010]; root of context hierarchy
                  11:25:11,812 INFO  [XmlBeanDefinitionReader] Loading XML bean definitions from ZipEntryHandler@23845366[path=channel-service-0.0.1--SNAPSHOT.ear/lib/channel-service-dao-0.0.1-SNAPSHOT.jar/channel-dao-applicationContext.xml context=file:/C:/ApplicationServers/jboss-5.1.0.GA/server/default/deploy/ real=file:/C:/ApplicationServers/jboss-5.1.0.GA/server/default/deploy/channel-service-0.0.1--SNAPSHOT.ear/lib/channel-service-dao-0.0.1-SNAPSHOT.jar/channel-dao-applicationContext.xml]
                  11:25:11,859 INFO  [VFSClassPathXmlApplicationContext] Bean factory for application context [org.jboss.spring.vfs.context.VFSClassPathXmlApplicationContext@3e68f4]: org.springframework.beans.factory.support.DefaultListableBeanFactory@1cd8006
                  11:25:11,906 INFO  [DefaultListableBeanFactory] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1cd8006: defining beans [dataSource,transactionManager,DatabaseInstanceDAO,BusinessUnitDAO,ChannelDAO,DistributionDAO,ReportColumnDAO,ProductDAO,DatabaseInstancePersistentManager,ChannelPersistentManager,DistributionPersistentManager,ReportColumnPersistentManager,ProductPersistentManager]; root of factory hierarchy
                  11:25:12,171 INFO  [XmlWebApplicationContext] Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1866052: display name [Root WebApplicationContext]; startup date [Tue Jun 01 11:25:12 EDT 2010]; parent: ear.context
                  11:25:12,171 INFO  [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [channel-dao-applicationContext.xml]
                  11:25:12,203 INFO  [XmlWebApplicationContext] Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@1866052]: org.springframework.beans.factory.support.DefaultListableBeanFactory@63b075
                  11:25:12,218 INFO  [DefaultListableBeanFactory] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@63b075: defining beans [dataSource,transactionManager,DatabaseInstanceDAO,BusinessUnitDAO,ChannelDAO,DistributionDAO,ReportColumnDAO,ProductDAO,DatabaseInstancePersistentManager,ChannelPersistentManager,DistributionPersistentManager,ReportColumnPersistentManager,ProductPersistentManager]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@1cd8006
                  11:25:12,218 INFO  [ContextLoader] Root WebApplicationContext: initialization completed in 718 ms
                  11:25:12,328 ERROR [[/ChannelService]] StandardWrapper.Throwable
                  java.lang.ClassCastException: org.springframework.web.context.support.XmlWebApplicationContext cannot be cast to java.lang.Exception
                      at org.apache.cxf.transport.servlet.CXFServlet.loadSpringBus(CXFServlet.java:96)
                      at org.apache.cxf.transport.servlet.CXFServlet.loadBus(CXFServlet.java:70)
                      at org.jboss.wsf.stack.cxf.CXFServletExt.loadBus(CXFServletExt.java:100)
                      at org.apache.cxf.transport.servlet.AbstractCXFServlet.init(AbstractCXFServlet.java:90)
                      at org.jboss.wsf.stack.cxf.CXFServletExt.init(CXFServletExt.java:77)
                      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1048)
                      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:950)
                      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4122)
                      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4421)
                      at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:310)
                      at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)
                      at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
                      at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
                      at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
                      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:597)
                      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
                      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
                      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
                      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
                      at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
                      at $Proxy38.start(Unknown Source)
                      at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
                      at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
                      at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
                      at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
                      at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
                      at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                      at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)
                      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
                      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
                      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
                      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
                      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
                      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
                      at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
                      at org.jboss.system.ServiceController.start(ServiceController.java:460)
                      at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
                      at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
                      at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
                      at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
                      at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
                      at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
                      at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
                      at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
                      at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
                      at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)
                      at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
                      at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
                      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
                      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
                      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
                      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
                      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
                      at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
                      at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
                      at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
                      at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:362)
                      at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:255)
                      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
                      at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
                      at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
                      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
                      at java.lang.Thread.run(Thread.java:619)
                  11:25:12,328 ERROR [[/ChannelService]] Servlet /ChannelService threw load() exception
                  java.lang.ClassCastException: org.springframework.web.context.support.XmlWebApplicationContext cannot be cast to java.lang.Exception
                      at org.apache.cxf.transport.servlet.CXFServlet.loadSpringBus(CXFServlet.java:96)
                      at org.apache.cxf.transport.servlet.CXFServlet.loadBus(CXFServlet.java:70)
                      at org.jboss.wsf.stack.cxf.CXFServletExt.loadBus(CXFServletExt.java:100)
                      at org.apache.cxf.transport.servlet.AbstractCXFServlet.init(AbstractCXFServlet.java:90)
                      at org.jboss.wsf.stack.cxf.CXFServletExt.init(CXFServletExt.java:77)
                      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1048)
                      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:950)
                      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4122)
                      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4421)
                      at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:310)
                      at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)
                      at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
                      at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
                      at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
                      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:597)
                      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
                      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
                      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
                      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
                      at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
                      at $Proxy38.start(Unknown Source)
                      at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
                      at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
                      at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
                      at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
                      at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
                      at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                      at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)
                      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
                      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
                      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
                      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
                      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
                      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
                      at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
                      at org.jboss.system.ServiceController.start(ServiceController.java:460)
                      at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
                      at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
                      at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
                      at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
                      at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
                      at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
                      at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
                      at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
                      at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
                      at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)
                      at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
                      at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
                      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
                      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
                      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
                      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
                      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
                      at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
                      at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
                      at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
                      at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:362)
                      at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:255)
                      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
                      at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
                      at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
                      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
                      at java.lang.Thread.run(Thread.java:619)

                   

                   

                  We are using the JBossWS Apache CXF 3.2.0. webservice stack. I know this uses Spring 2.5.5 internally. For our application code we are using Spring 2.5.6 and it is included in the common lib directory of the EAR file. I have a feeling that the two versions are conflicting now. Any ideas on how to resolve this???

                   

                  Is there a way to resolve this without EAR classloader isolation set to true?

                   

                  Thanks for you help once again,

                  Kyle

                  • 6. Re: JBoss 5.1.0 and Multiple EARs and EJBs using the SpringBeanAutowiringInterceptor issue
                    Kyle Bober Newbie

                    Okay I have found a solution to my issue. I am not sure if this is the best way of handling this but it works for now and I have yet to run into any issue.

                     

                    We overrode the getBeanFactoryLocator method in the SpringBeanAutowiringInterceptor class. We then used the new Interceptor in our EJB

                     

                    @Interceptors(AnotherSpringBeanAutowiringInterceptor.class)

                     

                    package com.somepackage;

                     

                    import org.springframework.beans.factory.access.BeanFactoryLocator;
                    import org.springframework.context.access.ContextSingletonBeanFactoryLocator;
                    import org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor;


                    public class AnotherSpringBeanAutowiringInterceptor extends    SpringBeanAutowiringInterceptor {

                     

                        private static final String DEFAULT_RESOURCE_LOCATION = "classpath*:anotherBeanRefContext.xml";
                       
                        /**
                         * Determine the BeanFactoryLocator to obtain the BeanFactoryReference from.
                         * <p>The default implementation exposes Spring's default
                         * {@link ContextSingletonBeanFactoryLocator}.
                         * @param target the target bean to autowire
                         * @return the BeanFactoryLocator to use (never <code>null</code>)
                         * @see org.springframework.context.access.ContextSingletonBeanFactoryLocator#getInstance()
                         */
                        protected BeanFactoryLocator getBeanFactoryLocator(Object target) {
                            return ContextSingletonBeanFactoryLocator.getInstance(DEFAULT_RESOURCE_LOCATION);
                        }   
                    }

                     

                    This worked for our multiple EARs which each contained a diffrent beanRefContext.xml. We needed to make the names beanRefContext.xml file unique per EAR and then override the SpringBeanAutowiringInterceptor getBeanFactoryLocator method. We also changed the DEFAULT_RESOURCE_LOCATION string to reference out EARs specific beanRefContext.xml file. If anyone sees an issue with this please let me know as to what side affects we may run into. For now this has been running just fine.

                     

                    Thanks for everyones help and insight into this issue.

                    -Kyle Bober

                    • 7. Re: JBoss 5.1.0 and Multiple EARs and EJBs using the SpringBeanAutowiringInterceptor issue
                      jrantav Novice

                      This helped me fix the same issue with JBoss EAP 6.1.alpha (AS 7.2) with JBoss modules. Thank you!