13 Replies Latest reply on Aug 8, 2013 9:42 AM by sfcoy

    Migration Jboss7 JNDI error

    admin

      JNDI "naming.NameNotFoundException error" when I tried to deploy my application Jboss5 on Jboss7.1:

      Whatever the namespace I use, I get always the error(I tried with Jboss7 naming space"java:module/NotificationManager!com.tt.airman.framework.server.manager.INotificationManager" and also Jboss5 "framework/NotificationManager/local" )

      Could sommeone help me pls?

       

       

      15:26:25,585 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-7) Context initialization failed: org.springframework.beans.factory.BeanCreationException:

      Error creating bean with name 'notificationManagerEJB': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: NotificationManager!com.tt.air

      man.framework.server.manager.INotificationManager -- service jboss.naming.context.java.module.framework.2-framework-server-war."NotificationManager!com.tt.airman.framework.serv

      er.manager.INotificationManager"

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412) [spring-beans-3.0.2.RELEASE.jar

      :3.0.2.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [spring-beans-3.0.2.RELEASE.jar:3.

      0.2.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [spring-beans-3.0.2.RELEASE.jar:3.0.

      2.RELEASE]

              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) [spring-beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]

              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [spring-beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]

       

              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) [spring-beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) [spring-beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]

              at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:546) [spring-beans-3.0.2.RELEASE.jar:3.0.2.

      RELEASE]

              at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872) [spring-context-3.0.2.RELEASE.jar:3.0

      .2.RELEASE]

              at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423) [spring-context-3.0.2.RELEASE.jar:3.0.2.RELEASE]

              at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276) [spring-web-3.0.2.RELEASE.jar:3.0.2.RELEASE]

              at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197) [spring-web-3.0.2.RELEASE.jar:3.0.2.RELEASE]

              at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) [spring-web-3.0.2.RELEASE.jar:3.0.2.RELEASE]

              at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]

              at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]

              at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

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

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

              at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_30]

      Caused by: javax.naming.NameNotFoundException: NotificationManager!com.tt.airman.framework.server.manager.INotificationManager -- service jboss.naming.context.java.module.frame

      work.2-framework-server-war."NotificationManager!com.tt.airman.framework.server.manager.INotificationManager"

              at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97)

              at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:178)

              at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:123)

              at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:214)

              at javax.naming.InitialContext.lookup(InitialContext.java:392) [rt.jar:1.6.0_30]

              at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154) [spring-context-3.0.2.RELEASE.jar:3.0.2.RELEASE]

              at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87) [spring-context-3.0.2.RELEASE.jar:3.0.2.RELEASE]

              at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152) [spring-context-3.0.2.RELEASE.jar:3.0.2.RELEASE]

              at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178) [spring-context-3.0.2.RELEASE.jar:3.0.2.RELEASE]

              at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95) [spring-context-3.0.2.RELEASE.jar:3.0.2.RELEASE]

              at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105) [spring-context-3.0.2.RELEASE.jar:3.0.2.RELEASE]

              at org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.refreshHome(AbstractSlsbInvokerInterceptor.java:122) [spring-context-3.0.2.RELEASE.jar:3.0.2.RELEASE]

              at org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.afterPropertiesSet(AbstractSlsbInvokerInterceptor.java:109) [spring-context-3.0.2.RELEASE.jar:3.0.2.RELEASE

      ]

              at org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean.afterPropertiesSet(LocalStatelessSessionProxyFactoryBean.java:86) [spring-context-3.0.2.RELEASE.jar:

      3.0.2.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469) [spring-beans-3.0.2.RELEASE.

      jar:3.0.2.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409) [spring-beans-3.0.2.RELEASE.jar

      :3.0.2.RELEASE]

        • 1. Re: Migration Jboss7 JNDI error
          welle

          Have you looked at the JNDI Viewer in the Web Admin Management Console to verirfy exactly what you have in your JNDI?

          • 2. Re: Migration Jboss7 JNDI error
            sfcoy

            The names that you're looking at are ejb-ref-names. You should not need to change the values in your spring configuration.

             

            You should have a jboss-web.xml file that contains <ejb-ref> entries with the corresponding <ejb-ref-name> elements.

             

            You need to change the <jndi-name> values in this file to one of the JNDI binding values that JBoss lists out at runtime.

             

            Spring interprets its "jndi-name" as an ejb-ref-name by default and uses it to compose a JNDI name in the ENC comp namespace: java:comp/env/whatever-jndi-name-you-used, unless you add 'resource-ref="false"' to the configuration.

            • 3. Re: Migration Jboss7 JNDI error
              sgilda

              There are a some Spring examples based on the kitchensink quickstart here: https://github.com/jboss-jdf/jboss-as-quickstart

               

              You might want to check out the kitchensink-spring-basic: https://github.com/jboss-jdf/jboss-as-quickstart/tree/master/kitchensink-spring-basic

               

              These files define the JNDI data source:

              - src/main/webapp/WEB-INF/spring-quickstart-ds.xml

              - src/main/resources/META-INF/spring/infrastructure.xml

              - src/main/resources/META-INF/persistence.xml

               

              Not sure if this helps, but all the kitchensink-spring-* quickstarts deploy successfully to JBoss 7.1.1.

              • 4. Re: Migration Jboss7 JNDI error
                sfcoy

                JNDI naming conventions on JBossAS/WildFly changed completely from 7.0 and later, largely to conform with the standards defined in "Java™ Platform, Enterprise Edition (Java EE) Specification, v6".

                 

                Let's look at a sample from the spring configuration you attached above:

                {code:xml}<jee:local-slsb id="notificationManagerEJB"

                          business-interface="com.tt.airman.framework.server.manager.INotificationManager"

                          jndi-name="java:module/NotificationManager!com.tt.airman.framework.server.manager.INotificationManager" />{code}

                 

                The jndi-name value that you have starts with "java:module/...", which means that name can only be looked up from within the same module that contains the EJB. I expect that your EJBs are all in a jar file contained in an enclosing EAR file. Instead, you need to use "java:app/..." form of JNDI name that is listed when the application starts up.

                 

                 

                Given that you do not have ejb-ref elements in your web.xml, you should probably also add resource-ref="false" to the xml (it defaults to "true"):

                {code:xml}<jee:local-slsb id="notificationManagerEJB"

                          business-interface="com.tt.airman.framework.server.manager.INotificationManager"

                          jndi-name="java:app/your-app-name/NotificationManager!com.tt.airman.framework.server.manager.INotificationManager" resource-ref="false" />{code}

                 

                This should ensure that Spring uses the absolute JNDI name you provide instead of trying to compose a "java:comp/env/..." name from the jndi-name value.

                1 of 1 people found this helpful
                • 5. Re: Migration Jboss7 JNDI error
                  sfcoy

                  Please attach the complete server.log

                   

                  Does your application consist of a single EAR?

                  • 6. Re: Migration Jboss7 JNDI error
                    sfcoy

                    Did you add:

                    {code:xml}        <extension module="org.jboss.as.messaging"/>{code}

                    to your standalone.xml as well?

                    • 7. Re: Migration Jboss7 JNDI error
                      jaikiran

                      Are you sure the correct standalone/domain xml is being used? What command do you use to start the server?

                      • 8. Re: Migration Jboss7 JNDI error
                        sfcoy

                        Does your ejb module contain a jboss.xml file? If so, it needs to be migrated to the new jboss-ejb3.xml file format.

                        • 9. Re: Migration Jboss7 JNDI error
                          sfcoy

                          Please attach your ejb-jar.xml and standalone.xml files

                          • 10. Re: Migration Jboss7 JNDI error
                            sfcoy

                            I need to see every (different) @Resource declaration you have in your ejb module.

                             

                            ... or at least the ones that refer to connection factories and mail sessions.

                            • 11. Re: Migration Jboss7 JNDI error
                              sfcoy

                              I need to see the complete declarations.

                               

                              ie.

                              @Resource(mappedName="java:jboss/mail/Default")

                              private Session mailSession;

                               

                              etc

                               

                              Are any of these EJBs built upon or using Spring Framework mechanisms?

                              • 12. Re: Migration Jboss7 JNDI error
                                sfcoy

                                Please attach the latest server.log. The last one has no evidence of messaging starting up in it.

                                • 13. Re: Migration Jboss7 JNDI error
                                  sfcoy

                                  Your last log had a deployment timeout in it. I guess you added the "deployment-timeout" attribute to the deployment-scanner?