Weblogic 6 noClassDefFound - even though it is in the classpath

Discussions

EJB programming & troubleshooting: Weblogic 6 noClassDefFound - even though it is in the classpath

  1. Hello All,

    I'm using Weblogic 6 in conjunction with WebGain/VisualCafe and am having issues trying to use a stateless EJB I have written - basically Weblogic refuses to find one of my helper classes.

    The Stateless EJB has a method defined in it which returns a 'ClassA'. ClassA is your run-of-the-mill Java class, it holds a couple of strings and is serializable. I have a small Jar file which contains a couple of helper files, of which 'ClassA' is one (it's in a seperate jar because it is used by a few EJBS).

    I can deploy my stateless EJB to Weblogic 6 successfully and after adding the Jar file containing my 'helper' classes to the Classpath entry in the StartWeblogic batch file, weblogic 6 starts-up - reporting no errors.

    However when I come to actually use an instance of the EJB my application reports a java.lang.NoClassDefFoundError stating that it cant find 'ClassA' (if I don't put the helper jar in my classpath - weblogic reports errors at startup, as would be expected).

    I know it is a problem with Weblogic 6 because the stack-dump includes some weblogic classes, though as a point of interest I dont get any message in my weblogic server Dos box.

    I fail to see what else I need to tell Weblogic - the jar it requires is in my Classpath when the server is run, the bean deploys sucessfully and Weblogic starts ok!

    Can anyone help - it's driving me more than a little insane and I'm now questioning if Weblogic 6 even works!

    Many Thanks In Advance


    Stack sump portion follows -----


           at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedO
    jectInputStream.java:106)
           at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedO
    jectInputStream.java:114)
           at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:47)
           at weblogic.rmi.internal.BasicRemoteRef.unmarshalReturn(BasicRemoteRef.j
    va:136)
           at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
    f.java:251)
           at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
    f.java:225)
           at
  2.  
     Try to put your helper classes in the same jar as your
    ejb jar.
  3. Hi - thanks for the reply.

    These classes are used by multiple EJB on the same server - and my companies configuration people would go mad if the same class file was located in multiple jars.

    Because of the fact that our Weblogic cluster holds multiple applications I can't even put the jar in an EAR - because the jar would have to be in multiple EARs - another potential configuration nightmare.

    Any other ideas?
  4. Since ur bean is deploped properly, I would suggest that U check up ur client.Is Class A in the classpath of ur client.

    Regards
  5. To my knowledge there is know other way. You either collect all your ejb's in one jar along with the utility/helper classes or you put these in all the ejb-jars.

    You can achieve this using the build tool Ant, with the tag <ejbjar> using its <support> nested tag.

    - Thomas