This is a tricky one. Both the
org.apache.openejb.client.RemoteInitialContextFactory and
org.apache.openejb.client.EJBObjectProxy are in the same jar so should
be available equally.
I wonder if eclipse is changing the thread context classloader to one
that doesn't contain the openejb-client library. Right before your
lookup call, execute some code like this to see what is there.
ClassLoader cl = Thread.currentThread().getContextClassLoader();
cl.loadClass("org.apache.openejb.client.EJBObjectProxy");
We use the thread context classloader to deserialize the objects that
come off the wire, so if it's changed to a classloader that doesn't
contain your app and the openejb-client jar than nothing will work.
-David
On Oct 30, 2008, at 5:43 AM, Wilingson wrote:
I have an eclipse RCP application based on eclipse 3.4. I want it to
connect
remotely to and openejb server. I have openejb-client-3.0.jar on the
classpath. My connection and lookup code is as follows:
try {
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.RemoteInitialContextFactory");
InitialContext ctx = new InitialContext(properties);
Server s = (Server) ctx.lookup(Server.class.getName()
+"Remote");
} catch (Exception e) {
e.printStackTrace();
}
This piece of code bombs out at the line : Server s = (Server)
ctx.lookup(Server.class.getName()+"Remote");
with the following stack trace:
java.lang.IllegalArgumentException: interface
org.apache.openejb.client.EJBObjectProxy is not visible from class
loader
at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
at
org
.apache
.openejb
.client
.proxy.Jdk13ProxyFactory.newProxyInstance(Jdk13ProxyFactory.java:118)
at
org
.apache
.openejb
.client.proxy.ProxyManager.newProxyInstance(ProxyManager.java:107)
at
org
.apache
.openejb
.client.EJBObjectHandler.createEJBObjectProxy(EJBObjectHandler.java:
102)
at
org
.apache
.openejb.client.JNDIContext.createBusinessObject(JNDIContext.java:207)
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:248)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at
zw
.co
.synergy.supervision.SuperVisionPlugin.start(SuperVisionPlugin.java:
45)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl
$2.run(BundleContextImpl.java:1009)
at java.security.AccessController.doPrivileged(Native Method)
at
org
.eclipse
.osgi
.framework
.internal
.core.BundleContextImpl.startActivator(BundleContextImpl.java:1003)
at
org
.eclipse
.osgi
.framework
.internal.core.BundleContextImpl.start(BundleContextImpl.java:984)
at
org
.eclipse
.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:
346)
at
org
.eclipse
.osgi
.framework.internal.core.AbstractBundle.start(AbstractBundle.java:265)
at
org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:
400)
at
org
.eclipse
.core
.runtime
.internal
.adaptor
.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111)
at
org
.eclipse
.osgi
.baseadaptor
.loader.ClasspathManager.findLocalClass(ClasspathManager.java:427)
at
org
.eclipse
.osgi
.internal
.baseadaptor
.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:193)
at
org
.eclipse
.osgi
.framework
.internal.core.BundleLoader.findLocalClass(BundleLoader.java:368)
at
org
.eclipse
.osgi
.framework
.internal.core.BundleLoader.findClassInternal(BundleLoader.java:444)
at
org
.eclipse
.osgi
.framework.internal.core.BundleLoader.findClass(BundleLoader.java:397)
at
org
.eclipse
.osgi
.framework.internal.core.BundleLoader.findClass(BundleLoader.java:385)
at
org
.eclipse
.osgi
.internal
.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:87)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at
org
.eclipse
.osgi
.framework.internal.core.BundleLoader.loadClass(BundleLoader.java:313)
at
org
.eclipse
.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:
227)
at
org
.eclipse
.osgi
.framework
.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1274)
at
org
.eclipse
.core
.internal
.registry
.osgi
.RegistryStrategyOSGI
.createExecutableExtension(RegistryStrategyOSGI.java:160)
at
org
.eclipse
.core
.internal
.registry
.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:
867)
at
org
.eclipse
.core
.internal
.registry
.ConfigurationElement
.createExecutableExtension(ConfigurationElement.java:243)
at
org
.eclipse
.core
.internal
.registry
.ConfigurationElementHandle
.createExecutableExtension(ConfigurationElementHandle.java:51)
at
org
.eclipse
.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:188)
at
org
.eclipse
.core
.runtime
.internal
.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:
110)
at
org
.eclipse
.core
.runtime
.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at
org
.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:
382)
at
org
.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:
179)
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:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
--
View this message in context:
http://www.nabble.com/Help%3A-Eclipse-RCP-as-remote-OpenEJB-client-tp20246147p20246147.html
Sent from the OpenEJB User mailing list archive at Nabble.com.