4 Replies Latest reply on Oct 25, 2010 10:16 PM by sunil polineni

    Weblogic 10.3 foreign JNDI Link not working with http protocol when connecting to JBOSS

    sunil polineni Newbie

      Deployed ejb 3.0 on Jboss
      Invoking it from weblogic server 10.3.0

      1.) when invoking from servlet inside weblogic server with out using foreign JNDI link

      JNP protocol
      ============
      prop.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
      prop.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
      prop.put("java.naming.provider.url","localhost:1099");

      http protocol
      =============
      prop.put("java.naming.factory.initial","org.jboss.naming.HttpNamingContextFactory");
      prop.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
      prop.put("java.naming.provider.url","http://localhost:8080/invoker/JNDIFactory");

      both protocols are working fine with out any issue

      2.) when creating foreign jndi link as below  This works fine with jnp but fails with HTTP

      JNP protocol
      ============
      <foreign-jndi-provider>
           <name>ForeignJNDIProvider-Jboss</name>
           <initial-context-factory>org.jnp.interfaces.NamingContextFactory</initial-context-factory>
           <provider-url>localhost:1099</provider-url>
           <user>admin</user>
           <foreign-jndi-link>
             <name>ForeignJNDILink-0</name>
             <local-jndi-name>local</local-jndi-name>
             <remote-jndi-name>SampleEJBJNDI</remote-jndi-name>
           </foreign-jndi-link>
           <properties>java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces</properties>
           <password-encrypted>{3DES}duAeY8k8ctI=</password-encrypted>
         </foreign-jndi-provider>
        
      http protocol
      ============= 
         <foreign-jndi-provider>
           <name>ForeignJNDIProvider-Jboss-HTTP</name>
           <initial-context-factory>org.jboss.naming.HttpNamingContextFactory</initial-context-factory>
           <provider-url>http://localhost:8080/invoker/JNDIFactory</provider-url>
           <user>admin</user>
           <foreign-jndi-link>
             <name>ForeignJNDILink-0</name>
             <local-jndi-name>httpLink</local-jndi-name>
             <remote-jndi-name>SampleEJBJNDI</remote-jndi-name>
           </foreign-jndi-link>
           <properties>java.naming.factory.url.pkgs=
      org.jboss.naming:org.jnp.interfaces</properties>
           <password-encrypted>{3DES}duAeY8k8ctI=</password-encrypted>
         </foreign-jndi-provider>
      but fails with below exception

      javax.naming.ConfigurationException: Call to NamingManager.getObjectInstance() failed:  [Root exception is java.lang.IllegalA
      rgumentException: No Configuration was registered that can handle the configuration named other]; remaining name ''
               at weblogic.jndi.internal.ServerNamingNode.resolveObject(ServerNamingNode.java:394)
               at weblogic.jndi.internal.BasicNamingNode.resolveObject(BasicNamingNode.java:856)
               at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:209)
               at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
               at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:380)
               at javax.naming.InitialContext.lookup(InitialContext.java:392)
               at com.oracle.servlet.Test.doPost(Test.java:73)
               at com.oracle.servlet.Test.doGet(Test.java:36)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
               at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
               at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
               at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
               at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
               at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3498)
               at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
               at weblogic.security.service.SecurityManager.runAs(Unknown Source)
               at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
               at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
               at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
               at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
               at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
      Caused by: java.lang.IllegalArgumentException: No Configuration was registered that can handle the configuration named other
              at com.bea.common.security.jdkutils.JAASConfiguration.getAppConfigurationEntry(JAASConfiguration.java:124)
               at javax.security.auth.login.LoginContext.init(LoginContext.java:243)
               at javax.security.auth.login.LoginContext.<init>(LoginContext.java:499)
               at org.jboss.naming.HttpNamingContextFactory.tryLogin(HttpNamingContextFactory.java:141)

               at org.jboss.naming.HttpNamingContextFactory.getInitialContext(HttpNamingContextFactory.java:84)
               at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
               at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
               at javax.naming.InitialContext.init(InitialContext.java:223)
               at javax.naming.InitialContext.<init>(InitialContext.java:197)
               at weblogic.jndi.internal.ForeignOpaqueReference.getReferent(ForeignOpaqueReference.java:70)
               at weblogic.jndi.internal.WLNamingManager.getObjectInstance(WLNamingManager.java:96)
               at weblogic.jndi.internal.ServerNamingNode.resolveObject(ServerNamingNode.java:377)

       

      failing  only when using foreign jndi link with http protocol. I am not sure why is it looking for JAASConfiguration.

       

      tried with following


      1) create a file called "jaas.conf",  the contents of "jaas.conf" should be:

            other {
                com.sun.security.auth.JndiLoginModule required;
          };

      2) restart the WLS instance with this flag:
          -
      Djava.security.auth.login.config=<fullpath>/jaas.conf

       

      got below exception


      javax.naming.AuthenticationException: Failed to login using protocol=other [Root exception is javax.security.auth.login.Login
      Exception: unable to find LoginModule class: com.sun.security.auth.JndiLoginModule]
               at org.jboss.naming.HttpNamingContextFactory.tryLogin(HttpNamingContextFactory.java:146)
               at org.jboss.naming.HttpNamingContextFactory.getInitialContext(HttpNamingContextFactory.java:84)
               at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
               at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
               at javax.naming.InitialContext.init(InitialContext.java:223)
               at javax.naming.InitialContext.<init>(InitialContext.java:197)
               at weblogic.jndi.internal.ForeignOpaqueReference.getReferent(ForeignOpaqueReference.java:70)
               at weblogic.jndi.internal.WLNamingManager.getObjectInstance(WLNamingManager.java:96)
               at weblogic.jndi.internal.ServerNamingNode.resolveObject(ServerNamingNode.java:377)
               at weblogic.jndi.internal.BasicNamingNode.resolveObject(BasicNamingNode.java:856)
               at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:209)
               at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
               at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:380)
               at javax.naming.InitialContext.lookup(InitialContext.java:392)
               at com.oracle.servlet.Test.doPost(Test.java:73)
               at com.oracle.servlet.Test.doGet(Test.java:36)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
               at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
               at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
               at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
               at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
               at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3498)
               at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
               at weblogic.security.service.SecurityManager.runAs(Unknown Source)
               at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
               at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
               at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
               at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
               at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
      Caused by: javax.security.auth.login.LoginException: unable to find LoginModule class: com.sun.security.auth.JndiLoginModule
               at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)
               at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
               at javax.security.auth.login.LoginContext$5.run(LoginContext.java:706)
               at java.security.AccessController.doPrivileged(Native Method)
               at javax.security.auth.login.LoginContext.invokeCreatorPriv(LoginContext.java:703)
               at javax.security.auth.login.LoginContext.login(LoginContext.java:575)
               at org.jboss.naming.HttpNamingContextFactory.tryLogin(HttpNamingContextFactory.java:142)
               ... 29 more

       

      Any pointers