6 Replies Latest reply on Dec 8, 2003 10:54 AM by stanimir

    EJB Remote client

    stanimir Newbie

      hi,
      I have a java client that needs to access an EJB on a remote JBoss server.
      I need the home and the remote stubs generated by JBoss during the deployment of the EJB, in the client classpath.
      I don't know where to find these stubs in JBoss server.
      Is there any directory where all generated client stubs are kept in JBoss?
      In general, how a client could call a Remote EJB if it has not the EJB jar in its classpath??
      Thank you.

      Stan

        • 1. Re: EJB Remote client
          Raja Master

          Jboss creates dynamic proxies instead of stubs (which also eliminates the need for ejbc or similar kind used in weblogic). All you need to do from ur client is have the remote interfaces for ur ejb and have a jndi.properties that has values for java.naming.provider.url=jnp://machinename:1099
          java.naming.factory.initial=Lookup getting started docs for this classname

          -Raj

          • 2. Re: EJB Remote client
            stanimir Newbie

            Hi Raj,
            Thanks a lot.
            I understand what you mean but I have another question.
            You wrote "All you need to do from ur client is have the remote interfaces for ur ejb..."
            Do you mean that I have to include the home and the remote interfaces in the client jar or I have to include the EJB jar in the client classpath?
            The latter implies that the EJB jar must be present on the client machine.
            Which solution is more convinient on your opinion?
            Thank you.
            Stan.

            • 3. Re: EJB Remote client
              Jon Barnett Master

              You actually want just the interfaces in the client environment. Ideally, you don't want to have the implementation included in the client environment.

              One of the reasons for using an EJB is to be able to use the remote component, without "knowing" how the remote component does the work. It is a standard idiom or style for Java to use the interface to separate the "user" of an object from the implementation of the object - see "A System of Patterns" by Frank Buschmann, et al for a lengthy description of idioms.

              So include the home and remote interfaces in your client environment.

              • 4. Re: EJB Remote client
                stanimir Newbie

                Hi Jonlee,
                thank you very much.
                Let me see if I understood what you meant.
                So you suggested that I include the home and the remote interfaces of the remote EJB in the client classpath. And the job is done.
                Is it a good grasp of your message??
                thank you very much.
                Stan

                • 5. Re: EJB Remote client
                  Jon Barnett Master

                  Yes. That's it. Although, most times you build a client jar that has the interfaces - it would be part of the build process; build the EJB deployment JAR, build the EJB client JAR.

                  • 6. Re: EJB Remote client
                    stanimir Newbie

                    Hi Jonlee,
                    Thank you very much.
                    Cheers.
                    Stan