8 Replies Latest reply on Sep 5, 2014 3:59 AM by wdfink

    JNDI Naming Exception

    dharmajd

      I'm getting the below exception when I tried to call EJBs(Version 2.1) in JBoss EAP 6.2. Here my client  and EJBs are the on the same JBoss Instance.

       

      Caused by: javax.naming.NameNotFoundException: jboss/exported/UpsServer/ups-server-ejb-1.0/AuthSession!com.hp.ucs.auth.ejb.session.Auth-- service jboss.naming.context.java.jboss.exported.jboss.exported.UpsServer."ups-server-ejb-1.0"."Auth!com.hp.ucs.auth.ejb.session.AuthHome"

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

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

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

      at org.jboss.naming.remote.protocol.v1.Protocol$1.handleServerMessage(Protocol.java:127) [jboss-remote-naming-1.0.7.Final.jar:1.0.7.Final]

      at org.jboss.naming.remote.protocol.v1.RemoteNamingServerV1$MessageReciever$1.run(RemoteNamingServerV1.java:73) [jboss-remote-naming-1.0.7.Final.jar:1.0.7.Final]

      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]

      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]

      ... 1 more

       

      My Client Code is:

       

      <bean id="authService"  class="org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean" lazy-init="true">

      <property name="jndiTemplate">

      <ref local="jndiTemplate" />

      </property>

      <property name="jndiName">

      <value>java:global/UpsServer/ups-server-ejb-1.0/AuthSession!com.hp.ucs.auth.ejb.session.AuthLocal</value>

      </property>

      <property name="businessInterface">

      <value>com.hp.ups.common.web.auth.service.AuthService</value>

      </property>

      </bean>

       

      ejb-jar.xml:

      <session id="Session_Auth">

      <description><![CDATA[EJB for User Auth]]></description>

      <display-name>Auth</display-name>

      <ejb-name>Auth</ejb-name>

      <home>com.hp.ucs.auth.ejb.session.AuthHome</home>

      <remote>com.hp.ucs.auth.ejb.session.Auth</remote>

      <local-home>com.hp.ucs.auth.ejb.session.AuthLocalHome</local-home>

      <local>com.hp.ucs.auth.ejb.session.AuthLocal</local>

      <ejb-class>com.hp.ucs.auth.ejb.session.AuthSession</ejb-class>

      <session-type>Stateless</session-type>

      <transaction-type>Container</transaction-type>

      </session>

       

      In Server Log I can see the below JNDI bindings:

       

      10:23:17,328 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-1) JNDI bindings for session bean named Auth in deployment unit subdeployment "ups-server-ejb-1.0.jar" of deployment "UpsServer.ear" are as follows:

      java:global/UpsServer/ups-server-ejb-1.0/Auth!com.hp.ucs.auth.ejb.session.AuthLocal

      java:app/ups-server-ejb-1.0/Auth!com.hp.ucs.auth.ejb.session.AuthLocal

      java:module/Auth!com.hp.ucs.auth.ejb.session.AuthLocal

      java:global/UpsServer/ups-server-ejb-1.0/Auth!com.hp.ucs.auth.ejb.session.Auth

      java:app/ups-server-ejb-1.0/Auth!com.hp.ucs.auth.ejb.session.Auth

      java:module/Auth!com.hp.ucs.auth.ejb.session.Auth

      java:jboss/exported/UpsServer/ups-server-ejb-1.0/Auth!com.hp.ucs.auth.ejb.session.Auth

      java:global/UpsServer/ups-server-ejb-1.0/Auth!com.hp.ucs.auth.ejb.session.AuthLocalHome

      java:app/ups-server-ejb-1.0/Auth!com.hp.ucs.auth.ejb.session.AuthLocalHome

      java:module/Auth!com.hp.ucs.auth.ejb.session.AuthLocalHome

      java:global/UpsServer/ups-server-ejb-1.0/Auth!com.hp.ucs.auth.ejb.session.AuthHome

      java:app/ups-server-ejb-1.0/Auth!com.hp.ucs.auth.ejb.session.AuthHome

      java:module/Auth!com.hp.ucs.auth.ejb.session.AuthHome

      java:jboss/exported/UpsServer/ups-server-ejb-1.0/Auth!com.hp.ucs.auth.ejb.session.AuthHome

       

      Even my standalone-full.xml has the below entry:

      <subsystem xmlns="urn:jboss:domain:naming:1.4">

                  <remote-naming/>

        </subsystem>

       

      I tried all the possibilities of JNDI names, but no luck I ended up with same error.

      Can somebody help me?

        • 1. Re: JNDI Naming Exception
          wdfink

          As you use EJB2 I would recommend to use the Home interface with the lookup to get a bean reference.

           

          If you use the lookup inside the server it depends a bit on the InitialContext, in general the container should provide the correct one.

          If so you need to lookup "ejb:UpsServer/ups-server-ejb-1.0/....." for the correct lookup.

          • 2. Re: JNDI Naming Exception
            dharmajd


            Hi Wolf-Dieter Fink

            I tried with "ejb:UpsServer/ups-server-ejb-1.0/AuthSession!com.hp.ucs.auth.ejb.session.AuthHome" but No Luck..I'm getting the same Exception.

             

            javax.naming.NameNotFoundException: ejb:UpsServer/ups-server-ejb-1.0/AuthSession!com.hp.ucs.auth.ejb.session.AuthHome -- service jboss.naming.context.java.jboss.exported.ejb:UpsServer."ups-server-ejb-1.0"."AuthSession!com.hp.ucs.auth.ejb.session.AuthHome"

             

            I'm using the below InitialContext

            org.jboss.naming.remote.client.InitialContextFactory

             

            • 3. Re: JNDI Naming Exception
              dharmajd

              Can anybody help me to resolve this?

              • 4. Re: JNDI Naming Exception
                wdfink

                Difficult to say ...

                You use a framework, right?

                Not sure how the InitialContext is created

                • 5. Re: JNDI Naming Exception
                  dharmajd

                  Thanks Wolf-Dieter Fink

                  Yes, we are using Spring Frame work

                  • 6. Re: JNDI Naming Exception
                    wdfink

                    Could you check what properties are set for the InitialContext? ( I'm not a user of Spring framework )

                    • 7. Re: JNDI Naming Exception
                      dharmajd


                      I resolved this problem, instead of using org.jboss.naming.remote.client.InitialContextFactory I used org.jboss.as.naming.InitialContextFactory.

                      Thanks Wolf-Dieter.

                      And One more thing can you let me know How to stop Authentication against security realm: ManagementRealm ?

                      • 8. Re: JNDI Naming Exception
                        wdfink

                        What do you mean? EJB invocations are authenticated with the ApplicationRealm