10 Replies Latest reply on Jan 23, 2009 6:05 AM by arnold.maderthaner

    Problem with loader-repository

      Hi !

      I have a modified jax-ws implementation in my sar file and when I write a test methode in a mbean it works (so the libs are used from the sar file and not from server/default/lib). I used <loader-repository> in my jboss-service.xml so that the classloader first looks at the sar file but somehow it doesn't find another class which I wrote which is also packed in the sar file.
      so I get the following exception:
      javax.jms.MessageFormatException: ClassNotFoundException: No ClassLoaders found for: a.b.c.d.MyClass
      at org.jboss.mq.SpyObjectMessage.getObject(SpyObjectMessage.java:154)
      at a.b.c.d.MyClass2
      at org.jboss.mq.SpyMessageConsumer.run(SpyMessageConsumer.java:697)
      at java.lang.Thread.run(Thread.java:619)

      So I have the following situation:

      1.) I have a jmx-operation in MyClass2 that uses the jax-ws implementation in my sar file and everything is fine

      2.) In MyClass2 (which listens on Notifications) I get another Object which is in the same sar packed (MyClass) but the ClassLoader doesn't find it.

      My JBoss Version is 4.2.3 using java 1.6

        • 1. Re: Problem with loader-repository

          when I go to the LoaderRepository which is created for my sar and invoke:

          java.lang.String displayClassInfo() with a.b.c.d.MyClass (which cannot be found in my application).

          I get the following output:

          ### Instance0 found in UCL: org.jboss.mx.loading.UnifiedClassLoader3@14b9b618{ url=file:/opt/jboss/server/default/tmp/deploy/tmp28864my_sar_file.sar ,addedOrder=12}

          • 2. Re: Problem with loader-repository
            jaikiran

            Please post the configuration file (which contains the loader-repository config) and also the output of:

            jar -tf my_sar_file.sar


            Also please post the entire exception stacktrace.

            While posting logs or xml content or code, please remember to wrap it in a code block by using the Code button in the message editor window. Please use the Preview button to ensure that your post is correctly formatted.

            • 3. Re: Problem with loader-repository

              my jboss-service.xml:

              <?xml version="1.0" encoding="UTF-8"?>
              
              <server>
              
               <loader-repository>
               j4care.archive:archive=j4care_emc_dfs.sar
               </loader-repository>
              
               <mbean code="org.jboss.mq.server.jmx.Queue"
               name="j4care.archive:service=Queue,name=DFSFileCopy">
               <depends optional-attribute-name="DestinationManager">
               jboss.mq:service=DestinationManager
               </depends>
               </mbean>
              
               <mbean
               code="com.j4care.ws.emc.documentum.DFSFileCopyService"
               name="j4care.archive:service=DFSFileCopyService"
               xmbean-dd="resource:xmdesc/DFSFileCopyService.xml">
               <depends>dcm4chee.archive:service=StoreScp</depends>
               </mbean>
              
               <mbean
               code="com.j4care.ws.emc.documentum.DFSRetrieverService"
               name="j4care.archive:service=DFSRetriever"
               xmbean-dd="resource:xmdesc/DFSRetrieverService.xml">
               <depends>jboss.mq:service=DestinationManager</depends>
               </mbean>
              </server>
              




              my sar file:


              [root@smooth tmp]# jar -tf my_sar_file.sar
              META-INF/
              META-INF/MANIFEST.MF
              com/
              com/j4care/
              com/j4care/ws/
              com/j4care/ws/emc/
              com/j4care/ws/emc/documentum/
              com/j4care/ws/emc/documentum/DFSCopyOrder.class
              com/j4care/ws/emc/documentum/DFSFileCopyService.class
              com/j4care/ws/emc/documentum/DFSFileCopyServiceMBean.class
              com/j4care/ws/emc/documentum/DFSRetrieverService.class
              com/j4care/ws/emc/documentum/DFSRetrieverServiceMBean.class
              com/j4care/ws/emc/documentum/test/
              com/j4care/ws/emc/documentum/test/TestClient.class
              com/j4care/ws/emc/documentum/test/TestClient2.class
              xmdesc/
              META-INF/jboss-service.xml
              xmdesc/DFSFileCopyService.xml
              xmdesc/DFSRetrieverService.xml
              lib/
              lib/emc-bpm-services-remote.jar
              lib/emc-ci-services-remote.jar
              lib/emc-collaboration-services-remote.jar
              lib/emc-dfs-rt-remote.jar
              lib/emc-dfs-services-remote.jar
              lib/emc-search-services-remote.jar
              lib/emc-dfs-rt.jar
              lib/certjFIPS.jar
              lib/configservice-api.jar
              lib/configservice-impl.jar
              lib/dfc.jar
              lib/dms-client-api.jar
              lib/jsafeFIPS.jar
              lib/xtrim-api.jar
              lib/xtrim-server.jar
              lib/jaxr-api.jar
              lib/jaxr-impl.jar
              lib/FastInfoset.jar
              lib/activation.jar
              lib/http.jar
              lib/jaxb-api.jar
              lib/jaxb-impl.jar
              lib/jaxb-xjc.jar
              lib/jaxb1-impl.jar
              lib/jaxws-api.jar
              lib/jaxws-rt.jar
              lib/jaxws-tools.jar
              lib/jsr173_api.jar
              lib/jsr181-api.jar
              lib/jsr250-api.jar
              lib/mimepull.jar
              lib/resolver.jar
              lib/saaj-api.jar
              lib/saaj-impl.jar
              lib/sjsxp.jar
              lib/stax-ex.jar
              lib/streambuffer.jar
              lib/xercesImpl.jar
              lib/aspectjrt.jar
              lib/javassist.jar
              lib/log4j.jar
              lib/servlet.jar
              lib/tools.jar
              lib/xmlsec.jar
              lib/xws-security.jar
              lib/commons-cli-1.0.jar
              lib/commons-codec-1.3.jar
              lib/commons-io-1.2.jar
              lib/commons-lang-2.1.jar
              
              
              


              Stack Trace:


              
              2009-01-21 14:21:52,197 INFO -> (MessageListenerThread - DFSFileCopy) [STDOUT] 14:21:52,196 ERROR [DFSFileCopyService] unexpected error during processing message: org.jboss.mq.SpyObjectMessage {
              Header {
               jmsDestination : QUEUE.DFSFileCopy
               jmsDeliveryMode : 2
               jmsExpiration : 0
               jmsPriority : 4
               jmsMessageID : ID:16-12325441121761
               jmsTimeStamp : 1232544112176
               jmsCorrelationID: null
               jmsReplyTo : null
               jmsType : null
               jmsRedelivered : false
               jmsProperties : {JMSXDeliveryCount=1, JMS_JBOSS_REDELIVERY_COUNT=0}
               jmsPropReadWrite: false
               msgReadOnly : true
               producerClientId: ID:16
              }
              }
              javax.jms.MessageFormatException: ClassNotFoundException: No ClassLoaders found for: com.j4care.ws.emc.documentum.DFSCopyOrder
               at org.jboss.mq.SpyObjectMessage.getObject(SpyObjectMessage.java:154)
               at com.j4care.ws.emc.documentum.DFSFileCopyService.onMessage(DFSFileCopyService.java:307)
               at org.jboss.mq.SpyMessageConsumer.run(SpyMessageConsumer.java:697)
               at java.lang.Thread.run(Thread.java:619)
              
              


              • 4. Re: Problem with loader-repository
                jaikiran

                 

                javax.jms.MessageFormatException: ClassNotFoundException: No ClassLoaders found for: com.j4care.ws.emc.documentum.DFSCopyOrder
                at org.jboss.mq.SpyObjectMessage.getObject(SpyObjectMessage.java:154)
                at com.j4care.ws.emc.documentum.DFSFileCopyService.onMessage(DFSFileCopyService.java:307)
                at org.jboss.mq.SpyMessageConsumer.run(SpyMessageConsumer.java:697)
                at java.lang.Thread.run(Thread.java:619)


                I think in the MBean configuration, you can specify a classpath using the lib folder. Its strange that one of the class is found but not the other.

                • 5. Re: Problem with loader-repository

                  the strange thing is that the class outside of the lib folder is not found but those in the lib folder are found. are there any documents about that (mbean classpath things that you mentioned) or other things I could do ?

                  I already tried to pack all of my classed also into a jar file and store it in the lib folder but they are also not found then.

                  • 6. Re: Problem with loader-repository
                    jaikiran
                    • 7. Re: Problem with loader-repository

                      do you have an example how the jboss-service.xml should look like afterwards ?

                      • 8. Re: Problem with loader-repository

                        I tried now to use the classpath element but then I think it uses the wrong jaxws implementation as it doesn't work now :(

                        can I lookup somewhere which classes are used when I call a methode ?


                        • 9. Re: Problem with loader-repository
                          jaikiran

                           

                          "arnold.maderthaner" wrote:


                          can I lookup somewhere which classes are used when I call a methode ?




                          Add -verbose:class to the run.bat (or run.conf if you are using *nix OS) to the JAVA_OPTS section. Then start your server (you will have to redirect the output to a file to avoid very verbose classloading logs). Then access your application when server is started and look at the logs. The logs will give you the information about which jar is being used to load the class.

                          • 10. Re: Problem with loader-repository

                            I think I found a solution now that works for me:

                            I splitted my code into 2 sar files.
                            the first one with my code that uses JMS (I think there I had the problem with the ClassNotFoundException)
                            and the 2. one with my code that uses the modified jax-ws implementation.

                            Both sar files communicate now with JMX.