1 2 Previous Next 15 Replies Latest reply on Sep 29, 2009 7:32 AM by bodrin

    NoClassDefFound Exception from Sun AS 8.2 to JBM 1.4.0

      Hi JBM experts,

      I have recently posted a similar question and it was resolved with the help of PeterJ:

      http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4224375#4224375

      However, while the standalone java client works fine. I run into NoClassDefFound Exception again when using the same code on Sun AS 8:

      Caused by: java.lang.NoClassDefFoundError
      at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.createClient(ClientConnectionFactoryDelegate.java:298)
      at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.org$jboss$jms$client$delegate$ClientConnectionFactoryDelegate$getClientAOPStack$aop(ClientConnectionFactoryDelegate.java:228)
      at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.getClientAOPStack(ClientConnectionFactoryDelegate.java)
      at org.jboss.jms.client.delegate.ClientClusteredConnectionFactoryDelegate.org$jboss$jms$client$delegate$ClientClusteredConnectionFactoryDelegate$getClientAOPStack$aop(ClientClusteredConnectionFactoryDelegate.java:242)
      at org.jboss.jms.client.delegate.ClientClusteredConnectionFactoryDelegate.getClientAOPStack(ClientClusteredConnectionFactoryDelegate.java)
      at org.jboss.jms.client.ClientAOPStackLoader.load(ClientAOPStackLoader.java:75)
      at org.jboss.jms.client.JBossConnectionFactory.createConnectionInternal(JBossConnectionFactory.java:192)
      at org.jboss.jms.client.JBossConnectionFactory.createConnection(JBossConnectionFactory.java:87)
      at jmsremoteclient.TestMessageProducer.(TestMessageProducer.java:43)


      TestMessageProducer is the class where I try to initiate the connection to JBM. Obviously there may be class conflicts in the classpath...but the exception doesn't suggest the class name and therefore made it harder to debug. (I did included log4j.jar)

      Has anyone seem similar issue and have suggestions for the conflicting jar?

        • 1. Re: NoClassDefFound Exception from Sun AS 8.2 to JBM 1.4.0
          clebert.suconic

          Looking at the line code, it seems you're missing org.jboss.logging.Logger:


          298 @ one revison back> client = new Client(new InvokerLocator(serverLocatorURI), configuration);



          And I see a dependency from both Client and InvokerLocator to org.jboss.logging.Logger.


          That class is available at jboss-common.jar.


          I just found it by using a find:

          jboss-4.3.0.GA_CP03$ find . -name \*jar -exec unzip -l {} \; > list.txt

          • 2. Re: NoClassDefFound Exception from Sun AS 8.2 to JBM 1.4.0
            timfox

            Isn't that in jboss-all-client.jar?

            • 3. Re: NoClassDefFound Exception from Sun AS 8.2 to JBM 1.4.0
              clebert.suconic

              Yes.. it is.

              • 4. Re: NoClassDefFound Exception from Sun AS 8.2 to JBM 1.4.0
                clebert.suconic

                 

                "clebert.suconic@jboss.com" wrote:
                Yes.. it is.


                jboss-5 has deprecated jboss-all-client though.


                I'm not sure if dkuanwang is using JBAS 4 or 5

                • 5. Re: NoClassDefFound Exception from Sun AS 8.2 to JBM 1.4.0

                  Hi Clebert/Tim,

                  I did check the class dependencies and found all the classes in jboss-remoting.jar or jbossall-client.jar.

                  I have tried putting the jboss jars in Sun AS classpath perfix but the same exception happens:

                  /logicalhost/is/lib/jboss/jboss-aop.jar
                  /logicalhost/is/lib/jboss/jboss-remoting.jar
                  /logicalhost/is/lib/jboss/jbossall-client.jar
                  /logicalhost/is/lib/jboss/javassist.jar
                  /logicalhost/is/lib/jboss/jboss-mdr.jar
                  /logicalhost/is/lib/jboss/trove.jar
                  /logicalhost/is/lib/jboss/log4j.jar

                  I believe the JBAS version is 4.3.0 since all the Jars provided by the vendor is in 4.3.0. I will confirm it with the vendor. On the other hand, if JBAS 5 deprecated jbossall-client.jar, what jar should a client use instead of it?

                  • 6. Re: NoClassDefFound Exception from Sun AS 8.2 to JBM 1.4.0
                    clebert.suconic

                     

                    "dkuanwang" wrote:
                    Hi Clebert/Tim,

                    I did check the class dependencies and found all the classes in jboss-remoting.jar or jbossall-client.jar.

                    I have tried putting the jboss jars in Sun AS classpath perfix but the same exception happens:


                    I don't know how ClassLoader would work on SunOne/Gassfish/JavaApplicationServer/WhateverNameTheyAreUsingNow. I used to work with it years ago, and I remember being somewhat different in regard to hierarchies.. etc.

                    You have the JAR list you need to use, you just need to make sure the application will have access to those classes.


                    On the other hand, if JBAS 5 deprecated jbossall-client.jar, what jar should a client use instead of it?



                    jbossall-client.jar is an evil aggregation of jars. You will need to use the individual client jars from /jboss/client. I have changes the examples to make use of the correct jars, and we have documented the minimal set for JBM, but depending on the other EE features you use you may need to add more client jars. I would suggest looking at the JBossAS docs. (Or ask on the jbas forum if you still miss anything).

                    • 7. Re: NoClassDefFound Exception from Sun AS 8.2 to JBM 1.4.0
                      clebert.suconic

                       

                      I have tried putting the jboss jars in Sun AS classpath perfix but the same exception happens:


                      What about isolatin the classes on the EAR application?

                      I'm a little rusty now about this... I believe there is a place somewhere on /WEB-INF/classes... /EAR-whatever. don't know.. I would need to look at docs or hack other examples.. but I believe you got the idea of what I mean.

                      • 8. Re: NoClassDefFound Exception from Sun AS 8.2 to JBM 1.4.0
                        gaohoward

                        If Clebert is right about jbossall-client.jar being deprecated, then you shouldn't use that with your app. This is because the jbossall-client.jar (only from JBM perspect) contains JBM classes and may not be updated since it is deprecated.

                        • 9. Re: NoClassDefFound Exception from Sun AS 8.2 to JBM 1.4.0
                          clebert.suconic

                          jbossall-client.jar is deprecated after JBoss5 only.

                          The reasoning for the deprecation is this:

                          - Think about when a customer or user found a trivial bug. We then change the class and recompile it. Now we have to update at least two jars: -jboss-messaging.jar and jbossall-client.jar.

                          - Now think about another project doing the same.. say.. jboss-cache also found a bug, and updated jboss-all-client.jar.


                          If we send this customer both updates, you won' t know what version of jbossall-client you should use. It' s a mess.


                          That's why the jar was dropped after jboss5.


                          jbossall-client is still being "supported" on jboss4, however I really think it would be a good idea staying away from it for those reasons I pointed you.

                          • 10. Re: NoClassDefFound Exception from Sun AS 8.2 to JBM 1.4.0

                            I tried building the JBoss jars within EAR but same exception happens. :(

                            Since the JBAS I am trying to connect to is 4.2.2 and I have successfully connected to it with the standalone remote client, I am staying with the list of JARs in the previous post (including jbossall-client.jar). I am just curious what can be the class that's missing/conflicting giving the exception:

                            Caused by: java.lang.NoClassDefFoundError
                            at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.createClient(ClientConnectionFactoryDelegate.java:298)
                            at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.org$jboss$jms$client$delegate$ClientConnectionFactoryDelegate$getClientAOPStack$aop(ClientConnectionFactoryDelegate.java:228)
                            ....

                            Any pointer on how to debug such issue would be appreciated, too. (the verbose:class option didn't help me much) Thanks for your inputs!

                            -David

                            • 11. Re: NoClassDefFound Exception from Sun AS 8.2 to JBM 1.4.0
                              clebert.suconic

                               

                              Any pointer on how to debug such issue would be appreciated, too. (the verbose:class option didn't help me much) Thanks for your inputs!


                              The only thing I can think of is doing a real debug by attaching a debugger or looking a log4j.trace logs.


                              I would also look if Sun AS is setting Thread.currentClassLoader properly, as AOP is probably going to use that.

                              • 12. Re: NoClassDefFound Exception from Sun AS 8.2 to JBM 1.4.0

                                Thanks again for all your suggestions and help...I am able to narrow the problem down to org.jboss.remoting.InvokeLocator. Apparently when I try to instantiate this class, I will get a NoClassDefFound exception (without indicating what class is missing). I am able to create the org.jboss.logging.Logger object within my application but not the InvokeLocator.

                                What could be some of the dependencies for InvokeLocator other than jboss Logger?

                                • 13. Re: NoClassDefFound Exception from Sun AS 8.2 to JBM 1.4.0

                                  InvokerLocator (jboss-remoting.jar 2.2.2SP9) has the following code:

                                  static Class _mthclass$(String x0) {
                                  try{
                                  return Class.forName(x0);
                                  }
                                  catch(ClassNotFoundException x1){
                                  throw (new NoClassDefFoundError()).initCause(x1);
                                  }}

                                  I am guessing this is where the NoCalssDefFoundError exception is thrown. Any advise on resolving this issue?

                                  • 14. Re: NoClassDefFound Exception from Sun AS 8.2 to JBM 1.4.0

                                    Hi JBM experts:

                                    After change the security policy setting from

                                    permission java.util.PropertyPermission "*", "read";
                                    to
                                    permission java.util.PropertyPermission "*", "read,write";

                                    The NoClassDefFoundError is gone and now I am getting the following exception when trying to do:

                                    connection = connectionFactory.createConnection();

                                    org.jboss.jms.exception.MessagingNetworkFailureException: Failed to download and/or install client side AOP stack
                                    at
                                    org.jboss.jms.client.delegate.ClientClusteredConnectionFactoryDelegate.org$jboss$jms$client$delegate$ClientClusteredConnectionFactoryDelegate$getClientAOPStack$aopClientClusteredConnectionFactoryDelegate.java:250) at org.jboss.jms.client.delegate.ClientClusteredConnectionFactoryDelegate.getClientAOPStack(ClientClusteredConnectionFactoryDelegate.java)
                                    at org.jboss.jms.client.ClientAOPStackLoader.loadClientAOPStackLoader.java:75)
                                    at g.jboss.jms.client.JBossConnectionFactory.createConnectionInternal(JBossConnectionFactory.java:192)

                                    This exception is somewhat generic and therefore I am posting here to see if anyone can share some of the common cause for this exception.

                                    Again, thanks for those of you kindly share your knowledge and ideas.

                                    1 2 Previous Next