on 05-31-2007 3:09 PM
Dear all,
In our project we have the following situation: (i'll TRY to explain 😛 )
Track A containing an EJB and track B containing an EJB.
EJB in Track A contains a AnInterface.java with some method.
EJB in Track B contains a SomeClass which implements AInterface.
For this, there's a @buildtime dependency on public part of EJB in A added to the used dc's of B.
In the EJB in track A there's also a class that contains the following code:
AnInterface a = (AnInterface)Class.forName("package.SomeClass").newInstance();
At first there were NoClassDefFound Exceptions, but after adding the classes from EJB in track B to a jar and adding that jar to a library and adding a reference to that library in the EJB in track B the ClassDef was found, but now there is a ClassCastException...
Is this because of different classloaders? What is the correct way to do this? (Previously it was working on BEA)
Kind regards,
J.
Joren, ejb from A and B tracks are in different ears? You need to specify reference in ear from A to ear from B.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
yes they indeed are in different ears. But if i add a reference from A to B because A needs the classes from B, i also have to add a reference from B to A, because B also needs to know the interface class from A. This however gives a cyclic reference error at deploy.
I tried a workaround by adding the classes from A to libraryA and from B to a libraryB... and referencing these so i dont get a cyclic reference error, but this solution gives me the classcastexception...
Kind regards,
J.
The classes are developed in different tracks so i prefer to keep them in different libraries... These libraries are a solution to the cyclic reference situation, but when running the application, i still get a ClassCastException because the classes are taken from different Classloaders, i think...
greetz,
J.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.