1 2 Previous Next 20 Replies Latest reply on Nov 26, 2008 3:38 AM by beve

    ClassNotFoundException again

      Hi,

      sortof an old problem but a bit different.

      Again, an RCP client and JbossESB. Now, we don't use any JMS, only ESB. An exception is thrown at initialisation of ServiceInvoker

      java.lang.NullPointerException
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Unknown Source)
      at org.jboss.soa.esb.util.ClassUtil.forName(ClassUtil.java:65)
      at org.jboss.soa.esb.services.registry.RegistryFactory.createRegistry(RegistryFactory.java:69)
      at org.jboss.soa.esb.services.registry.RegistryFactory.getRegistry(RegistryFactory.java:56)
      at org.jboss.soa.esb.listeners.RegistryUtil.getEprs(RegistryUtil.java:220)
      at org.jboss.soa.esb.client.ServiceInvoker.loadServiceClusterInfo(ServiceInvoker.java:428)
      at org.jboss.soa.esb.client.ServiceInvoker.(ServiceInvoker.java:155)
      at org.jboss.soa.esb.client.ServiceInvoker.(ServiceInvoker.java:136)
      at org.jboss.soa.esb.client.ServiceInvoker.(ServiceInvoker.java:178)
      at com.auguris.haruspex.test.MessageUtil$MessageThread.run(MessageUtil.java:248)
      at java.lang.Thread.run(Unknown Source)
      15:15:11,765 ERROR [MessageUtil] Invocation exception. null

      The code at "MessageUtil.java:248" is ServiceInvoker invoker = new ServiceInvoker( category, service ); where category and service are Strings and are not empty.

      The class is in the jbossesb-rosetta.jar which is in the class path. Any suggestions? :)

        • 1. Re: ClassNotFoundException again
          beve

          Hi,

          can you check that you have a jbossesb-properties.xml file located in the classpath?

          Regards,

          /Daniel

          • 2. Re: ClassNotFoundException again

            Sure, it's right there. :) Along with jbossesb-listener.xml, jbossesb-gateway.xml, jboss-esb.xml and several others.

            • 3. Re: ClassNotFoundException again
              beve

              The error points to that the property 'org.jboss.soa.esb.registry.implementationClass' does not exist in the jbossesb-properties.xml file, or that the properties file itself is not in located on the classpath.
              Can you double check that the above property exists and just make sure that the file is available.

              I can reproduce this by using the helloworld quickstart and simply deleting the jbossesb-properties.xml file. You might be able to check you configuration against the quickstart and see if anything differs.

              Regards,

              /Daniel

              • 4. Re: ClassNotFoundException again

                The point is clear. The file is, well, available, that is, the directory with it is included in the class path (i. e. on the Runtime tab of plugin.xml or simply put in the MANIFEST.MF). The property is in the file, too. For some strange reason, the product doesn't find the file, however. I did experiment, too - I removed the file and obtained the same results.

                • 5. Re: ClassNotFoundException again
                  beve

                  Hmm, strange. Would you be able to send me this so that I can run your example?

                  Thanks,

                  /Daniel

                  • 6. Re: ClassNotFoundException again

                    Well, two things.
                    1) it's some 15 MB big (with jars);
                    2) it has several user libraries that point to different folders which you may not happen to have.

                    If you'd like to check the code and plugin.xml I could strip the project.

                    • 7. Re: ClassNotFoundException again
                      beve

                       

                      If you'd like to check the code and plugin.xml I could strip the project.

                      That would be great. Please do that and I'll take a look.



                      • 8. Re: ClassNotFoundException again

                        The code can be downloaded http://www.zshare.net/download/20328417eed5d557/. It's not the actual project but I copied all necessary stuff in there. The functionality needed is envoked by clicking the envelope icon in the toolbar (MessagePopupAction.java). All files in newtest.test are left intact, i. e. as they are in the actual project. The error is reproduced.

                        • 9. Re: ClassNotFoundException again
                          beve

                          I've taken a look and I think the reason for the file not being found is that the code that reads the properties file uses the thread context classloader.
                          So even though you have specified the location of the jbossesb-properties.xml file correctly using the Bundle-ClassPath header it will still not be picked up.
                          As a workaround you can set the thread context classloader before creating the ServiceInvoker and resetting it after:

                          ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
                          try
                          {
                           Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
                           ServiceInvoker invoker = new ServiceInvoker(category, service);
                           invoker.deliverAsync(requestMessage);
                          }
                          finally
                          {
                           Thread.currentThread().setContextClassLoader(contextClassLoader);
                          }
                          


                          This way you are setting the context classloader to the bundle classloader and this should enable the file to be found.
                          Can you give that a try?

                          Regards,

                          /Daniel

                          • 10. Re: ClassNotFoundException again

                            Hi, Dan,

                            thanks a lot for your time, I'll try it as soon as possible and give my feedback. :)

                            • 11. Re: ClassNotFoundException again

                              Well, it doesn't change anything. :( Absolutely the same result.

                              • 12. Re: ClassNotFoundException again
                                beve

                                I'll create an example of this when I get the chance. I thought that OSGi classloading was the cause of this but I'd need to try this out.

                                Regards,

                                /Daniel

                                • 13. Re: ClassNotFoundException again

                                  I'll be much grateful, Daniel. I haven't found any solution yet, even the official news group of RCP is silent. :(

                                  • 14. Re: ClassNotFoundException again
                                    beve

                                    Could you check something for me?

                                    Before you create the ServiceInvoker in you code...can you print the current classes classloader and the context classloader just before that call?

                                    Thanks,

                                    /Daniel

                                    1 2 Previous Next