[jboss-user] [JNDI/Naming/Network] - looking up from JBoss to a remote application over IIOP
tof@svim
do-not-reply at jboss.com
Thu Sep 14 09:49:00 EDT 2006
I have some trouble on porting my applications from Sun One to Jboss .
My EJB application plays as a client , another application running on a JVM outside of EJB container plays as a server.
Classes implementing the server application compile with their remote interfaces, building stubs for remote calling over IIOP .
These classes bind on JNDI.
JNDI service runs outside the application server, using ?orbd? as supported by JDK.
Using Sun One , I create initial context with Sun cosnaming properties on both server side (to bind classes) and client side (in EJB to look up remote classes). And it runs.
Here are code samples
Server:
anonymous wrote : String urlOrbd = "iiop://servername:3800"
| Properties env = new Properties();
| env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
| env.put(Context.PROVIDER_URL, urlOrbd);
| Context initialNamingContext = new InitialContext(env);
| String bindServerClass = ("myService");
| Class myClass = Class.forName("MyServerClass");
| Object obj = myClass.newInstance();
| initialNamingContext.rebind(bindServerClass, obj);
Client (EJB running in application server container):
anonymous wrote : Context ic;
| Object objref;
|
| Properties env = new Properties();
| String serverUrl = "iiop://servername:3800"
| Properties env = new Properties();
| env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
| env.put(Context.PROVIDER_URL, serverUrl);
|
| MyServerClassRemInt remote;
| String service = " myService ";
| ic = new InitialContext(env);
| objref = ic.lookup(servizio);
|
| remote =( MyServerClassRemInt) PortableRemoteObject.narrow(objref, MyServerClassRemInt.class );
| remote.myMethod();
|
|
Now I have to deploy my EJB application on JBoss 4.0.4 GA. Is there someone who can tell me how I have to bind my server classes and lookup for them from my EJB client ?
I tried using ?com.sun.jndi.cosnaming.CNCtxFactory? initial context property for both binding and lookup and I get a ?NameNotFoundException? on looking up the initial context.
I tried using ?com.sun.jndi.cosnaming.CNCtxFactory? initial context property for binding and ?org.jnp.interfaces.NamingContextFactory? initial context property for lookup and I get a ?InvalidClassException?, the class I look up for is invalid for deserialization.
I tried using ?org.jnp.interfaces.NamingContextFactory? initial context property for both binding and lookup and I get a ?InvalidClassException?, the class I look up for is invalid for deserialization.
I tried using ?org.jnp.interfaces.NamingContextFactory? initial context property for binding and ?com.sun.jndi.cosnaming.CNCtxFactory? initial context property for lookup and I get a ?NameNotFoundException? on looking up the initial context.
I tried any option about syntax about defining name or looking up for them. It never runs.
I?ll be glad for any suggestion or reference.
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3971557#3971557
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3971557
More information about the jboss-user
mailing list