7 Replies Latest reply on May 10, 2002 7:58 AM by Sebastian Hallensleben

    is support ejb2.0 in jboss2.4.4? why lookup() is wrong?

    david Newbie

      I am using are only with stateless session beans.
      It just seems strange that the JNDI name is registered with JBoss but they are not bound to the localEJBObject

      wrong is

      javax.naming.NameNotFoundException: SBCarParkLocalLocal not bound

      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)

      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)

      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)

      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)

      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:349)

      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:333)

      at javax.naming.InitialContext.lookup(InitialContext.java:350)

      at com.xinghe.wuye.test.findLocal(test.java:54)

      at com.xinghe.wuye.test.main(test.java:88)

        • 1. Re: is support ejb2.0 in jboss2.4.4? why lookup() is wrong?
          Sebastian Hallensleben Newbie

          You need to post the relevant parts of your code.

          /Sebastian

          • 2. this wrong coding.
            david Newbie

            public class test {

            public test() {
            }

            public static EJBLocalHome findLocal(String jndi) throws NamingException{

            javax.naming.Context t;
            EJBLocalHome info = null;
            try {
            Context contextIntial = getContext();
            //context = (Context)contextIntial.lookup("java:comp/env/ejb/"+jndi) ;
            info = (EJBLocalHome) contextIntial.lookup(jndi);
            } catch (NamingException e) {
            e.printStackTrace() ;
            throw e;
            } finally {
            return info;
            // context.close();
            }
            }

            public static Context getContext() throws NamingException{
            java.util.Hashtable ht = new java.util.Hashtable();
            ht.put(Context.INITIAL_CONTEXT_FACTORY, EnvContextMgr.getContextName("java.naming.factory.initial"));
            ht.put(Context.PROVIDER_URL, EnvContextMgr.getContextName("java.naming.provider.url"));
            ht.put(Context.URL_PKG_PREFIXES, EnvContextMgr.getContextName("prefixes"));
            return new InitialContext(ht);
            }

            public static void main(String[] args){



            try {
            System.out.println("adfafsd");
            test.findLocal("com.xinghe.wuye.SBCarParkLocalLocal") ;

            }catch(Exception e){e.printStackTrace() ;}

            }
            }

            • 3. properity file init.
              david Newbie

              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
              prefixes=org.jboss.naming;

              • 4. Sebastian help me.
                david Newbie

                my ejb-jar.xml and joss.xml whether right?
                ------ jboxx.xml-----------
                <enterprise-beans>

                <ejb-name>SBCarParkLocal</ejb-name>
                <jndi-name>com.xinghe.wuye.SBCarParkLocalLocal</jndi-name>
                <configuration-name></configuration-name>

                </enterprise-beans>

                ----------ejb-jar.xml----------
                <ejb-jar>
                <enterprise-beans>

                <ejb-name>SBCarParkLocal</ejb-name>
                <local-home>com.xinghe.wuye.SBCarParkLocalLocalHome</local-home>
                com.xinghe.wuye.SBCarParkLocalLocal
                <ejb-class>com.xinghe.wuye.SBCarParkLocalBean</ejb-class>
                <session-type>Stateless</session-type>
                <transaction-type>Bean</transaction-type>

                </enterprise-beans>
                <assembly-descriptor>
                <container-transaction>

                <ejb-name>SBCarParkLocal</ejb-name>
                <method-name>*</method-name>

                <trans-attribute>Required</trans-attribute>
                </container-transaction>
                </assembly-descriptor>
                </ejb-jar>

                • 5. Re: Sebastian help me.
                  Adrian Brock Master

                  java:comp/env can only be used inside the same
                  deployment. It is not accessible to a client.

                  From a client you need to use the global <jndi-name>
                  com.xinghe.wuye.SBCarParkLocalLocal

                  But then the local interface cannot be used outside
                  the virtual machine.

                  Regards,
                  Adrian

                  • 6. Re: Sebastian help me.
                    david Newbie

                    my client coding and ejb in same virtual machine
                    my *.xml is true?

                    • 7. Re: Sebastian help me.
                      Sebastian Hallensleben Newbie

                      Can't see any obvious mistakes in your deployment descriptors (there still might be some - I am fairly new to J2EE and JBoss myself).

                      As Adrian already pointed out, you need to use the global JNDI name for lookups from a client. Alternatively, you can also use the EJB name.

                      You may know this already - it is often quite useful to look at JBoss' JNDI browser at http://localhost:8082/InvokeAction//DefaultDomain%3Aservice%3DJNDIView/action=list?action=list&param0%2Bboolean=true

                      /Sebastian