6 Replies Latest reply on Jul 23, 2007 6:29 AM by Adrian Brock

    Deploy Message listener as MBean service get No ClassLoaders

    j h Newbie

      Greetings all,

      I am using JBoss 3.2.5 to implement a mail listener and deploy it as an MBean service. I follow the sample of HelloWorld mbean service tutorial on the wiki site,
      1. create an interface:
      public interface TopicMailListenerMBean extends ServiceMBean{
      public String getName();
      public void setName(String name);
      public String getUrl();
      public void setUrl(String url);
      public void disconnect() throws JMSException;
      }
      2. create mbean class:
      public class TopicMailListener extends ServiceMBeanSupport
      implements MessageListener, TopicMailListenerMBean {
      public void onMessage(Message msg) {...}
      ...
      }
      3. create a jboss-service.xml
      <?xml version="1.0" encoding="UTF-8"?>
      < server>
      < mbean code="au.gov.nsw.community.mail.TopicMailListener" name="au.gov.nsw.community.mail:service=TopicMailListener">
      < attribute name="Url">10.65.240.244:1099< /attribute>
      < attribute name="Name">topic/testTopic< /attribute>
      < /mbean>
      < /server>

      4. deploy the war to jboss, and rename it to .sar, the hirarche of the sar is:
      Docs.sar
      Docs.sar/META-INF/jboss-service.xml
      Docs.sar/au/gov/nsw/community/mail/TopicMailListener.class
      Docs.sar/au/gov/nsw/community/mail/TopicMailListenerMBean.class

      Now, once I deploy the .sar in the JBOSSHOME/server/all/deploy, I always get following exceiption:
      2007-07-18 12:33:05,640 DEBUG [org.jboss.system.ServiceCreator] About to create bean: au.gov.nsw.community.mail:service=TopicMailListener with code: au.gov.nsw.community.mail.TopicMailListener
      2007-07-18 12:33:05,671 DEBUG [org.jboss.deployment.SARDeployer] create operation failed for package file:/D:/Adobe/LiveCycle/jboss/server/all/deploy/Docs.sar
      org.jboss.deployment.DeploymentException: No ClassLoaders found for: au.gov.nsw.community.mail.TopicMailListener; - nested throwable: (java.lang.ClassNotFoundException: No ClassLoaders found for: au.gov.nsw.community.mail.TopicMailListener)
      at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:139)
      at org.jboss.system.ServiceController.install(ServiceController.java:198)
      at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
      at $Proxy4.install(Unknown Source)
      at org.jboss.deployment.SARDeployer.create(SARDeployer.java:204)
      at org.jboss.deployment.MainDeployer.create(MainDeployer.java:790)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:644)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:608)
      at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
      at $Proxy7.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:304)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:478)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:201)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:212)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:191)
      Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: au.gov.nsw.community.mail.TopicMailListener
      at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:275)
      at org.jboss.mx.loading.UnifiedClassLoader3.loadClassImpl(UnifiedClassLoader3.java:178)
      at org.jboss.mx.loading.UnifiedClassLoader3.loadClass(UnifiedClassLoader3.java:132)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
      at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:843)
      at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:290)
      at org.jboss.mx.server.MBeanServerImpl.createMBean(MBeanServerImpl.java:317)
      at org.jboss.system.ServiceCreator.install(ServiceCreator.java:98)
      at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:149)
      at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:114)
      ... 32 more

      Could anybody tell me where is wrong? I do appreciate for any help in advance!

      Cheers,
      hj

        • 1. Re: Deploy Message listener as MBean service get No ClassLoa
          Adrian Brock Master

          jar -tf Docs.sar > jboss forum
          so we can see the real structure for the jar not what you think/claim it is.

          • 2. Re: Deploy Message listener as MBean service get No ClassLoa
            j h Newbie

            Here you go:
            C:\Program Files\Java\jdk1.5.0_06\bin>jar -tf Docs.sar
            META-INF/MANIFEST.MF
            WEB-INF/classes/au/gov/nsw/community/mail/TopicMailListenerMBean.class
            WEB-INF/lib/DocumentServicesLibrary.jar
            WEB-INF/classes/au/gov/nsw/community/forms/siebel/
            WEB-INF/lib/wsdl4j.jar
            WEB-INF/classes/au/gov/nsw/community/forms/exception/
            WEB-INF/lib/jaxrpc.jar
            WEB-INF/classes/au/gov/nsw/community/forms/servlet/AbstractDocsServlet.java
            WEB-INF/classes/au/gov/nsw/
            WEB-INF/classes/au/gov/nsw/community/xml/
            WEB-INF/classes/au/gov/nsw/community/util/StringUtils.java
            WEB-INF/classes/au/gov/nsw/community/forms/siebel/SiebelProxy.class
            WEB-INF/lib/saaj.jar
            WEB-INF/classes/test/
            WEB-INF/classes/au/gov/nsw/community/util/XMLUtils.java
            WEB-INF/classes/au/gov/nsw/community/util/
            WEB-INF/lib/xalan.jar
            WEB-INF/lib/log4j-1.2.8.jar
            WEB-INF/lib/adobe-common.jar
            WEB-INF/lib/formserver-client.jar
            WEB-INF/classes/au/gov/nsw/community/mail/MailMessage.java
            WEB-INF/classes/au/gov/nsw/community/mail/MailMessage.class
            WEB-INF/lib/axis-ant.jar
            META-INF/
            WEB-INF/
            WEB-INF/classes/au/gov/nsw/community/forms/servlet/AbstractDocsServlet.class
            WEB-INF/classes/au/gov/nsw/community/mail/TopicMailSender.class
            WEB-INF/classes/au/gov/nsw/community/mail/TopicMailListener.class
            WEB-INF/lib/log4j.properties
            WEB-INF/lib/um-client.jar
            WEB-INF/classes/au/gov/nsw/community/forms/exception/ProcessingException.class
            WEB-INF/classes/au/gov/nsw/community/forms/processor/DataSubmitHandler.java
            WEB-INF/classes/au/gov/nsw/community/mail/TopicMailListenerMBean.java
            WEB-INF/classes/au/gov/nsw/community/forms/servlet/FormRequestServlet.class
            WEB-INF/classes/au/gov/nsw/community/mail/
            WEB-INF/lib/datamanager-client.jar
            WEB-INF/web.xml
            home.jsp
            WEB-INF/lib/serializer.jar
            WEB-INF/classes/au/gov/nsw/community/forms/servlet/
            WEB-INF/classes/au/gov/nsw/community/forms/siebel/SiebelProxy.java
            WEB-INF/classes/au/gov/nsw/community/mail/MailService$1.class
            WEB-INF/lib/xercesImpl.jar
            WEB-INF/classes/au/gov/nsw/community/forms/livecycle/
            WEB-INF/classes/au/gov/nsw/community/forms/processor/DataSubmitHandler.class
            WEB-INF/classes/au/gov/nsw/community/xml/XMLUtilities.class
            WEB-INF/classes/au/gov/nsw/community/forms/
            WEB-INF/classes/au/gov/nsw/community/util/FileUtils.class
            WEB-INF/classes/au/gov/nsw/community/util/XMLUtils.class
            WEB-INF/classes/au/gov/nsw/community/util/StringUtils.class
            WEB-INF/classes/test/XPathTest.java
            WEB-INF/classes/au/gov/nsw/community/util/XFAStipper.class
            params.jsp
            WEB-INF/lib/xml-apis.jar
            WEB-INF/lib/axis.jar
            WEB-INF/classes/au/gov/nsw/community/
            META-INF/jboss-service.xml
            WEB-INF/classes/au/gov/nsw/community/mail/TopicMailListener.java
            WEB-INF/lib/
            WEB-INF/classes/au/gov/nsw/community/forms/processor/
            WEB-INF/classes/au/gov/nsw/community/forms/livecycle/FormsProxy.class
            WEB-INF/classes/au/gov/nsw/community/forms/livecycle/FormsProxy.java
            WEB-INF/lib/AdobeCSAUtils.jar
            WEB-INF/classes/au/gov/
            index.jsp
            WEB-INF/classes/test/XPathTest.class
            WEB-INF/lib/xmlform-client.jar
            WEB-INF/classes/mail.properties
            WEB-INF/classes/au/
            WEB-INF/lib/commons-logging.jar
            WEB-INF/classes/au/gov/nsw/community/mail/MailService.class
            WEB-INF/classes/au/gov/nsw/community/mail/MailService.java
            env.jsp
            WEB-INF/classes/au/gov/nsw/community/util/FileUtils.java
            WEB-INF/classes/au/gov/nsw/community/xml/XMLUtilities.java
            WEB-INF/classes/au/gov/nsw/community/forms/servlet/FormSubmitServlet.class
            WEB-INF/lib/commons-discovery.jar
            WEB-INF/classes/au/gov/nsw/community/forms/servlet/FormRequestServlet.java
            WEB-INF/classes/jndi.properties
            WEB-INF/classes/au/gov/nsw/community/forms/exception/ProcessingException.java
            WEB-INF/classes/
            WEB-INF/classes/au/gov/nsw/community/util/XFAStipper.java
            WEB-INF/classes/au/gov/nsw/community/forms/servlet/FormSubmitServlet.java
            WEB-INF/classes/au/gov/nsw/community/mail/TopicMailSender.java

            thanks for you reply, adrian.

            cheers,
            hj

            • 3. Re: Deploy Message listener as MBean service get No ClassLoa
              Adrian Brock Master

              That's not a sar. sars are jars, this looks more like a war to me.

              Put the classes in the root of the archive NOT in WEB-INF/classes.

              Can't you see the difference between what you claimed was the packaging
              and what you actually show?


              Docs.sar/au/gov/nsw/community/mail/TopicMailListener.class
              Docs.sar/au/gov/nsw/community/mail/TopicMailListenerMBean.class


              • 4. Re: Deploy Message listener as MBean service get No ClassLoa
                Adrian Brock Master

                While we are here, including a jndi.properties in the classpath of a JavaEE
                deployment is just asking for trouble.

                • 5. Re: Deploy Message listener as MBean service get No ClassLoa
                  j h Newbie

                  Thanks for your reply, adrian.
                  Ok, I create a jar and renamed it as sar, and deploy it in the JBOSS_HOME/server/default/deploy as Docs.sar, but I get following exception:
                  2007-07-23 11:16:39,903 DEBUG [org.jboss.deployment.SARDeployer] create operation failed for package file:/D:/Adobe/LiveCycle/jboss/server/all/deploy/Docs.sar/
                  org.jboss.deployment.DeploymentException: au.gov.nsw.community.mail.TopicMailListener.(); - nested throwable: (java.lang.NoSuchMethodException: au.gov.nsw.community.mail.TopicMailListener.())
                  at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:139)
                  at org.jboss.system.ServiceController.install(ServiceController.java:198)
                  at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                  at java.lang.reflect.Method.invoke(Method.java:324)
                  at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
                  at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
                  at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
                  at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
                  at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
                  at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
                  at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
                  at $Proxy4.install(Unknown Source)
                  at org.jboss.deployment.SARDeployer.create(SARDeployer.java:204)
                  at org.jboss.deployment.MainDeployer.create(MainDeployer.java:790)
                  at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:644)
                  at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:608)
                  at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                  at java.lang.reflect.Method.invoke(Method.java:324)
                  at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
                  at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
                  at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
                  at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
                  at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
                  at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
                  at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
                  at $Proxy7.deploy(Unknown Source)
                  at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:304)
                  at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:460)
                  at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:201)
                  at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:212)
                  at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:191)

                  my TopicMailListener.java code is as following:
                  private String url;
                  private String name;

                  public String getName() {
                  return name;
                  }

                  public void setName(String name) {
                  this.name = name;
                  }

                  public String getUrl() {
                  return url;
                  }

                  public void setUrl(String url) {
                  this.url = url;
                  }

                  public TopicMailListener(String name) {
                  super();
                  this.name = name;

                  try {
                  this.initializeListener();
                  } catch (Exception e) {
                  LOGGER.info("Error creating listener: " + e);
                  e.printStackTrace();
                  }
                  }

                  public TopicMailListener(String url, String name) {
                  super();

                  this.url = url;
                  this.name = name;

                  try {
                  this.initializeListener();
                  } catch (Exception e) {
                  LOGGER.info("Error creating listener: " + e);
                  e.printStackTrace();
                  }

                  }

                  the jboss-service.xml is:

                  <?xml version="1.0" encoding="UTF-8"?>
                  < server>
                   < mbean code="au.gov.nsw.community.mail.TopicMailListener" name="au.gov.nsw.community.mail:service=TopicMailListener">
                   < attribute name="Url">10.65.240.244:1099</attribute>
                   < attribute name="Name">topic/testTopic</attribute>
                   < depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
                   < depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>
                   <!--
                   < attribute name="SecurityConf">
                   < security>
                   < role name="guest" read="true" write="true"/>
                   < role name="publisher" read="true" write="true" create="false"/>
                   < role name="durpublisher" read="true" write="true" create="true"/>
                   < /security>
                   < /attribute>
                   -->
                   </mbean>
                  </server>
                  


                  the sar artitecture is:
                  META-INF/MANIFEST.MF
                  META-INF/jboss-service.xml
                  README.txt
                  WebContent/FormDataResubmit.jsp
                  WebContent/FormDataResubmitSuccess.jsp
                  WebContent/META-INF/MANIFEST.MFWebContent/WEB-INF/lib/AdobeCSAUtils.jar
                  WebContent/WEB-INF/lib/DocumentServicesLibrary.jar
                  WebContent/WEB-INF/lib/adobe-common.jar
                  WebContent/WEB-INF/lib/axis-ant.jar
                  WebContent/WEB-INF/lib/axis.jar
                  WebContent/WEB-INF/lib/commons-discovery.jar
                  WebContent/WEB-INF/lib/commons-logging.jar
                  WebContent/WEB-INF/lib/datamanager-client.jar
                  WebContent/WEB-INF/lib/formserver-client.jar
                  WebContent/WEB-INF/lib/jaxrpc.jar
                  WebContent/WEB-INF/lib/log4j-1.2.8.jar
                  WebContent/WEB-INF/lib/log4j.properties
                  WebContent/WEB-INF/lib/saaj.jar
                  WebContent/WEB-INF/lib/serializer.jar
                  WebContent/WEB-INF/lib/um-client.jar
                  WebContent/WEB-INF/lib/wsdl4j.jar
                  WebContent/WEB-INF/lib/xalan.jar
                  WebContent/WEB-INF/lib/xercesImpl.jar
                  WebContent/WEB-INF/lib/xml-apis.jar
                  WebContent/WEB-INF/lib/xmlform-client.jar
                  WebContent/WEB-INF/web.xml
                  WebContent/env.jsp
                  WebContent/home.jsp
                  WebContent/index.jsp
                  WebContent/params.jsp
                  au/gov/nsw/community/forms/exception/ProcessingException.class
                  au/gov/nsw/community/forms/livecycle/FormsProxy.class
                  au/gov/nsw/community/forms/processor/DataSubmitHandler.class
                  au/gov/nsw/community/forms/servlet/FormRequestServlet.class
                  au/gov/nsw/community/forms/servlet/FormDataResubmitServlet.class
                  au/gov/nsw/community/forms/servlet/FormSubmitServlet.class
                  au/gov/nsw/community/forms/servlet/AbstractDocsServlet.class
                  au/gov/nsw/community/forms/siebel/SiebelProxy.class
                  au/gov/nsw/community/mail/MailService$1.class
                  au/gov/nsw/community/mail/MailService.class
                  au/gov/nsw/community/mail/TopicMailListener.class
                  au/gov/nsw/community/mail/TopicMailListenerMBean.class
                  au/gov/nsw/community/mail/MailMessage.class
                  au/gov/nsw/community/mail/TopicMailSender.class
                  au/gov/nsw/community/util/XMLUtils.class
                  au/gov/nsw/community/util/StringUtils.class
                  au/gov/nsw/community/util/FileUtils.class
                  au/gov/nsw/community/util/XFAStipper.class
                  au/gov/nsw/community/xml/XMLUtilities.class
                  test/XPathTest.class
                  .classpath
                  .project
                  sampleData.xml
                  sample.xml

                  I thought it is related with the constructor method, but don't know how to fix, could you please advise me? I do appreciate your help.

                  hj

                  • 6. Re: Deploy Message listener as MBean service get No ClassLoa
                    Adrian Brock Master

                     

                    "loseyourself" wrote:

                    I thought it is related with the constructor method, but don't know how to fix, could you please advise me? I do appreciate your help.

                    hj


                    Correct. You have no default constructor. So you've either got to define one
                    or tell jboss the constructor parameters.

                    <mbean name="jboss.test:type=BasicMBeanName" code="BasicMBeanCode">
                     <constructor>
                     <arg type="java.lang.String" value="param1"/>
                     <arg type="java.lang.String" value="param2"/>
                     </constructor>
                    </mbean>
                    


                    And putting your initialization code in the constructor doesn't work.
                    It has to go in a start() method for the dependencies to work.
                    (Have you even read the chapter on MBeans in the docs?
                    Or the JMX FAQ for that matter?)

                    Anyway, this thread is getting ridiculous.
                    None of these issues has anything to do with JMS, they are all JMX.