1 Reply Latest reply on Mar 22, 2012 3:27 AM by dmitry_svirid

    Connecting JBoss instances through JNDI

    dmitry_svirid

      Hi all! I have some problems with configuration of JBoss AS 6.1.0.Final.

       

      What we want to do:

      We have two components run in separate JBoss instances that placed on separate separate machines. But… they had to communicate to each other through a JNDI lookup i.e. we have two machines in our hosting environment, one of which is accessible from the outside world, let’s call this one “A”. “A” is part of two network, one goes out to the real world, the other stays on our internal network. The other machine, “B”, can only be reached from the internal network. “A” is supposed to run our Web-application and delegate service calls to “B”. “B” registers an EJB bean in its JNDI registry and accepts service calls through RMI. All “A” has to do is lookup the EJB from “B”-s JNDI and make calls.

       

      What we tried to do:

      Using (https://community.jboss.org/wiki/ConfiguringTheJNDINamingServiceInConfjbossSystemxml) we add

         <mbean code="org.jboss.naming.NamingService" name="jboss:service=Naming">
           
           <!-- The listening port for the bootstrap JNP service. Set this to -1
                  to run the NamingService without the JNP invoker listening port.
            -->
            <attribute name="Port">1099</attribute>
           
            <!-- The bootstrap JNP server bind address. This also sets the default
                   RMI service bind address. Empty == all addresses
             -->
            <attribute name="BindAddress"></attribute>
           
            <!-- The port of the RMI naming service, 0 == anonymous -->
            <attribute name="RmiPort">1098</attribute>
           
            <!-- The RMI service bind address. Empty == all addresses -->
            <attribute name="RmiBindAddress"></attribute>
         </mbean>

       

      to the jboss-service.xml of the “B” machine

       

      Using https://community.jboss.org/wiki/JNDIClientConfiguration we add

      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.provider.url=jnp://localhost:1099
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

       

      to the jndi.properties of the “B” machine

       

      When we try to run jboss on “B” we get exception:

      04:18:55,430 INFO  [JMXKernel] Legacy JMX core initialized

      04:18:57,297 ERROR [AbstractKernelController] Error installing to Start: name=jboss:service=Naming state=Create mode=Manual requiredState=Installed: java.lang.NullPointerException

          at org.jnp.server.Main.getNamingInstance(Main.java:403) [:5.0.5.Final]

          at org.jnp.server.Main.initJnpInvoker(Main.java:461) [:5.0.5.Final]

          at org.jnp.server.Main.start(Main.java:422) [:5.0.5.Final]

          at org.jboss.naming.NamingService.startService(NamingService.java:331) [:6.1.0.Final]

          at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:355) [:6.1.0.Final (Build SVNTag:JBoss_6.1.0.Final date: 20110816)]

          at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:301) [:6.1.0.Final (Build SVNTag:JBoss_6.1.0.Final date: 20110816)]

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_21]

       

      The full log of jboss as is attached to the post.

       

      Thanks in advance for any help.