Re: [jboss-user] [Spring Integration] - JBoss 5.1.0 and Multiple EARs and EJBs using the SpringBeanAutowiringInterceptor issue
by Kyle Bober
Kyle Bober [http://community.jboss.org/people/kyle.bober] replied to the discussion
"JBoss 5.1.0 and Multiple EARs and EJBs using the SpringBeanAutowiringInterceptor issue"
To view the discussion, visit: http://community.jboss.org/message/545298#545298
--------------------------------------------------------------
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.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/545298#545298]
Start a new discussion in Spring Integration at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 4 months
[EJB 3.0] - JBoss EJB3 remote invocation from client app
by zecas zecas
zecas zecas [http://community.jboss.org/people/zecas] created the discussion
"JBoss EJB3 remote invocation from client app"
To view the discussion, visit: http://community.jboss.org/message/545296#545296
--------------------------------------------------------------
Hi,
I'm trying to workout an EJB example with JBoss, but I'm having some trouble understanding some things, and making other things to work.
My Environment:
- Windows XP;
- JBoss 5.1.0.GA;
- Eclipse.
The project is composed of an EAR with an EJB 3.0 and WAR module. Then I'll try to connect remotely in a client application to invoke the EJB.
So for a start, my EJB definition is:
package com.test;
import javax.ejb.Stateless;
/**
* Session Bean implementation class MyBean
*/
@Stateless(name = "my-name", mappedName = "my-map")
public class MyBean implements MyRemote, MyLocal {
/**
* Default constructor.
*/
public MyBean() {
}
public String getMyCommon() {
return "My-Common";
}
public String getMyRemote() {
return "My-Remote";
}
public String getMyLocal() {
return "My-Local";
}
}
package com.test;
import javax.ejb.Local;
@Local
public interface MyLocal {
public String getMyCommon();
public String getMyLocal();
}
package com.test;
import javax.ejb.Remote;
@Remote
public interface MyRemote {
public String getMyCommon();
public String getMyRemote();
}
My ejb-jar.xml in EJB module META-INF, has no definitions:
<?xml version="1.0" encoding="ASCII"?>
<ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:ejb="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0">
<display-name>my-ejb</display-name>
</ejb-jar>
My web.xml in WAR module has no reference to EJB:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>my-web</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
</web-app>
My application.xml describes the modules:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd" version="5">
<display-name>my-ear</display-name>
<module>
<web>
<web-uri>my-web-0.0.1-SNAPSHOT.war</web-uri>
<context-root>/my-web</context-root>
</web>
</module>
<module>
<ejb>my-ejb-0.0.1-SNAPSHOT.jar</ejb>
</module>
</application>
The WAR has a small test page, that injects the @EJB local interface, and successfully gets data, so I assume no other config should be necessary (for now, at least).
For deployment, I just copied the EAR to deploy directory. No errors, and checking JMX Console I can find the following info:
jboss.deployment
# id="jboss.j2ee:ear=my-ear-0.0.1-SNAPSHOT.ear,jar=my-ejb-0.0.1-SNAPSHOT.jar,name=my-name,service=EJB3",type=Component
# id="jboss.j2ee:ear=my-ear-0.0.1-SNAPSHOT.ear,jar=my-ejb-0.0.1-SNAPSHOT.jar,name=my-name,service=EJB3_endpoint",type=Component
I then created a small standalone project, with following code:
Hashtable environment = new Hashtable();
environment.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
environment.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
environment.put(Context.PROVIDER_URL, "jnp://127.0.0.1:1099"); // remote machine IP
InitialContext context = null;
try {
context = new InitialContext(environment);
Object obj = context.lookup("my-name");
System.out.println("-->> lookup object successfully");
} catch(Throwable ex) {
ex.printStackTrace();
} finally {
if( context!=null ) {
context.close();
}
}
When executing, I get the exception:
javax.naming.NameNotFoundException: my-name not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
at org.jnp.server.NamingServer.lookup(NamingServer.java:443)
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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
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)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:528)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
Changing the lookup to:
Object obj = context.lookup("my-map");
Works ok. Lookup goes successfull.
Replacing with:
MyRemote myRemote = (MyRemote) context.lookup("my-map");
Will return:
java.lang.ClassCastException: javax.naming.Reference cannot be cast to com.test.MyRemote
My client application has dependency to the EJB client jar, which only has MyRemote and MyLocal classes, and a dependency to jbossall-client-3.2.3.jar.
If I narrow:
MyRemote myRemote = (MyRemote) PortableRemoteObject.narrow(
context.lookup("my-map"),
MyRemote.class
);
I'll get:
java.lang.ClassCastException
at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
... 2 more
Caused by: java.lang.ClassCastException: javax.naming.Reference cannot be cast to org.omg.CORBA.Object
at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:212)
... 3 more
What am I doing wrong?
Thanks
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/545296#545296]
Start a new discussion in EJB 3.0 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 4 months
[jBPM] - Jbpm Console Server On Weblogic 9.2
by Abhishek Chikane
Abhishek Chikane [http://community.jboss.org/people/abhishek.chikane%40gmail.com] created the discussion
"Jbpm Console Server On Weblogic 9.2"
To view the discussion, visit: http://community.jboss.org/message/545295#545295
--------------------------------------------------------------
Can you please help me to setup the jBPM gwt console server war on Weblogi 9.2?
I am getting following error.
java.lang.IllegalStateException: Neither JMX config nor '-Dcatalina.home' available to resolve serverDataDir
at org.jboss.bpm.report.ReportFacade.resolveDataDir(ReportFacade.java:142)
at org.jboss.bpm.report.ReportFacade.initBirtService(ReportFacade.java:86)
at org.jboss.bpm.report.ReportFacade.<init>(ReportFacade.java:71)
at org.jboss.bpm.console.server.ConsoleServerApplication.<init>(ConsoleServerApplication.java:48)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
This is because in the class ReportFacade the system property is read as "catalina.home" . The JMX cod reads the jboss specific Mbean.
I tried to set the eneviornment variable setting but it did not work
Is there any other way to deploy it on Weblogic 9.2?
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/545295#545295]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 4 months
[JBoss Web Services] - Minimum required for basic user/password authentication on a POJO?
by Karl Beowulph
Karl Beowulph [http://community.jboss.org/people/KBeowulph] created the discussion
"Minimum required for basic user/password authentication on a POJO?"
To view the discussion, visit: http://community.jboss.org/message/545289#545289
--------------------------------------------------------------
Hello.
I've followed the authentication guide ( http://community.jboss.org/wiki/JBossWS-Authentication http://community.jboss.org/wiki/JBossWS-Authentication) and have (mostly) successfully implemented basic security on a POJO web service.
The problem I'm having though is that my client requires two-sets of authentication setting; once for the HTTP basic authentication, and again in the request context (same user and password). Is there a way I can set it so that the user only needs to authenticate at the request context level?
My files are as follows...
h1. Service
*web.xml*
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns=http://java.sun.com/xml/ns/j2ee
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>securityWs_PoC</display-name>
<servlet> <servlet-name>secureWs</servlet-name> <servlet-class>com.securityWs.SecureWs</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>secureWs</servlet-name> <url-pattern>/secureWs</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list>
<!-- Security --> <security-constraint>
<web-resource-collection> <web-resource-name>All resources</web-resource-name> <url-pattern>/*</url-pattern> <!-- <http-method>POST</http-method> --> </web-resource-collection> <auth-constraint> <role-name>friend</role-name> </auth-constraint> </security-constraint> <security-role> <role-name>friend</role-name> </security-role> <login-config> <auth-method>BASIC</auth-method> <realm-name>JBossWS</realm-name> </login-config> </web-app>
*jboss-web.xml*
<jboss-web>
<security-domain>java:/jaas/JBossWS</security-domain>
</jboss-web>
*SecureWs.java*
package com.securityWs;
import javax.jws.WebService;
@WebService
public class SecureWs {
public String echo(String word){ return word+" "+word; }
}
h1. Client
*TestSecureClient.java*
package com.secureClient;
import static org.junit.Assert.assertEquals;
Thanks.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/545289#545289]
Start a new discussion in JBoss Web Services at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 4 months