-
1. Re: Using external classes inside a EJB
sergiocg80 Sep 12, 2005 12:07 PM (in response to sergiocg80)Sorry, I forgot to say the reason why the classes needed by the MDB are in the war file (web-inf/classes) is that the war application also uses that classes.
-
2. Re: Using external classes inside a EJB
darranl Sep 12, 2005 3:28 PM (in response to sergiocg80)If you package the classes with the message driven bean jar instead of the war then both should be able to see the classes.
An EJB tier should not have visibility of the web application so in theory different clients could be used. -
3. Re: Using external classes inside a EJB
sergiocg80 Sep 13, 2005 4:10 AM (in response to sergiocg80)Thanks for your answer, but it seems that it didn't solve the problem. I moved one of the shared classes (due to a ClassNotFoundException) from the war file to the jar. Now the war can't find the moved class. If instead of moving I try to copy the file, the problem seems to be solved, but another one arises, the jar ask for another class, but instead of throwing a ClassNotFoundException it throws a NoClassDefFoundError. In this case, the trick of moving/copying classes doesn't work.
Any suggest? By the way, can anybody tell me what's the difference between a ClassNotFoundException and a NoClassDefFoundError?
Thanks in advance. -
4. Re: Using external classes inside a EJB
sergiocg80 Sep 13, 2005 5:53 AM (in response to sergiocg80)It works! Your answer was right, what I did was making a JAR with my classes, and put my JAR in the EBJ. All works fine.
The main difference between a ClassNotFoundException and a NoClassDefFoundError is that in the first case, the classLoader can't find the class. In the second case, the classLoader can find the class, but can't find any other classes used by the first class.
Thank you.