2 Replies Latest reply on Nov 12, 2009 11:14 AM by Marius Bogoevici

    EJB 2.1 deployment problem on JBoss 5.0.1 GA/Spring 1.2.2

    Gaurav Dayal Newbie

      We have an enterprise application with one web-module and one EJB module and we want to deploy it on JBoss-5.0.1 GA AS.

      We use following:
      webwork 2.1.7
      spring 1.2.2
      EJB 2.1
      JBoss 5.0.1 GA
      jdk 1.5.0_12

      To initialize spring beans, org.springframework.web.context.ContextLoaderListener is configured.

      Problem is: Without any entry of EJB in applicationContext.xml, the JBoss-5.0.1 GA AS starts up properly without any errors. We can also look-up EJBs. But, when we put an entry of EJB into applicationContext.xml (the ejb which is also deployed), we get following error:


      16:22:37,316 ERROR [ContextLoader] Context initialization failed
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'counterEJB' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is javax.naming.NamingException: Could not dereference object
      javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: CounterBean not bound]
       at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1348)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:813)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:829)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
       at javax.naming.InitialContext.lookup(InitialContext.java:351)
       at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:123)
       at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:85)
       at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:121)
       at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:71)
       at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:106)
       at org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.refreshHome(AbstractSlsbInvokerInterceptor.java:102)
       at org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.afterPropertiesSet(AbstractSlsbInvokerInterceptor.java:90)
       at org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean.afterPropertiesSet(LocalStatelessSessionProxyFactoryBean.java:83)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:966)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:358)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getType(AbstractBeanFactory.java:342)
       at org.springframework.beans.factory.support.DefaultListableBeanFactory.isBeanTypeMatch(DefaultListableBeanFactory.java:250)
       at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:145)
       at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:129)
       at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:135)
       at org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator.findCandidateAdvisors(DefaultAdvisorAutoProxyCreator.java:105)
       at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.setBeanFactory(AbstractAdvisorAutoProxyCreator.java:61)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:353)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
       at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:204)
       at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:594)
       at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:392)
       at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:297)
       at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:134)
       at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:230)
       at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:156)
       at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:48)
       at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)
       at org.apache.catalina.core.StandardContext.start(StandardContext.java:4393)
       at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:312)
       at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:144)
       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:585)
       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 $Proxy36.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:1598)
       at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
       at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
       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:1598)
       at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
       at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
       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:698)
       at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:304)
       at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:205)
       at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:405)
       at org.jboss.Main.boot(Main.java:209)
       at org.jboss.Main$1.run(Main.java:547)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: javax.naming.NameNotFoundException: CounterBean 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.GeneratedMethodAccessor259.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
       at sun.rmi.transport.Transport$1.run(Transport.java:153)
       at java.security.AccessController.doPrivileged(Native Method)
       at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
       at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
       at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
       at java.lang.Thread.run(Thread.java:595)
       at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
       at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
       at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
       at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:722)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
       at javax.naming.InitialContext.lookup(InitialContext.java:351)
       at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1342)



      --------------

      We have observed that before the EJB gets bound to its JNDI name, the Spring context loader starts loading EJB beans from applicationContext.xml and hence attempts to look it up by its JNDI and hence fails. But we have no clue as what can be the reason that spring context loading starts before ejb jndi binding. We have searched a lot but we did not find any help.

      We have got struck here badly and we are in need of some immediate help. Any help/pointers will be highly appreciated.


      Thanks & BR,
      Gaurav