5 Replies Latest reply on Mar 2, 2005 5:19 AM by Jens Popp

    Configuring remote context

    Jens Popp Newbie

      Hi,

      I want to access a session bean on a remote server via the remote (home) interface. Is there a way to set the context (servername/port) at deploytime (e.g. in an xml conf file) and do a jndi lookup on the local Server?

      Thanks

      Jens

        • 1. Re: Configuring remote context
          Amit Bhayani Newbie

          you need jndi properties on remote client

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


          Hope that helps.
          Amit.

          • 2. Re: Configuring remote context
            Darran Lofthouse Master

            jenspopp,

            Did you mean that you want to perform the lookup from a session bean on one JBoss instance to another JBoss instance or did you mean that the client is running outside of JBoss?

            • 3. Re: Configuring remote context
              Jens Popp Newbie

              Hi,

              thanks for the fast reply. I have to instances of jboss running on different servers. I want to access a session bean (user management) on the remote server from my own server. I'd like to configure the hostname/port of the remote server during deploytime.

              Thanks

              • 4. Re: Configuring remote context
                Darran Lofthouse Master

                If you have a look at the administrators guide available from the documentation link above there is an MBean described called 'ExternalContext' in chapter 3.2.6.1.

                I have never tried using the MBean so can not say how well it would work but basically the bean allows you to bind a remote JNDI context in your local context, using this combined with an ejb-ref may meet your needs.

                • 5. Re: Configuring remote context
                  Jens Popp Newbie

                  Hi,

                  I think there is a solution using the jboss.xml file. I have defined the UserManagement as an external ref in ejb-jar.xml:

                  <ejb-ref >
                   <ejb-ref-name>ejb/UserManagement</ejb-ref-name>
                   <ejb-ref-type>Session</ejb-ref-type>
                   <home>session.interfaces.UserManagementHome</home>
                   <remote>session.interfaces.UserManagement</remote>
                   <ejb-link>UserManagement</ejb-link>
                  </ejb-ref>
                  

                  I also defined in the jboss.xml:

                  <ejb-ref>
                   <ejb-ref-name>ejb/UserManagement</ejb-ref-name>
                   <jndi-name>jnp://remote:1099/ejb/UserManagement</jndi-name>
                  </ejb-ref>


                  or:
                  <ejb-ref>
                   <ejb-ref-name>ejb/UserManagement</ejb-ref-name>
                   <jndi-name>jnp://remote:1099/UserManagement</jndi-name>
                  </ejb-ref>


                  When I try to deploy I get always the error:

                  org.jboss.deployment.DeploymentException: Failed to resolve ejb-link: UserManagement make by ejb-name: ejb/UserManagement

                  No matter if the remote server is running or not. If I deploy it in the same ear file (on the same server) it runs. It seems the jboss server ignores the jndi-name tag. Do I have to configure something else?