Hi all,
I have two J2EE apps, one depending on the other. Everything works fine, until I try to deploy them both in the same instance of the application server. If I run them both in the same instance of WAS, I get an IllegalArgumentException when I call create() on the Home interface. It appears that the underlying stub (dynamic proxy) is botched in some way. Here is a snippet from the stack trace:
java.lang.IllegalArgumentException: object is not an instance of declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sap.engine.services.rmi_p4.reflect.LocalInvocationHandler.invokeInternal(LocalInvocationHandler.java:61)
at com.sap.engine.services.rmi_p4.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:46)
at $Proxy11.create(Unknown Source)
at
turtle.common.server.connect.RemoteFactory.getRegistryRemote(RemoteFactory.java:134)
....
....
The offending code looks like:
String initialContextFactory = "com.sap.engine.services.jndi.InitialContextFactoryImpl";
String url = "172.16.1.38:50004";
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
env.put(Context.PROVIDER_URL, url);
String user = "user";
String pw = "pw";
env.put(Context.SECURITY_PRINCIPAL, user);
env.put(Context.SECURITY_CREDENTIALS, pw);
try {
Context ctx = new InitialContext(env);
Object o = ctx.lookup(jndiName);
SBRegistryRemoteHome home = (SBRegistryRemoteHome)PortableRemoteObject.narrow(o, SBRegistryRemoteHome.class);
return home.create();
} catch (Exception e) {
...
}
The JNDI lookup works find, but all bombs on the home.create() method.
I suspect this may have something to do with classloading (duplicate class definitions, etc). Keep in mind, this all works fine if the applications are running in separate containers. Also, both apps are full on J2EE apps, not "application clients" in the J2EE sense.
I am running WAS early release 6.4 on window XP.
Anybody seen this before or know what the problem is?
TIA,
Chad