1 Reply Latest reply on Apr 5, 2002 7:32 AM by adrian.brock

    Classpath problem

    dete

      Hi folks,
      I've been struggeling around for a few hours with some Classpathproblem in JBOSS 2.4.4
      The problem is that I got consequently "NoClassDefFound" - Exceptions on following situation:
      1st I have a SessionBean deployed in JBoss, anything is working fine, neatly put into a jar, let's call it: EJB.jar,containing class a,b,c
      2nd I have a MBean added to the jboss jcml, packed in a jar: MBean.jar. And here the trouble starts: This MBean needs some classes the SessionBean needs as well. Let's say it contains class c,d,e
      So first I added the classes needed in both jars. Problem: JBoss loads the MBean correctly, but whenever trying to deploy the EJB.jar it complaints about not finding class a. Seems to me JBoss tries to load the classes from out of the MBean.jar?
      So I tried it the other way round: I did not pack any class belonging to the EJB.jar into the MBean.jar, anything deploys, but as I try to use it, it fails, comlaining of not finding class c. To fix this, I tried to have the EJB.jar in my classpath. I modified the run.bat - file, but this did not help.
      So, what's wrong? In fact, I do use the reflectionAPI in the MBean to look up some classes, maybe the problems located rather here. My next step will be elimininating the reflection and try to deploy quite "naked" classes and see if it still fails...
      Anyone got the same problem? Any ideas or hints?
      BTW: The MBean.jar is located in a directory under JBOSS_HOME/lib, added as a classpath-extension in the jboss.conf.
      --------------------
      Follows: Snippet from the logfile, when EJB and MBean contain class c, the TransformException is placed in the EJB.jar, it is not depended on anything other (except java.lang.Exception)
      [INFO,ContainerFactory] Deploying:file:/D:/Programme/JBoss-2.4.4_Tomcat-3.2.3/jboss/tmp/deploy/Default/transformServiceE
      JB.jar
      [ERROR,ContainerFactory] Verify failure
      java.lang.NoClassDefFoundError: de/volkswagen/mps/transformservice/TransformException
      at java.lang.Class.getMethods0(Native Method)
      at java.lang.Class.getMethods(Unknown Source)
      at org.jboss.verifier.strategy.AbstractVerifier.isRMIIDLRemoteInterface(AbstractVerifier.java:907)
      at org.jboss.verifier.strategy.AbstractVerifier.isRMIIIOPType(AbstractVerifier.java:875)
      at org.jboss.verifier.strategy.AbstractVerifier.hasLegalRMIIIOPReturnType(AbstractVerifier.java:157)
      at org.jboss.verifier.strategy.EJBVerifier11.verifySessionHome(EJBVerifier11.java:240)
      at org.jboss.verifier.strategy.EJBVerifier11.checkSession(EJBVerifier11.java:94)
      at org.jboss.verifier.BeanVerifier.verify(BeanVerifier.java:134)
      at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:465)
      at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:369)
      at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:306)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      at org.jboss.deployment.J2eeDeployer.startModules(J2eeDeployer.java:487)
      at org.jboss.deployment.J2eeDeployer.startApplication(J2eeDeployer.java:459)
      at org.jboss.deployment.J2eeDeployer.deploy(J2eeDeployer.java:190)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      at org.jboss.deployment.AutoDeployer.deploy(AutoDeployer.java:395)
      at org.jboss.deployment.AutoDeployer.run(AutoDeployer.java:233)
      at org.jboss.deployment.AutoDeployer.startService(AutoDeployer.java:371)
      at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:103)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      at org.jboss.configuration.ConfigurationService$ServiceProxy.invoke(ConfigurationService.java:967)
      at $Proxy0.start(Unknown Source)
      at org.jboss.util.ServiceControl.start(ServiceControl.java:79)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      at org.jboss.Main.(Main.java:208)
      at org.jboss.Main$1.run(Main.java:110)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.jboss.Main.main(Main.java:106)
      [INFO,ContainerFactory] Deploying TransformService
      [INFO,ContainerFactory] Deploying StylesheetService
      [ERROR,J2eeDeployer] Starting transformServiceEJB.jar failed!
      ---------------- snipped ends -------------------------
      Other things that did'nt work:
      - Seal the EJB-Jar
      - Add a classpath in the Manifest-File of the MBean.jar instead of adding the classes

        • 1. Re: Classpath problem

          Hi,

          For jboss2.4.4
          1) add mbean.jar to lib/ext, no need to change jboss.conf
          2) add your mbean configuration to jboss.jcml
          3) don't put the shared classes in ejb.jar

          Both the MBean and ejb.jar will share the same
          class loaded through the MLet.

          The downside is that you cannot hot-deploy the shared
          classes. You'll have to wait for jboss3.0 for that.

          Regards,
          Adrian