12 Replies Latest reply on Aug 21, 2003 2:08 PM by raja05

    Newbie - NoClassDefFound POJO

    raja05

      Im trying to run the first example from the Oreilly AOP example.
      Compiled my classes and run it as

      java -Djava.system.class.loader=org.jboss.aop.standalone.SystemClassLoader POJO

      Gives me a
      Exception in thread main:NoClassDefFoundError: POJO

      My class files and java files are both in a

      c:\jbossaop\oreilly\examples1 directory and i run it from the same directory. I do set the classpath before this and include "." along with Classpath. Not sure why i get this error.

      If i change teh jboss-aop.xml to apply the interceptor to POJO1(Which doesnt exist), i get the "Hello World" output as expected., but if its POJO, i get this error

      Help!!

      TIA
      Raj

        • 1. Re: I bought Advanced Docs, how to I get updates?
          raja05

          Try emailing

          support@ComponentSource.com

          with your original purchase details. They havn't replied to my email on 26th May, but they were fairly good at getting me the April link !

          • 2. Re: Newbie - NoClassDefFound POJO
            raja05

            Is there something with the JDK Version? I tried this on jdk1.4.1_02 and got the error i reported earlier

            If i set the JAVA_HOME to be jdk1.3.1_07, id ont get any errors but the interceptors dont get applied. Is there a specific VM thats suited for this?

            -Raj

            • 3. Re: Newbie - NoClassDefFound POJO
              raja05

              Has anyone hd success running this? I definitely cannot run it with JDK1.4.1_02.

              As for JDK1.3, the java.system.class.loader cannot be used(not a standard property), so it doesnt use this classloader but uses the standard Classloader and runs my code without running thru the interceptor

              • 4. Re: Newbie - NoClassDefFound POJO
                safx

                I keep getting the same problem on WindowsXP, JDK 1.4.2. If I don't set the classloader to the JBoss-specific classloader, I see "Hello World!" printed, but if I try to use the stand alone JBoss AOP class loader, I keep getting NoClassDefFound.

                Really strange. It seems as though it would easy to run the examples, but it's been a pain in my a$$.

                SAF

                • 5. Re: Newbie - NoClassDefFound POJO
                  adegbile


                  This are the steps carried out in eclipse today and it work fine.

                  1 Define a new project in my case aop

                  2 Define the source to the directory of the source based on your installation of the examples in my case example3

                  3 Add the following to the java build path
                  javassist.jar
                  jboss-common.jar
                  jboss-aop.jar

                  4 My j2jdk was 1.4.2

                  5 Add the following to launch you Pojo class VM arguments option
                  -Djava.system.class.loader=org.jboss.aop.standalone.SystemClassLoader
                  6 Then run the progarm

                  Hope this helps

                  • 6. Re: Newbie - NoClassDefFound POJO
                    raja05

                    Hi
                    I tried the same thing except (1) Used IDEA (Which shouldnt matter) and
                    2) used jdk1.4.1_01, 1.4.1_02 and 1.4.1_03

                    If possible, can you try if it works on 1.4.1? Has someone made this work on 1.4.1?

                    Also did you put the classes in a package or did u just use the source from the download? I hvae tried bothways and the result is the same - NoClssDefFound

                    Ill try it on 1.4.2

                    Thanks
                    Raj

                    • 7. Re: Newbie - NoClassDefFound POJO
                      mschoning

                      That doesn't work for me. I also use eclipse (2.1) and jdk 1.4.2.

                      Following those instruction, there is no attempt to load the class POJO.

                      But if I change the arguments to the vm (step 5) like this:
                      -Djava.system.class.loader=org.jboss.aop.standalone.SystemClassLoader POJO

                      Then I get a class not fond on org.jboss.aop.standalone.SystemClassLoader

                      The only way I was able to resolve that. Was to unpack javassist.jar, jboss-common.jar and jboss-aop.jar
                      Into my bin directory for the project in eclipse.
                      (I put my compiled classes in a bin directory under my project i.e. project-directory/bin)

                      Now it works, not nice but atleast now I can play around JBoss AOP.

                      good luck, Michael

                      • 8. Re: Newbie - NoClassDefFound POJO
                        mschoning

                        I'm sorry I forgot to mention 2 important steps
                        the classloader I use is :
                        -Djava.system.class.loader=org.jboss.aop.StandaloneClassLoader POJO

                        Not the one mentioned in the documentation (i have downlaoded the standalone version for JBoss AOP)

                        Also I have to set the working directory in eclipse to
                        my bin directory

                        I think that's it.

                        - Michael

                        • 9. Re: Newbie - NoClassDefFound POJO
                          adegbile

                          This is the setup on windows that work without an IDE

                          DirectoryStructure
                          Orielly-aop\example3\Run.bat

                          This is the content of the Run.bat

                          set JAVA_HOME=d:\j2sdk1.4.2
                          set CPATH=.;jboss-common.jar;jboss-aop.jar;javassist.jar
                          d:\j2sdk1.4.2\bin\javac -classpath %CPATH% -g *.java

                          pause

                          d:\j2sdk1.4.2\bin\java -classpath %CPATH% -Djava.system.class.loader=org.jboss.aop.standalone.SystemClassLoader POJO

                          pause

                          The content of the example3 in my case is all the example3 source , extra jar files(jboss-common.jar;jboss-aop.jar;javassist.jar) and a subdirectory Meta-inf which contains jboss-aop.xml

                          Regards
                          Adeyemi E Adegbile






                          • 10. Re: Newbie - NoClassDefFound POJO
                            adegbile

                            Hi Raj,

                            Check that you are running the correct example. There are currently three examples
                            one
                            two
                            three.
                            Each have different configuration and code.

                            I have just retested all the examples and they are working as I described earlier.
                            Based on the output you described, it seems as if you are running example one.

                            Kind Regards
                            Adeyemi E Adegbile

                            • 11. Re: Newbie - NoClassDefFound POJO
                              guest55

                              I've found that JBoss AOP requires trove.jar to be present on classpath. Otherwise it throws noclassfound error. After adding it to classpath all examples start working.

                              • 12. Re: Newbie - NoClassDefFound POJO
                                raja05

                                Yeah, thats it. I just got it working, Thanks guest55