7 Replies Latest reply on Aug 29, 2003 7:02 AM by adrian.brock

    External JNDI namespaces

    naskoak

      Dear all,
      recently i have struggled to run JBoss with an external JNDI service.
      My environment is:
      JBoss 3.0.4 and BEA Weblogic 7.0
      I want to run JBoss with the naming service of WLS. After many attempts, reading books and articles, i still cannot connoct.
      Btw, i followed the advice from the handbook "JBoss 3.0 - Deployment and Administration", page 71. But, i need to admit that the script is wrong (with typos) and not complete.
      What have i done so far:
      1. Put weblogic.jar at the classpath of JBoss.
      2. Configured the jboss-service.xml file to trigger the MBean:
      -----------------

      WLSContext
      weblogic.jndi.internal.WLInternalContext
      true
      weblogic.properties

      -----------------
      3. Created weblogic.properties file:
      -----------------
      java.naming.factory.initial=weblogic.jndi.internal.WLInternalContext
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
      java.naming.provider.url=t3://localhost:7001
      -----------------
      4. run WLS to make JNDI available
      5. run JBoss from the console.

      The result is always :
      ---------------------
      INFO [ExternalContext] Starting
      ERROR [ExternalContext] Starting failed
      java.lang.NoSuchMethodException: weblogic.jndi.WLInitialContextFactory.(java.util.Hashtable, [Ljavax.naming.ldap.Control;)
      ---------------------
      Well, the message is clear, but how to solve it ?
      Am i missing something ?
      If you have experience in this area and have successfully connected JBoss with WLS, please, help me.

      Waiting for your advice!
      Best regards,
      ~Nasko

        • 1. Re: External JNDI namespaces

          Post the full stacktrace.

          Regards,
          Adrian

          • 2. Re: External JNDI namespaces
            naskoak

            Adrian, here is the full stack trace:
            =============
            12:33:29,330 INFO [NamingService] Starting
            12:33:29,340 INFO [NamingService] Starting jnp server
            12:33:29,410 INFO [NamingService] Started jnpPort=1099, rmiPort=0, backlog=50, bindAddress=null, Client SocketFactory=null, Serve
            r SocketFactory=null
            12:33:29,410 WARN [NamingService] Context.PROVIDER_URL in server jndi.properties, url=localhost
            12:33:29,420 INFO [NamingService] Listening on port 1099
            12:33:29,430 INFO [NamingService] Started
            12:33:29,430 INFO [JNDIView] Starting
            12:33:29,430 INFO [JNDIView] Started
            12:33:29,430 INFO [ExternalContext] Starting
            12:33:29,440 ERROR [ExternalContext] Starting failed
            java.lang.NoSuchMethodException: weblogic.jndi.internal.WLInternalContext.(java.util.Hashtable, [Ljavax.naming.ldap.Control;
            )
            at java.lang.Class.getConstructor0(Class.java:1769)
            at java.lang.Class.getConstructor(Class.java:1002)
            at org.jboss.naming.ExternalContext$SerializableInitialContext.newLdapContext(ExternalContext.java:468)
            at org.jboss.naming.ExternalContext$SerializableInitialContext.newContext(ExternalContext.java:447)
            at org.jboss.naming.ExternalContext$SerializableInitialContext.newContext(ExternalContext.java:433)
            at org.jboss.naming.ExternalContext.rebind(ExternalContext.java:253)
            at org.jboss.naming.ExternalContext.startService(ExternalContext.java:216)
            at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
            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:324)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:550)
            at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)
            at $Proxy0.start(Unknown Source)
            at org.jboss.system.ServiceController.start(ServiceController.java:394)
            at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:550)
            at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
            at $Proxy5.start(Unknown Source)
            at org.jboss.deployment.SARDeployer.start(SARDeployer.java:226)
            at org.jboss.deployment.MainDeployer.start(MainDeployer.java:824)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:632)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:589)
            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:324)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:550)
            at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
            at $Proxy6.deploy(Unknown Source)
            at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:383)
            at org.jboss.system.server.ServerImpl.start(ServerImpl.java:290)
            at org.jboss.Main.boot(Main.java:150)
            at org.jboss.Main$1.run(Main.java:388)
            at java.lang.Thread.run(Thread.java:536)
            ================

            • 3. Re: External JNDI namespaces

              Does the weblogic class implement
              javax.naming.InitialContext or
              javax.naming.ldap.InitialLdapContext?

              Regards,
              Adrian

              • 4. Re: External JNDI namespaces
                naskoak

                Adrian,

                Thanks for your replies !
                Unfortunately, the weblogic class does NOT implement the upper interfaces, but directly javax.naming.Context.

                I was also surprised by this. But the book i mentioned, describes a procedure to connect exactly to WLS. Apparently, the script provided is not complete and contains typos.

                Any ideas how to proceed ?

                Is there a way to contact you by phone or e-mail ?

                Thanks for the support!

                • 5. Re: External JNDI namespaces

                  Context is an interface so it can't define the contructor.
                  There must be an initial naming context factory for weblogic?

                  Alternatively subclass ExternalContext mbean
                  to provide weblogic specific behaviour.

                  Regards,
                  Adrian

                  • 6. Re: External JNDI namespaces
                    naskoak

                    Adrian,
                    Thanks again for your reply !

                    1.Weblogic has a naming connetion factory:
                    weblogic.jndi.WLInitialContextFactory

                    The problem is that it return directly Context, not InitialContext. And then everything goes wrong if i do :
                    ==========

                    WLSContext
                    javax.naming.InitialContext
                    true
                    weblogic.properties

                    ==========

                    and (as offered in the book):
                    ==========
                    java.util.Hashtable ht = new java.util.Hashtable();
                    ht.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
                    ht.put(Context.PROVIDER_URL,"jnp://localhost:1099");
                    ht.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");

                    initialContext = new InitialContext(ht);
                    InitialContext wlsContext = (InitialContext)initialContext.lookup("WLSContext");
                    ==========

                    The last line of the code produces : ClassCastException.

                    2. Your suggestion to subclass ExternalContext. How easy is it to find it in the libraries of Jboss and how to plug it afterwards in the JBoss environment ?
                    Any ideas?

                    Regards,
                    ~Nasko

                    • 7. Re: External JNDI namespaces

                      <mbean code="org.jboss.naming.ExternalContext"

                      It is in the server module

                      Regards,
                      Adrian