Re: Eclipse RCP Client via RMI over HTTP to a JBoss AS. ClassCastExcepti

"rhuguet (sent by Nabble.com)" <[email protected]> Sun, 29 Jan 2006 05:57:33 -0800
Newsgroups gmane.comp.java.sun.rmi
Message-ID <[email protected]>
Hi Gregg
Thanks a lot for Your help.
You are right, it is a classLoader problem.
I have now a version which works. I'am not sure whether it is a good solution or not.
I should solve the security problem with a policy file and not with a SecurityManager which allows everything.
But i was not able to make the plug-in read the policy file.
Here the solution:

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();
System.setSecurityManager(new MySecurityManager());
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
Object ref = ctx.lookup("ejb/BenutzerManager");
boolean bool = BenutzerManagerHome.class.isAssignableFrom(ref.getClass());
BenutzerManagerHome home = (BenutzerManagerHome) ref;
benutzerManagerBean = home.create();
List list = benutzerManagerBean.getBenutzerByName("");
for (Iterator iter = list.iterator(); iter.hasNext();) {
        Benutzer b = (Benutzer) iter.next();
        System.out.println("Benutzername = " + b.getName());
}
One week for 10 lines of code. What do You think about that ??
Best regards and thanks a lot
Rene
--
View this message in context: http://www.nabble.com/Eclipse-RCP-Client-via-RMI-over-HTTP-to-a-JBoss-AS.-ClassCastException-t1009910.html#a2645686
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