1 2 Previous Next 15 Replies Latest reply on Nov 3, 2006 4:01 PM by Sue

    Tutorial

    sophie.dog Newbie

      For any JBoss newbie who, like me, has given up with the Getting Started / Quck Start documentation:

      http://www.dsg.cs.tcd.ie/~dowlingj/teaching/ds/tutorials/ejb/jboss_3_intro.htm

      This is a very simple tutorial, just to get your first Session bean up and running. It works with JBoss 3.2.1.



        • 1. Re: Tutorial
          Binu N Kavumkal Newbie

          Thanks a lot Sophie

          Regards,
          Binu

          • 2. Problems....naturally!
            darrinps Newbie

            First off, thanks for the tutorial!

            Now, as to my problem...

            I am trying to use this tutorial using JBoss 4.0. I got to the point (with a minor tweak to the tutorial here and there) of running the client, but when I do this:

            java ie.tcd.cs.ejb_example.HelloWorldClient

            I get this:

            C:\jboss-4.0.0DR2\Projects\Hello>java ie.tcd.cs.ejb_example.HelloWorldClient
            javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interf
            aces.NamingContextFactory. Root exception is java.lang.ClassNotFoundException:
            org.jnp.interfaces.NamingContextFactory
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClassInternal(Unknown Source)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Unknown Source)
            at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
            at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
            at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
            at javax.naming.InitialContext.init(Unknown Source)
            at javax.naming.InitialContext.(Unknown Source)
            at ie.tcd.cs.ejb_example.HelloWorldClient.main(HelloWorldClient.java:21)

            Exception: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory


            Here is what my classpath looks like (just in case it is helpful in solving this):

            .;C:\Program Files\Altova\xmlspy\XMLSpyInterface.jar;%JAVA_HOME%\jre\lib;%ANT_HOME%\lib\ant.jar;%JBOSS_HOME%\server\all\lib\jboss-j2ee.jar;%JBOSS_HOME%\log4j.jar;%JBOSS_HOME%\jboss-common-client.jar;%JBOSS_HOME%\jboss-system-client.jar;%JBOSS_HOME%\jnp-client.jar;%JBOSS_HOME%\jboss-client.jar;%JBOSS_HOME%\jbosssx-client.jar;%JBOSS_HOME%\Projects\Hello\HelloWorld.jar

            Any ideas?

            Thanks!

            • 3. Re: Problems....naturally!
              Gavin Lang Newbie

              worked for me with the following two jars in my classpath:
              $JBOSS_HOME/client/jbossall-client.jar
              $JBOSS_HOME/server/default/lib/jboss-j2ee.jar

              I have experienced problems with environment settings on Win2K & XP. Maybe put your jars in a dir with no spaces?

              • 4. Re: Problems....naturally!
                darrinps Newbie

                That didn't do it, but I appreciate the effort.

                I think I'll try creating an application descriptor and see if that will work.

                Very frustrating...

                • 5. Re: Problems....naturally!
                  darrinps Newbie

                  Spoke too soon!

                  I had a typo in my classpath.

                  Now I get the initialcontext but I still get an error and this one I cannot find anywhere on the Internet.

                  Anyone know why I might get this?


                  C:\jboss-4.0.0DR2\Projects\Hello>java ie.tcd.cs.ejb_example.HelloWorldClient
                  Creating initial context
                  Looking up HelloWorld
                  Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/tm/JBossTra
                  nsactionRolledbackLocalException
                  at java.lang.Class.getDeclaredFields0(Native Method)
                  at java.lang.Class.privateGetDeclaredFields(Unknown Source)
                  at java.lang.Class.getField0(Unknown Source)
                  at java.lang.Class.getDeclaredField(Unknown Source)
                  at java.io.ObjectStreamClass.getDeclaredSUID(Unknown Source)
                  at java.io.ObjectStreamClass.access$400(Unknown Source)
                  at java.io.ObjectStreamClass$3.run(Unknown Source)
                  at java.security.AccessController.doPrivileged(Native Method)
                  at java.io.ObjectStreamClass.(Unknown Source)
                  at java.io.ObjectStreamClass.lookup(Unknown Source)
                  at java.io.ObjectStreamClass.initNonProxy(Unknown Source)
                  at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
                  at java.io.ObjectInputStream.readClassDesc(Unknown Source)
                  at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
                  at java.io.ObjectInputStream.readClassDesc(Unknown Source)
                  at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
                  at java.io.ObjectInputStream.readObject0(Unknown Source)
                  at java.io.ObjectInputStream.readObject(Unknown Source)
                  at java.util.HashMap.readObject(Unknown Source)
                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                  at java.lang.reflect.Method.invoke(Unknown Source)
                  at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
                  at java.io.ObjectInputStream.readSerialData(Unknown Source)
                  at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
                  at java.io.ObjectInputStream.readObject0(Unknown Source)
                  at java.io.ObjectInputStream.readObject(Unknown Source)
                  at java.util.HashMap.readObject(Unknown Source)
                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                  at java.lang.reflect.Method.invoke(Unknown Source)
                  at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
                  at java.io.ObjectInputStream.readSerialData(Unknown Source)
                  at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
                  at java.io.ObjectInputStream.readObject0(Unknown Source)
                  at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
                  at java.io.ObjectInputStream.readSerialData(Unknown Source)
                  at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
                  at java.io.ObjectInputStream.readObject0(Unknown Source)
                  at java.io.ObjectInputStream.readObject(Unknown Source)
                  at org.jboss.proxy.ClientContainer.readExternal(ClientContainer.java:113
                  )
                  at java.io.ObjectInputStream.readExternalData(Unknown Source)
                  at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
                  at java.io.ObjectInputStream.readObject0(Unknown Source)
                  at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
                  at java.io.ObjectInputStream.readSerialData(Unknown Source)
                  at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
                  at java.io.ObjectInputStream.readObject0(Unknown Source)
                  at java.io.ObjectInputStream.readObject(Unknown Source)
                  at java.rmi.MarshalledObject.get(Unknown Source)
                  at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:3
                  0)
                  at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:522)
                  at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:479)
                  at javax.naming.InitialContext.lookup(Unknown Source)
                  at ie.tcd.cs.ejb_example.HelloWorldClient.main(HelloWorldClient.java:27)

                  • 6. Re: Tutorial
                    mancocapac Newbie

                    sophie,

                    I downloaded jboss-3.2.1_tomcat-4.1.24
                    I am running jdk1.4.1_03

                    i ran run.bat and got :
                    ...
                    20:03:51,403 INFO [Server] JBoss (MX MicroKernel) [3.2.1 (build: CVSTag=JBoss_3_2_1 date=200305041533)] Started in 30s:163ms

                    But I don't get anything at http://localhost:8082/

                    I do get a response from Tomcat when I try:

                    http://localhost:8080 -
                    HTTP Status 500 - No Context configured to process
                    this request
                    ...
                    Apache Tomcat/4.1.24-LE-jdk14

                    >> So Tomcat is up

                    run.bat produced some [WARN]s for MainDeployer
                    20:03:28,470 WARN [MainDeployer]
                    The manifest entry in
                    file:/C:/Latte/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/jbossweb-tomcat.sar/tomcat-util.jar
                    references URL
                    file:/C:/Latte/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/jbossweb-tomcat.sar/log4j.jar
                    which could not be opened, entry ignored
                    20:03:28,470 WARN [MainDeployer]
                    The manifest entry in
                    file:/C:/Latte/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/jbossweb-tomcat.sar/tomcat-util.jar
                    references URL
                    file:/C:/Latte/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/jbossweb-tomcat.sar/log4j-core.jar
                    which could not be opened, entry ignored
                    20:03:28,470 WARN [MainDeployer]
                    The manifest entry in
                    file:/C:/Latte/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/jbossweb-tomcat.sar/tomcat-util.jar
                    references URL
                    file:/C:/Latte/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/jbossweb-tomcat.sar/mx4j.jar
                    which could not be opened, entry ignored
                    20:03:28,881 WARN [MainDeployer]
                    The manifest entry in
                    file:/C:/Latte/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/jbossweb-tomcat.sar/commons-logging.jar
                    references URL
                    file:/C:/Latte/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/jbossweb-tomcat.sar/log4j.jar
                    which could not be opened, entry ignored
                    20:03:28,881 WARN [MainDeployer]
                    The manifest entry in
                    file:/C:/Latte/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/jbossweb-tomcat.sar/commons-logging.jar
                    references URL
                    file:/C:/Latte/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/jbossweb-tomcat.sar/log4j-core.jar
                    which could not be opened, entry ignored
                    20:03:29,041 WARN [MainDeployer]
                    The manifest entry in file:/C:/Latte/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/jbossweb-tomcat.sar/tomcat-jk2.jar
                    references URL
                    file:/C:/Latte/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/jbossweb-tomcat.sar/workers.jar
                    which could not be opened, entry ignored
                    20:03:29,041 WARN [MainDeployer]
                    The manifest entry in
                    file:/C:/Latte/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/jbossweb-tomcat.sar/tomcat-jk2.jar
                    references URL
                    file:/C:/Latte/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/classes/
                    which could not be opened, entry ignored
                    20:03:29,041 WARN [MainDeployer]
                    The manifest entry in
                    file:/C:/Latte/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/jbossweb-tomcat.sar/tomcat-jk2.jar
                    references URL
                    file:/C:/Latte/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/jbossweb-tomcat.sar/log4j.jar
                    which could not be opened, entry ignored
                    20:03:29,101 WARN [MainDeployer]
                    The manifest entry in
                    file:/C:/Latte/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/jbossweb-tomcat.sar/bootstrap.jar
                    references URL
                    file:/C:/Latte/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/jbossweb-tomcat.sar/commons-daemon.jar
                    which could not be opened, entry ignored

                    Of these the only jar file I was able to find was the
                    log4j.jar in the ...\server\default\lib dir


                    >>> Any thoughts on how I could get past this
                    would be great

                    Thanks,
                    Manco

                    • 7. Re: Tutorial
                      mancocapac Newbie

                      Sophie,

                      The Distributed Systems: Introduction to JBoss
                      needs one modification. To bring up the Agent View
                      the user needs to point to :

                      http://<machine-name-or-ip-address>:8080/jmx-console
                      If you are running JBoss in a single PC - http://localhost:8080/jmx-console

                      NOT http://localhost:8082 as the doc suggests.

                      I am on to the next step.

                      Thanks,
                      manco

                      PS: I got this from :
                      http://www.jdiscuss.com/Enthuse/jsp/ViewPosts.jsp?forumid=31&topicid=11

                      • 8. Author
                        sophie.dog Newbie

                        To give credit where it is due, I didn't write the tutorial,
                        I simply found it on the net. It was written by Jim Dowling at the University of Dublin in Ireland.

                        • 9. Re: Author
                          vvp Newbie

                          MasteringEJB2.pdf is even better, very clear and well written.

                          Can be found for example in:
                          http://coweb.cc.gatech.edu/squeakers/10

                          • 10. Re: Author
                            Vishal Sharma Expert

                            If you want to go further then then check this thread.
                            http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=

                            • 11. Re: Tutorial
                              camale Newbie

                              sophie.dog,Thank you very much!

                              I am a newer in EJB,and I looked for JBoss Doc for servral days,So Thank you very much again.

                              • 12. Re: Tutorial
                                ejbnewbie Newbie

                                Hi everyone-
                                i have one more tutorial in JBoss-3.2.1 w/ Oracle 9i, not much, just a simple one-one Entity Bean relationship, with stateless Session Beans, JSPs, Webworks. the link to the thread is
                                http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t= you find it useful

                                peace

                                -ejbnewbie

                                • 13. Re: Tutorial
                                  Sue Newbie

                                  how do i set the CATALINA_HOME for the built in Tomat within JBoss
                                  is it C:\jboss\server\default\deploy\jbossweb-tomcat55.sar

                                  • 14. Re: Tutorial
                                    Sujeet Banerjee Newbie

                                    @johnybravo2004

                                    Well, you dont need to set the CATALINA_HOME.

                                    Make sure that your JBOSS_HOME and JAVA_HOME are set correctly.

                                    1 2 Previous Next