8 Replies Latest reply on Aug 28, 2002 12:57 AM by bbbear

    how to create ejb client jar

    mtags

      How do I create a ejb jar file for my client app to use.

      I have created a small app that has a stateless session bean and a client.

      I have successfully ran this on Sun's j2ee server after packaging it with deploytool.

      Now I want to run it on JBoss. How do I build my ejb client jar file, what needs to be in it?

      Using Jboss 3.0.0

        • 1. Re: how to create ejb client jar

          The jars under the /client directory of the JBoss distribution.

          -- Juha

          • 2. Re: how to create ejb client jar
            mtags

            Thanks for the reply, but what I am more concerned about is putting in stubs and skeletons and which ejb classes/interfaces I need to include.

            Do I need a stub for my EJB?
            Do I need a skeleton for my EJB?
            Do I need a Remote Interface?
            Do I need a Home Interface?
            Do I need the Bean Class?
            Do I need jndi.properties?
            Do I need ejb-jar.xml in my META-INF?
            Do I need jboss.xml in my META-INF?
            Do I need jbosscmp-jdbc.xml in my META-INF if I where using a Entity Bean?

            Thanks

            • 3. Re: how to create ejb client jar

              > Do I need a stub for my EJB?

              no

              > Do I need a skeleton for my EJB?

              no

              > Do I need a Remote Interface?

              yes

              > Do I need a Home Interface?

              yes

              > Do I need the Bean Class?

              no

              > Do I need jndi.properties?

              yes

              > Do I need ejb-jar.xml in my META-INF?

              no

              > Do I need jboss.xml in my META-INF?

              no

              > Do I need jbosscmp-jdbc.xml in my META-INF if I where
              > using a Entity Bean?

              no

              -- Juha

              • 4. Re: how to create ejb client jar
                bbbear

                Good day,

                I have been searching from forum to forum for ways to run an ejb client, however, it seems to be in vain. I'm in need of help! I have this problem when I tried to run the client. What I understand is, I need to package the interface files of the EJB, the client, and a manifest file into a jar. I'm using JBoss2.4.4_Tomcat4.0.3, and deployed the jar file under /servers/jboss/client/ directory. Below is how I run my client. Have I missed anything?

                C:\servers\jboss\client>java -jar SmtFrame.jar com.si.sys.main.SmtFrame.class

                Exception in thread "main" java.lang.NoClassDefFoundError: javax/ejb/EJBHome
                at java.lang.ClassLoader.defineClass0(Native Method)
                at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
                at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
                at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
                at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
                at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
                at java.security.AccessController.doPrivileged(Native Method)
                at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
                at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
                at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
                at java.lang.Class.forName0(Native Method)
                at java.lang.Class.forName(Class.java:120)
                at com.si.con.ConMain.class$(Unknown Source)
                at com.si.con.ConMain.(Unknown Source)
                at com.si.con.ConMain.getInstance(Unknown Source)
                at com.si.sys.main.SmtFrame.(Unknown Source)
                at com.si.sys.main.SmtFrame.main(Unknown Source)

                ----------------------------------------------
                My Manifest.mf contents:

                Manifest-Version: 1.0
                Created-By: Karen
                Main-Class: com.si.sys.main.SmtFrame

                ----------------------------------------------

                TIA,
                Karen

                • 5. Re: how to create ejb client jar
                  bbbear

                  Good day,

                  I have been searching from forum to forum for ways to run an ejb client, however, it seems to be in vain. I'm in need of help! I have this problem when I tried to run the client. What I understand is, I need to package the interface files of the EJB, the client, and a manifest file into a jar. I'm using JBoss2.4.4_Tomcat4.0.3, and deployed the jar file under /servers/jboss/client/ directory. Below is how I run my client. Have I missed anything?

                  C:\servers\jboss\client>java -jar SmtFrame.jar com.si.sys..main.SmtFrame.class

                  Exception in thread "main" java.lang.NoClassDefFoundError: javax/ejb/EJBHome
                  at java.lang.ClassLoader.defineClass0(Native Method)
                  at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
                  at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
                  at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
                  at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
                  at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
                  at java.security.AccessController.doPrivileged(Native Method)
                  at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
                  at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
                  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
                  at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
                  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
                  at java.lang.Class.forName0(Native Method)
                  at java.lang.Class.forName(Class.java:120)
                  at com.si.con.ConMain.class$(Unknown Source)
                  at com.si.con.ConMain.(Unknown Source)
                  at com.si.con.ConMain.getInstance(Unknown Source)
                  at com.si.sys.main.SmtFrame.(Unknown Source)
                  at com.si.sys.main.SmtFrame.main(Unknown Source)

                  ----------------------------------------------
                  My Manifest.mf contents:

                  Manifest-Version: 1.0
                  Created-By: Karen
                  Main-Class: com.si.sys.main.SmtFrame

                  ----------------------------------------------

                  TIA,
                  Karen

                  • 6. Re: how to create ejb client jar
                    joelvogt

                    do you have the jboss client jars on your classpath for your client? From the error message it appears not

                    • 7. Re: how to create ejb client jar
                      bbbear

                      Good day,

                      I have added the jars in my classpath, however, I'd still get the same error.

                      Here's what I want to do, I have a client application that sits outside of the JBoss server. It needs to reference to an EJB that sits inside the JBoss server.

                      Here's how I test, I open 2 command prompt windows, one is to start the JBoss server, the other is to run the client. I set the classpath on both command prompts before I start doing anything. After I start the JBoss server in one of the consoles, I run the client app in another command prompt window. The run command is as my previous post stated, using "java -jar". But it gives me the "Exception in thread "main" java.lang.NoClassDefFoundError". I'm kinda confuse of what to look into now.

                      Here's my jndi.properties content:

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

                      What else I should look into? I'm not sure if this is the correct way to test a client application that sits outside of the JBoss server as I'm still new to JBoss. Some shed of lights are much appreciated!

                      TIA,
                      Karen

                      • 8. Re: how to create ejb client jar
                        bbbear

                        Hi,

                        I have this error after I've included the jndi.properties file in the client jar. Below is the output:

                        C:\servers\jboss\client>java -jar SmtFrame.jar com.si.sys.main.SmtFrame.class
                        Exception in thread "main" com.si.sys.gen.SiRuntimeException: Problem getting reference to SysConMainSess.: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory;
                        ---> nested javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
                        at com.si.con.SysConMain.(Unknown Source)
                        at com.si.con.SysConMain.getInstance(Unknown Source)
                        at com.si.sys.main.SmtFrame.(Unknown Source)
                        at com.si.sys.maint.SmtFrame.main(Unknown Source)

                        Any idea? Should I or should I not to add the jndi.properties in the jar?

                        Regards,
                        Karen