5 Replies Latest reply on Jul 6, 2006 11:21 AM by malmei

    ClassLoader problems while deploying a EJB3

    malmei

      Hello

      The following happens, when i deploy an ejb3:

      17:50:01,984 WARN [ServiceController] Problem creating service jboss.j2ee:service=EJB3,module=Tools.ejb3
      java.lang.ClassNotFoundException: No ClassLoaders found for: de.s2i.service.tools.MsgConsumerBean
      at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:212)
      at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:511)
      at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:405)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
      at org.jboss.ejb3.Ejb3AnnotationHandler.populateBaseInfo(Ejb3AnnotationHandler.java:280)
      at org.jboss.ejb3.Ejb3AnnotationHandler.getContainers(Ejb3AnnotationHandler.java:126)
      at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:567)
      at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:555)
      at org.jboss.ejb3.Ejb3Deployment.deployUrl(Ejb3Deployment.java:536)
      at org.jboss.ejb3.Ejb3Deployment.deploy(Ejb3Deployment.java:508)
      at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:463)
      at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:125)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:260)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:243)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
      at $Proxy0.create(Unknown Source)
      at org.jboss.system.ServiceController.create(ServiceController.java:330)
      at org.jboss.system.ServiceController.create(ServiceController.java:273)
      at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      at $Proxy34.create(Unknown Source)
      at org.jboss.ejb3.EJB3Deployer.create(EJB3Deployer.java:429)

      [ ... lines deleted ... ]

      This is the class (MsgConsumerBean.java):

      package de.s2i.service.tools;

      import javax.annotation.Resource;
      import javax.ejb.ActivationConfigProperty;
      import javax.ejb.Local;
      import javax.ejb.MessageDriven;
      import javax.ejb.MessageDrivenBean;
      import javax.ejb.MessageDrivenContext;
      import javax.ejb.Remote;
      import javax.ejb.Stateless;
      import javax.jms.Message;

      @Stateless
      @Local( { MsgConsumerLocal.class } )
      @Remote( { MsgConsumerRemote.class } )
      @MessageDriven(activationConfig =
      {
      @ActivationConfigProperty(propertyName="destinationType",
      propertyValue="javax.jms.Queue"),
      @ActivationConfigProperty(propertyName="destination",
      propertyValue="queue/mdpojo"),
      @ActivationConfigProperty(
      propertyName = "minPoolSize",
      propertyValue = "1"),
      @ActivationConfigProperty(
      propertyName = "maxPoolSize",
      propertyValue = "1")
      })
      public class MsgConsumerBean implements MsgConsumerLocal,MsgConsumerRemote,MessageDrivenBean {

      // @CurrentMessage private javax.jms.Message currentMessage;

      @Resource
      private MessageDrivenContext ctx;

      // **** MessageDrivenBean
      public void ejbCreate() {
      System.out.println("ConsumerMDB: created");
      }

      public void ejbRemove() {
      System.out.println("ConsumerMDB: removed");
      }

      public void setMessageDrivenContext(MessageDrivenContext ctx) {
      System.out.println("ConsumerMDB: set context");
      this.ctx = ctx;
      }

      // **** MessageListener
      public void onMessage(Message message) {
      System.out.println("ConsumerMDB - onMessage called: "+message.toString());
      }
      public void doConsume(Object obj) {
      System.out.println("Just consuming "+obj.toString());
      }
      }

      -----

      package de.s2i.service.tools;

      import javax.ejb.Local;

      @Local
      public interface MsgConsumerLocal {
      public void doConsume(Object obj);
      }

      -----

      package de.s2i.service.tools;

      import javax.ejb.Remote;

      @Remote
      public interface MsgConsumerRemote {
      public void doConsume(Object obj);
      }

      -----

      jboss is of version 4.0.4GA, EJB is 3.0 RC8-FD.

      I searched google back and forth, but there was no help. I already set the
      "CallByValue" in naming-service.xml to false (read about that in a posting), but it didn't change anything ...

      Has anyone an idea what happens here?

      Thanx in advance
      Malte

        • 1. Re: ClassLoader problems while deploying a EJB3
          peterj

          Could you post the contents of your ejb jar file? Enter the following command:

          jar tf jar-file-name


          and post the results. I suspect that your class file is not where it should be.

          • 2. Re: ClassLoader problems while deploying a EJB3
            malmei

            Here you are:

            $ jar -tf Tools.ejb3
            META-INF/
            META-INF/MANIFEST.MF
            WEB-INF/
            WEB-INF/classes/
            WEB-INF/classes/de/
            WEB-INF/classes/de/s2i/
            WEB-INF/classes/de/s2i/service/
            WEB-INF/classes/de/s2i/service/tools/
            WEB-INF/lib/
            WEB-INF/classes/de/s2i/service/tools/MsgConsumerBean.class
            WEB-INF/classes/de/s2i/service/tools/MsgConsumerLocal.class
            WEB-INF/classes/de/s2i/service/tools/MsgConsumerRemote.class
            WEB-INF/classes/de/s2i/service/tools/Sender.class
            WEB-INF/classes/de/s2i/service/tools/Test$log.class
            WEB-INF/classes/de/s2i/service/tools/Test.class
            WEB-INF/jboss-web.xml
            WEB-INF/lib/activation-1.1.jar
            WEB-INF/lib/annotation-ejb3-3.0.jar
            WEB-INF/lib/aop-1.5.jar
            WEB-INF/lib/aspect-library-1.5.jar
            WEB-INF/lib/classworlds-1.1-alpha-2.jar
            WEB-INF/lib/ejb3-3.0.jar
            WEB-INF/lib/ejb3x-3.0.jar
            WEB-INF/lib/jboss-client-4.0.2.jar
            WEB-INF/lib/jboss-common-4.0.2.jar
            WEB-INF/lib/jboss-jmx-4.0.2.jar
            WEB-INF/lib/jbossmq-client-4.0.2.jar
            WEB-INF/lib/jnp-client-4.0.2.jar
            WEB-INF/lib/mail-1.4.jar
            WEB-INF/lib/maven-archiver-2.0.1.jar
            WEB-INF/lib/maven-artifact-2.0.1.jar
            WEB-INF/lib/maven-artifact-manager-2.0.1.jar
            WEB-INF/lib/maven-ear-plugin-2.1.jar
            WEB-INF/lib/maven-model-2.0.1.jar
            WEB-INF/lib/maven-plugin-api-2.0.1.jar
            WEB-INF/lib/maven-profile-2.0.1.jar
            WEB-INF/lib/maven-project-2.0.1.jar
            WEB-INF/lib/maven-repository-metadata-2.0.1.jar
            WEB-INF/lib/plexus-archiver-1.0-alpha-4.jar
            WEB-INF/lib/plexus-container-default-1.0-alpha-9.jar
            WEB-INF/lib/plexus-utils-1.0.5.jar
            WEB-INF/lib/wagon-provider-api-1.0-alpha-5.jar
            WEB-INF/lib/webdavlib-2.0.jar
            WEB-INF/lib/xercesImpl-2.6.2.jar
            WEB-INF/web.xml
            META-INF/maven/
            META-INF/maven/de.s2i.service.tools/
            META-INF/maven/de.s2i.service.tools/ToolService/
            META-INF/maven/de.s2i.service.tools/ToolService/pom.xml
            META-INF/maven/de.s2i.service.tools/ToolService/pom.properties

            As you can see, there is no ejb-jar.xml - I always had the impression, that if you use annotations you can do without .xml ... is that wrong?

            greetings
            Malte

            • 3. Re: ClassLoader problems while deploying a EJB3
              malmei

              To make sure that it's not the missing ejb-jar.xml I added this:

              <?xml version="1.0"?>

              <ejb-jar version="3.0">

              <enterprise-beans>

              <!-- A minimal session EJB deployment -->
              <message-driven>
              <ejb-name>MsgConsumerBean</ejb-name>
              MsgConsumerLocal
              MsgConsumerRemote
              <ejb-class>de.s2i.service.tools.MsgConsumerBean</ejb-class>
              <transaction-type>Container</transaction-type>
              <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
              <message-driven-destination>
              <destination-type>javax.jms.Queue</destination-type>
              <subscription-durability>queue/mdpojo</subscription-durability>
              </message-driven-destination>
              </message-driven>

              </enterprise-beans>
              </ejb-jar>

              It made no difference ...

              • 4. Re: ClassLoader problems while deploying a EJB3
                bdecoste

                Several problems here ...

                First off, you should be using the .jar extension instead of the .ejb3 extension for deploying EJB3s. We support .ejb3 but this is not the standard extension.

                Second, you have packaged the .ejb3 file as a web deployment (.war), not an EJB deployment. Please see any of the examples on how to package a .jar file.

                • 5. Re: ClassLoader problems while deploying a EJB3
                  malmei

                  Things can be so easy - that fixed it !

                  many thanx