users@glassfish.java.net

rmi Unmarshal exception trying to access ejb on a remote host/app server

From: <glassfish_at_javadesktop.org>
Date: Wed, 27 May 2009 15:35:17 PDT

I am having problems accessing ejbs that reside on a Jboss server from a web application running on Glassfish v2.1

I'm able to access the ejb and make updates using a command-line app, but have problems when trying to access it from a web app running in Glassfish V2. The class/method I am using works fine when I invoke it using junit, but when I invoke it from our web application. It gets the following errors when it tries to get the API. I am using the APISuppoprt class that came with the java/ejb example.

I set the properties of the System class and then retrieve them using getProperties in the init method.

Here's the system properties being set:
Properties props = System.getProperties();
props.setProperty("java.naming.provider.url", "192.168.1.206:1099");
props.setProperty("java.naming.provider.port", "8080");
props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming.client");
props.setProperty("jnp.socketFactory", "org.jnp.interfaces.TimedSocketFactory");
props.setProperty("jnp.timeout", "0");
props.setProperty("jnp.sotimeout", "0");
System.setProperties(props);
APISupport.init();
_api = APISupport.getAPI();

Here's the APISupport.getAPI method, it appears there is a problem when it does the initial context lookup:

public static API getAPI(){
try{
// API. Because this is a Stateless Session Bean, we can cache the instance we are using
if( __api != null ) return __api;
Object obj = __iniCtx.lookup(APIHome.JNDI_NAME);
APIHome apiHome = (APIHome) PortableRemoteObject.narrow(obj, APIHome.class);
__api = apiHome.create();
return __api;

And here is the stack trace:
2009-05-26 08:48:40,604 INFO (org.springframework.web.servlet.DispatcherServlet:250) - FrameworkServlet 'dispatch': initialization completed in 125 ms
javax.naming.CommunicationException [Root exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.net.MalformedURLException: no protocol: and]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:780)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.attask.api.APISupport.getAPI(APISupport.java:46)
at com.lingosys.burnside.api.NameConverter.go(NameConverter.java:50)
[Message sent by forum member 'mikephoenix' (mikephoenix)]

http://forums.java.net/jive/thread.jspa?messageID=347983