5 Replies Latest reply on Apr 7, 2005 11:06 PM by spoonman464

    JNDI available outside tje server?

    holeinone

      Hello all,

      I'm trying to call a stateless session bean's business method from outside the server it is running on. Therfore I must access the JNDI of the jboss server.
      I created a jndi.properties file with the folowing entries:

      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
      # Do NOT uncomment this line as it causes in VM calls to go over
      # RMI!
      java.naming.provider.url=jnp://<server-dns-shortname>:1099
      # The jnp protocol socket factory class
      jnp.socketFactory=org.jnp.interfaces.TimedSocketFactory
      # The TimedSocketFactory connection timeout in milliseconds(0 == blocking)
      jnp.timeout=1000
      # The TimedSocketFactory read timeout in milliseconds(0 == blocking)
      jnp.sotimeout=250

      however the connection gets timed out.
      After a while I got the idea to portscan (TCP) the server and to my surpise port 1099 isn't open.
      What do I have to do to make the JNDI available to remote clients?
      Can I then, somehow, restrict access to only certain clients?
      Regards,

      Hugo

      P.s. my naming config from jboss-service.xml is:

      <!-- ==================================================================== -->
      <!-- JNDI -->
      <!-- ==================================================================== -->

      <mbean code="org.jboss.naming.NamingService"
      name="jboss:service=Naming"
      xmbean-dd="resource:xmdesc/NamingService-xmbean.xml">
      <!-- The call by value mode. true if all lookups are unmarshalled using
      the caller's TCL, false if in VM lookups return the value by reference.
      -->
      <attribute name="CallByValue">false</attribute>
      <!-- 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">${jboss.bind.address}</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">${jboss.bind.address}</attribute>
      <!-- The thread pool service used to control the bootstrap lookups -->
      <depends optional-attribute-name="LookupPool"
      proxy-type="attribute">jboss.system:service=ThreadPool</depends>
      </mbean>

      <mbean code="org.jboss.naming.JNDIView"
      name="jboss:service=JNDIView"
      xmbean-dd="resource:xmdesc/JNDIView-xmbean.xml">
      </mbean>


        • 1. Re: JNDI available outside tje server?
          holeinone

          Using the JMX-Console I set "CallByValue" to

          true
          . Now the port is open and I can access the JNDI from outside the JVM.
          Its magic :)

          • 2. Re: JNDI available outside tje server?
            darranl

            Something sounds wierd with your set-up, I have never had to make a configuration change to make JBoss available remotely.

            If the jndi.properties file that you showed outside the conf folder or is it still in the conf folder?

            • 3. Re: JNDI available outside tje server?
              netsandro

              Have u a firewall ? Verify if it leave u access u jndi on 1099.

              Another important thing, the naming starting with java:comp/env is not accessible out of Container. Use another name like jdbc/MyDataSource, ejb/MyEjb in spite of java:comp/env/ejb/MyEjb, ...

              • 4. Re: JNDI available outside tje server?
                netsandro

                ... but first, verify on your log to see any Exception and if the naming service is up.

                • 5. Maybe it's a silly question but...
                  spoonman464

                  .... are you using a real hostname in your jndi.properties file or does your actual file look exactly as you posted it?

                  If so, take a look at this line:

                  java.naming.provider.url=jnp://<server-dns-shortname>:1099

                  You really need a hostname and cannot leave it as <server-dns-shortname>

                  Let me know because I have lots of experience getting remote clients to connect to EJBs running on JBoss. I can even make it work when the EJBs have security on them!

                  Spoon
                  http://www.spoonware.com