14 Replies Latest reply on Sep 17, 2007 5:06 AM by Anders Berglund

    Calling a remote ejb interface in app1.ear from a servlet in

    Anders Berglund Newbie

      As topic says, I want to call a session bean which is deployed in an ejb-jar inside app1.ear, I am calling it from a servlet which is deployed in a war-file inside app2.ear.

      Since I have problems with dom4j/jaxen classloading colliding with the jboss jars I have isolated both ear classloading by using this in jboss-app.xml for both app1 and app2:


      But with this configuration I can't make it work. :(
      App1.ear works 100% but I can't call it from app2.ear..

      I have tried all kinds of configurations, my main attempt (which I still think should work) is to put the ejb-jar.jar from app1.ear in the root of app2.ear and thereby get it in the classpath of app2.
      But this doesn't work, I check in jmx-console for the loader-repository of app2 and the ejb-jar.jar is not loaded even if it is in the root of app2.ear. This results in a NoClassDefFoundException when trying to call app1 from the servlet in app2.

      There is one way to get the ejb-jar.jar loaded in app2 classloader. That is if I put a reference to the ejb-jar.jar in the Class-Path attribute of the manifest.mf for the war-file in app2.ear.
      Then I can see it in the loader-repository for app2.ear, but now I get a ClassCastException on portableobject.narrow when calling app1 session bean from the servlet in app2.ear/war.

      I guess the classcastexception is related to what is said in this thread: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=66651 which says that I can't put interface classes in web-inf/lib of the war.
      I guess that even if I haven't put the ejb-jar.jar in web-inf/lib (it's in the root of app2.ear) I get this error because it is loaded by the war-classloader which gives the same effect as if I would have put it in web-inf/lib..?

      So, how can I get the ejb-jar.jar loaded in app2.ear without putting a class-path reference in the manifest.mf of the war-file? There is no other ejb or web-module in app2.ear.

      Any other suggestion on how to package these applications on JBoss would be appreciated to. It works without problems on Websphere and Weblogic..

      Would really appreciate some help. :)

      (In this thread I wrote some more about my problem but then I was not really sure about what was happening: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=81466)