Eclipse RCP Client via RMI over HTTP to a JBoss AS. ClassCastException
"rhuguet (sent by Nabble.com)" <[email protected]> Fri, 27 Jan 2006 05:03:35 -0800
| Newsgroups | gmane.comp.java.sun.rmi |
|---|---|
| Message-ID | <[email protected]> |
Hi there
I have problems to connect with an Eclipse RCP Client via RMI over HTTP to a JBoss AS.
To avoid security problems i wrote a SecurityManager which allows everything:
My SecurityManager that allows everything:
package com.prodega.ejbtest.security;
import java.security.Permission;
public class MySecurityManager extends SecurityManager {
public MySecurityManager() {
}
public void checkPermission() {
}
public void checkPermission(Permission perm) {
}
public void checkPermission(Permission perm, Object context) {
}
}
My JavaCode to connect from the RCP Client:
System.setProperty( "java.naming.factory.initial", "org.jboss.naming.HttpNamingContextFactory" );
System.setProperty( "java.naming.provider.url", "http://localhost:8080/invoker/JNDIFactory" );
Context ctx = new InitialContext();
ctx.getEnvironment();
// Set MySecurityManager
System.setSecurityManager(new MySecurityManager());
Object ref = ctx.lookup("ejb/BenutzerManager");
BenutzerManagerHome home = (BenutzerManagerHome) ref;
BenutzerManager bean = home.create();
The Result:
The ctx.lookup returns a Proxy with my ejb/BenutzerManager Object
but in BenutzerManagerHome home = (BenutzerManagerHome) ref;
i get a ClassCastException.
If i use the same statements in a JavaApplication evrything works fine. The JavaApplication is also called from inside Eclipse in debug mode.
The Program is in the same package as the RCP Client (Plug-in).
I recompiled the programs and deployed them on the server (version on Server and Client are the same).
I compared the Proxys which i receive from the Server for the JavaApplication and for the RCP Client. For me they look the same.
Here an extract of the Proxy from the JavaApplication (which works):
ref= $Proxy1 (id=38 )
loaderToCache= WeakHashMap (id=50)
m0= Method (id=54)
m1= Method (id=60)
m2= Method (id=61)
m3= Method (id=62)
m4= Method (id=63)
m5= Method (id=64)
m6= Method (id=65)
m7= Method (id=66)
m8= Method (id=67 )
nextUniqueNumber= 2 [0x2] [^B]
nextUniqueNumberLock= Object (id=68 )
pendingGenerationMarker= Object (id=69)
proxyClasses= Collections$SynchronizedMap (id=70)
h= ClientContainer (id=73)
ejb/BenutzerManagerHome
{sun.misc.Launcher$AppClassLoader@92e78c={[org.jnp.interfaces.Naming]=java.lang.ref.WeakReference@bcb23e}, sun.rmi.server.LoaderHandler$Loader@1c4f0f8["http://RhuLaptop:8083/"]={[com.prodega.ejbtest.interfaces.BenutzerManagerHome, javax.ejb.Handle]=java.lang.ref.WeakReference@5a3923}}
public native int java.lang.Object.hashCode()
public boolean java.lang.Object.equals(java.lang.Object)
public java.lang.String java.lang.Object.toString()
public abstract com.prodega.ejbtest.interfaces.BenutzerManager com.prodega.ejbtest.interfaces.BenutzerManagerHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException
public abstract void javax.ejb.EJBHome.remove(java.lang.Object) throws java.rmi.RemoteException,javax.ejb.RemoveException
public abstract void javax.ejb.EJBHome.remove(javax.ejb.Handle) throws java.rmi.RemoteException,javax.ejb.RemoveException
public abstract javax.ejb.EJBMetaData javax.ejb.EJBHome.getEJBMetaData() throws java.rmi.RemoteException
public abstract javax.ejb.HomeHandle javax.ejb.EJBHome.getHomeHandle() throws java.rmi.RemoteException
public abstract javax.ejb.EJBObject javax.ejb.Handle.getEJBObject() throws java.rmi.RemoteException
2
java.lang.Object@17918f0
java.lang.Object@1546dbc
{class $Proxy0=null, class $Proxy1=null}
org.jboss.proxy.ClientContainer@1d9e282
org.jboss.invocation.InvocationContext@1e0512a
org.jboss.proxy.ejb.HomeInterceptor@1f0aecc
class java.lang.Object
class java.lang.Object
interface javax.ejb.EJBHome
interface javax.ejb.EJBObject
interface javax.ejb.EJBObject
interface javax.ejb.Handle
org.jboss.proxy.SecurityInterceptor@1408a92
An extract from the h=ClientContainer EJB-METADATA
org.jboss.proxy.ejb.EJBMetaDataImpl@aa0877
interface com.prodega.ejbtest.interfaces.BenutzerManagerHome
org.jboss.proxy.ejb.handle.HomeHandleImpl@650892
null
interface com.prodega.ejbtest.interfaces.BenutzerManager
Here an extract of the Proxy from the RCP Client (which failes):
ref= $Proxy1 (id=84)
loaderToCache= WeakHashMap (id=99)
m0= Method (id=104)
m1= Method (id=110)
m2= Method (id=111)
m3= Method (id=112)
m4= Method (id=113)
m5= Method (id=114)
m6= Method (id=115)
m7= Method (id=116)
m8= Method (id=117)
nextUniqueNumber= 2 [0x2] [^B]
nextUniqueNumberLock= Object (id=118)
pendingGenerationMarker= Object (id=119)
proxyClasses= Collections$SynchronizedMap (id=120)
h= ClientContainer (id=123)
ejb/BenutzerManagerHome
{sun.rmi.server.LoaderHandler$Loader@135605a["http://RhuLaptop:8083/"]={[com.prodega.ejbtest.interfaces.BenutzerManagerHome, javax.ejb.Handle]=java.lang.ref.WeakReference@1da87db}, org.eclipse.core.runtime.internal.adaptor.ContextFinder@1687e7c={[org.jnp.interfaces.Naming]=java.lang.ref.WeakReference@d6c07}}
public native int java.lang.Object.hashCode()
public boolean java.lang.Object.equals(java.lang.Object)
public java.lang.String java.lang.Object.toString()
public abstract com.prodega.ejbtest.interfaces.BenutzerManager com.prodega.ejbtest.interfaces.BenutzerManagerHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException
public abstract void javax.ejb.EJBHome.remove(java.lang.Object) throws java.rmi.RemoteException,javax.ejb.RemoveException
public abstract void javax.ejb.EJBHome.remove(javax.ejb.Handle) throws java.rmi.RemoteException,javax.ejb.RemoveException
public abstract javax.ejb.EJBMetaData javax.ejb.EJBHome.getEJBMetaData() throws java.rmi.RemoteException
public abstract javax.ejb.HomeHandle javax.ejb.EJBHome.getHomeHandle() throws java.rmi.RemoteException
public abstract javax.ejb.EJBObject javax.ejb.Handle.getEJBObject() throws java.rmi.RemoteException
2
java.lang.Object@11ff451
java.lang.Object@e0fcac
{class $Proxy0=null, class $Proxy1=null}
org.jboss.proxy.ClientContainer@1a73d30
org.jboss.invocation.InvocationContext@aefcbb
org.jboss.proxy.ejb.HomeInterceptor@528780
class java.lang.Object
class java.lang.Object
interface javax.ejb.EJBHome
interface javax.ejb.EJBObject
interface javax.ejb.EJBObject
interface javax.ejb.Handle
org.jboss.proxy.SecurityInterceptor@dfbb43
An extract from the h=ClientContainer EJB-METADATA
org.jboss.proxy.ejb.EJBMetaDataImpl@189a773
interface com.prodega.ejbtest.interfaces.BenutzerManagerHome
org.jboss.proxy.ejb.handle.HomeHandleImpl@61ec49
null
interface com.prodega.ejbtest.interfaces.BenutzerManager
What could be the problem, do You have any idea
Best Regards and thanks in advance
Rene
--
View this message in context: http://www.nabble.com/Eclipse-RCP-Client-via-RMI-over-HTTP-to-a-JBoss-AS.-ClassCastException-t1009910.html#a2618150
Sent from the Java - RMI forum at Nabble.com.
===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff RMI-USERS". For general help, send email to
[email protected] and include in the body of the message "help".
For a list of frequently asked RMI questions please refer to:
http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html
To view past RMI-USERS postings, please see:
http://archives.java.sun.com/archives/rmi-users.html