5 Replies Latest reply on Feb 7, 2005 3:18 AM by Mario Laubscher

    Deploying EJB Problems

    Chandru Mp Newbie

      Hello, I downloaded jboss-4.0.1RC1 zip module. After installing it and running it I verified the Jboss with http://localhost:8080/ in the explorer on my IBM PC running XP. It does bring me to Jboss web page which tells me that installation is successful. I tried with 3 simple classes and an ejb-xml.jar. Packaged it by creating a jar of those three classes and ejb-jar.xml also created META-INF directory and placed ejb-jar.xml in it. I copied the packaged jar in server/default/deploy directory. I don?t see any thing on the Jboss server screen for accepting the ejb and launching the ejb. It still says started 00m.00s.00ms. But when I tried to delete the pacakaged jar from the deploy directory Jboss server says ejb will be deleted next time the server starts. I am not connected to the internet but am within my network. I can ping the machine.

      I wish that start guide gave a simpler example without ant. Other suggestion would be to provide a test ejb that we could verify the operation of the Jboss itself.

      Please help me in identifying the problem.

        • 1. Re: Deploying EJB Problems
          Mario Laubscher Newbie

          Hi
          Did you also define a jboss.xml file in you META-INF directory next to the ejb-jar.xml?

          Maybe for a starting-point the JBoss-IDE provides a good sample EAR-Application:
          http://sf.gds.tuwien.ac.at/j/jb/jboss/Tutorial-1.3.0.pdf

          • 2. Re: Deploying EJB Problems
            Chandru Mp Newbie

            Hi mario202,

            Yes I tried with Jboss.xml too. Still the problem is same. Here what I am doing.

            Microsoft Windows XP [Version 5.1.2600]
            Microsoft Windows XP [Version 5.1.2600]
            (C) Copyright 1985-2001 Microsoft Corp.


            C:\>javac -classpath C:\jboss-4.0.1\server\default\lib\jboss-j2ee.jar Simple.java

            C:\>javac -classpath C:\jboss-4.0.1\server\default\lib\jboss-j2ee.jar;. SimpleHome.java

            C:\>javac -classpath C:\jboss-4.0.1\server\default\lib\jboss-j2ee.jar;. SimpleBean.java

            C:\>jar cfv Simple.jar \META-INF\

            C:\>jar cfv Simple.jar Simple.class SimpleHome.class SimpleBean.class C:\META-INF\
            added manifest
            adding: Simple.class(in = 217) (out= 171)(deflated 21%)
            adding: SimpleHome.class(in = 242) (out= 177)(deflated 26%)
            adding: SimpleBean.class(in = 1096) (out= 566)(deflated 48%)
            adding: C:/META-INF/(in = 0) (out= 0)(stored 0%)
            adding: C:/META-INF/ejb-jar.xml(in = 489) (out= 226)(deflated 53%)

            C:\>jar tf simple.jar
            META-INF/
            META-INF/MANIFEST.MF
            Simple.class
            SimpleHome.class
            SimpleBean.class
            C:/META-INF/
            C:/META-INF/ejb-jar.xml

            After compiling and Jaring The directory and files looks like this

            C:\>dir Simple*.*
            Volume in drive C has no label.
            Volume Serial Number is 148B-EBDE

            Directory of C:\

            01/28/2005 04:53 AM 217 Simple.class
            01/28/2005 04:56 AM 2,087 Simple.jar
            01/27/2005 11:25 PM 144 Simple.java
            01/28/2005 04:53 AM 1,096 SimpleBean.class
            01/27/2005 11:25 PM 848 SimpleBean.java
            01/28/2005 04:53 AM 242 SimpleHome.class
            01/27/2005 11:25 PM 221 SimpleHome.java
            7 File(s) 4,855 bytes
            0 Dir(s) 13,099,388,928 bytes free

            C:\>cd meta-inf

            C:\META-INF>dir /p
            Volume in drive C has no label.
            Volume Serial Number is 148B-EBDE

            Directory of C:\META-INF

            01/27/2005 11:27 PM .
            01/27/2005 11:27 PM ..
            01/27/2005 11:27 PM 489 ejb-jar.xml
            01/28/2005 10:02 AM 291 jboss.xml
            2 File(s) 780 bytes
            2 Dir(s) 13,095,940,096 bytes free

            C:\META-INF>


            Souce Code Listings

            Simple.java looks like this

            +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
            import java.rmi.*;
            import javax.ejb.*;

            public interface Simple extends EJBObject {
            public String getMessage() throws RemoteException;
            }
            ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




            SimpleBean.java looks like this

            ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
            import java.rmi.*;
            import javax.ejb.*;

            public class SimpleBean implements SessionBean {
            private SessionContext context;
            private int SaidCount = 0;
            // This is the business method.
            public String getMessage() throws RemoteException {
            String thisMessage = ++SaidCount + ": EJB SimpleBean - Yahoo!";
            return thisMessage;
            }
            // These are the callback methods, which come from the
            // SessionBean interface.
            public void ejbCreate() throws RemoteException, CreateException {
            }
            public void ejbRemove() throws RemoteException {
            }
            public void ejbActivate() throws RemoteException {
            }
            public void ejbPassivate() throws RemoteException {
            }

            // Set the context variable
            public void setSessionContext(SessionContext context) throws RemoteException {
            this.context = context;
            }
            }

            ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



            SimpleHome.java code looks like this

            ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
            import java.rmi.*;
            import javax.ejb.*;

            public interface SimpleHome extends EJBHome {
            // create returns Simple, which is the remote interface.
            public Simple create() throws RemoteException, CreateException;

            }

            ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




            ejb-jar.xml looks like this

            ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
            <?xml version="1.0" encoding="UTF-8"?>

            <ejb-jar>
            MPs First EJB
            <display-name>SimpleEJB</display-name>
            <enterprise-beans>

            <ejb-name>Simple</ejb-name>
            SimpleHome
            Simple
            <ejb-class>SimpleBean</ejb-class>
            <session-type>Stateless</session-type>
            <transaction-type>Container</transaction-type>

            </enterprise-beans>
            </ejb-jar>
            +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



            jboss.xml looks like this

            +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

            <?xml version='1.0' encoding='UTF-8' ?>
            <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN"
            "http://www.jboss.org/j2ee/dtd/jboss.dtd">

            <enterprise-beans>

            <ejb-name>Simple</ejb-name>
            <jndi-name>Simple</jndi-name>

            </enterprise-beans>


            +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

            • 3. Re: Deploying EJB Problems
              Mario Laubscher Newbie

              Hi

              I have shortly tried to deploy your sources and have found the following error:

              09:12:36,542 ERROR [MainDeployer] could not create deployment: file:/C:/projects/java/jboss-4.0.0/server/monex/deploy/Simple.jar
              org.jboss.deployment.DeploymentException: ejb-jar.xml must either obey the right xml schema or define a valid DOCTYPE!
              

              I have updated you ejb-jar.xml as the following
              <?xml version="1.0" encoding="UTF-8"?>
              <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
              
              <ejb-jar>
              MPs First EJB
              <display-name>SimpleEJB</display-name>
              <enterprise-beans>
              
              <ejb-name>Simple</ejb-name>
              SimpleHome
              Simple
              <ejb-class>SimpleBean</ejb-class>
              <session-type>Stateless</session-type>
              <transaction-type>Container</transaction-type>
              
              </enterprise-beans>
              </ejb-jar>
              


              Now on my installation it works!
              09:14:23,376 INFO [EJBDeployer] Deployed: file:/C:/projects/java/jboss-4.0.0/server/monex/deploy/Simple.jar
              



              • 4. Re: Deploying EJB Problems
                Chandru Mp Newbie

                Hello Mario202

                Thanks again for the help. I tried with the new ejb-jar.xml It does not help. I don't even get any errors at all. Strange! But when I do the http:/127.0.0.1:8080 it does bring up the Jboss web page. Also I am using run -c all under bin directory to run the Jboss after placing the simple.jar file in server/all/deploy directory.

                • 5. Re: Deploying EJB Problems
                  Mario Laubscher Newbie

                  Hi

                  I have sent you an email to "digitalkid@opnsrc.com" with my Simple.jar file. I suggest you to try it and if it not works re-install JBoss.

                  Cheers, Mario