5 Replies Latest reply on Nov 27, 2010 3:36 PM by Jure Lodrant

    classloading and remote access in ejb3

    Jure Lodrant Newbie

      Hi guys

       

      I love the dynamic classloading features of Java but it seems sometimes love is not enough, I'm lacking knowledge about it. Here it goes:

       

      I'm using JBPM 3.2 in my EJB3 / web based app. JBPM is hidden in EJB3 layer. Now, I'd like to make a clear separation between everything process related on one side and the web part on the other. So I figured I'd just add some GUI content generating classes into the jbpm par archive, dynamically load them through a par classloader and simply send them as Class objects to the client. That was the theory.

       

      So far, of course, it doesn't work. I simple get an exception on Class.newInstance call on the client.

       

      On the second ran, I tried to call Class.newInstance inside the EJB and return the Object to the client as an implementation of a known interface. All I got was ClassNotFoundExceptions.

       

      Now, before I dig any further, the question: Do I have I shot here, or am I just plain lurking in the impossible land?

       

      It's basically down to this: Can a remote EJB expose a method returning an interface, of which the implementing class is dynamically evaluated and - this is vital - is not present on the client?

       

      Please, advise!

       

      Thank you..

       

      Jure