Ok, it was solved. I had two differnt classloaders, and both of them had similar classes of my POJOs, so it brought me to X.class.equals(X.class) -> false and crushed my cast to interface, because methods had different signatures.
ClassCastException getting remote stub from JBoss 7 with JNLP
-
07-07-2023 - |
Vra
I've wrote an adapter to get a remote interface of my bean from JBoss 7.
public DAdapter(Context context, boolean remote) throws DAdapterException {
try {
if (context==null){
context = new InitialContext();
}
String res = "ear_name/jar_name/DAdapterBean!xxx.yyy.DAdapterRemote";
dAdapter = (IDAdapter)context.lookup(res);
} catch(Exception ex) {
ex.printStackTrace();
throw new DAdapterException("Could not create DmsAdapter service.", ex);
}
}
DAdapterRemote is a remote interface, that extends IDAdapter. Its EJB3. If I run this method from sandbox (from Eclipse), it works like a charm. But when I do it in my JNLP application context, I get ClassCastException.
context.lookup(res)
returns me sun.proxy.$Proxy in both cases and it has methods declared in IDAdapter.
I even tried reflections but it seems that argument classes versions are different from the ones, used in interface - at least it can't find appropriate methods by (methodName, args) method. I can swear they are the same.
What should I check first?
Oplossing
Gelisensieer onder: CC-BY-SA met toeskrywing
Nie verbonde aan StackOverflow