7 Replies Latest reply on Sep 3, 2002 12:55 AM by sgturner

    using "java:comp/env" in client

    tsangcn

      Hello

      I have try to use lookup the JNDI "java:comp/env/..." in a client and I always get the comp not bound message. I have to lookup the real JNDI name that I deploy the EJBs. So I have the following questions

      (1) Does JBoss does not support the use of application client (something like client container, application-client.xml, etc.)?

      (2) Is application client container part of J2EE? If JBoss does not support application client container, is that means JBoss is not fully J2EE compliant?

      (3) But I have found inside jboss-client.jar, there is a class named org.jboss.proxy.ClientContainer. What is that?
      Thanks
      CN

        • 1. Re: using "java:comp/env" in client
          sgturner

          Check out my September 1 newsletter where you will find an example devoted to this exact question, complete with source code.

          http://www.tiburon-e-systems.com/jboss.htm

          • 2. Re: using "java:comp/env" in client
            tsangcn

            Hello

            I have read the newsletter. But it is talking about servlet or JSP as EJB client. That is what I already knew. Now I want to have a Java program (with main method and run in command shell) as the EJB client and use ENC to lookup the EJB.

            I have tried many ways and it seems that JBoss does not support standalone Java program (with main method) as client to use ENC. It only support the lookup of JNDI name as deploy in jboss.xml for such clients.

            Thanks
            CN

            • 3. Re: using "java:comp/env" in client
              sgturner

              If you read the J2EE spec, you will see that ENC is for being able to locate components from within other J2EE components. Therefore, having an ENC for a component to be used by a client program with main does not make sense and is not supported by JBoss.

              To locate components from a program with main, you can either use the default jndi name which is the ejb-name that JBoss uses or you can set up a name in jboss.xml.

              • 4. Re: using "java:comp/env" in client
                sgturner

                ClientContainer is something entirely different. In JBoss when you ask Jndi for something on the client side, you actually get a dynamic proxy class whose InvocationHandler is an instance of ClientContainer.

                • 5. Re: using "java:comp/env" in client
                  nhebert

                  Greg,

                  Yes, the J2EE Spec does detail the use of the ENC
                  in J2EE components. However, the J2EE spec does in fact
                  describe the Application Client Container as a full
                  fledged J2EE component and as such should have access to
                  the ENC.

                  JBoss does not appear to support the ACC but other servers
                  like Orion/Oracle do.

                  Cheers,

                  Noel.

                  • 6. Re: using "java:comp/env" in client
                    sgturner

                    Noel,

                    I must've missed this one. In fact, I'm looking at version 2.0 final release of EJB spec, dated Aug 14, 2001 and I can't find this. Could you refer me to chapter and verse, please. Thanks

                    • 7. Re: using "java:comp/env" in client
                      sgturner

                      OK. I've got the correct document, now. I see what you are talking about.