6 Replies Latest reply on Nov 13, 2007 8:49 PM by victor tey

    ClassNotFoundException

    victor tey Newbie

      Hi i am currently following this tutorial
      http://www.netbeans.org/kb/articles/appclient-entappclient.html

      i am using netbean 5.5.1 bundle with jboss 4.0.4

      when i ran my main project it all works fine within the netbean IDE but when do a java -jar c:/blah/blah/test.jar i get a
      "Exception in thread "main" javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: ejb.Bean30Remote]

      i have included jbossall-client in the client

      Can someone please help me. i am really really desperate. i have posted this on numerous forum with no replys from anyone

        • 1. Re: ClassNotFoundException
          victor tey Newbie

          forgot to tick on notify me when a reply is posted :P

          • 2. Re: ClassNotFoundException
            jaikiran pai Master

             

            Exception in thread "main" javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: ejb.Bean30Remote]


            Looks like the ejb.Bean30Remote is not found in the classpath. You are using

            java -jar c:/blah/blah/test.jar


            Remember that the classpath is ignored when you run a jar file like this. You will have to make the classpath entries in the MANIFEST.MF file in the META-INF folder of the jar to make sure that the appropriate classes are picked up.
            Have a look at http://java.sun.com/docs/books/tutorial/deployment/jar/downman.html to see how you can add classes/jars to the jar's classpath through the manifest file

            • 3. Re: ClassNotFoundException
              victor tey Newbie

              seriously really thanks alot for the prompt reply. will give that a go right now.



              Sincerely grateful

              • 4. Re: ClassNotFoundException
                victor tey Newbie

                urhmm i thought netbean handles that when u clean and built the project
                the jars have been added to the project libraries

                in the library node of the project i have
                jbossall-client.jar
                EJBModule30-dist/EJBModule30.jar
                JDK 1.6 (Default)
                JBoss

                • 5. Re: ClassNotFoundException
                  jaikiran pai Master

                   

                  "linvicch" wrote:
                  urhmm i thought netbean handles that when u clean and built the project
                  the jars have been added to the project libraries

                  in the library node of the project i have
                  jbossall-client.jar
                  EJBModule30-dist/EJBModule30.jar
                  JDK 1.6 (Default)
                  JBoss


                  linvicch,

                  I am not familiar with NetBeans IDE so wont be able to comment on what's the right way to get this working in NetBeans.

                  On a different note, i would suggest using JDK1.5 instead of JDK 1.6 for JBoss (this may not have anything to do with the exception you are seeing). JBoss doesnt officially support JDK6 yet.

                  Can you post the output of the following:

                  - From the command prompt go to C:/blah/blah (the folder which contains your application's client jar)

                  - Run the following command

                  jar -tf test.jar


                  where test.jar is the name of the client jar file.

                  Post the output here.

                  Also post the contents of the MANIFEST.MF file present in the test.jar. Assuming that the test.jar is present in C:\blah\blah folder, where are the jbossall-client.jar and EJBModule30.jar files located?


                  • 6. Re: ClassNotFoundException
                    victor tey Newbie

                    hehe thanks for all the help :) so the problems lies with all my classpath problem.

                    i got around it by creating a normal project instead of a enterprise client app in netbean and it does pack all the libraries and jars in the dist folder

                    goign to google a bit on why it doesn't do that for a enterpriese client app

                    once again thanks alot