I see a couple things.  First, you say you are trying to get to an EJB on a remote box, but then you are setting your provider.url to localhost.  If you are on the default port (1099), you don't need to specify either it or jnp, since jnp is the default protocol.  Lastly,   you are updating the System properties, then you are creating an InitialContext with the same set of properties.  You don't need to do both.  If you are changing the system properties, it affects the whole JVM, so you don't need to set them for the initial context.
----- Original Message -----
Sent: Monday, May 13, 2002 3:15 PM
Subject: [JBoss-user] Tomcat standalone malformed URL to connect JBOSS

I'm trying to lookup EJB in a remote machine from tomcat and i'm getting the following error
obs: i'm using jboss 3 RC2 and tomcat 4.0.1 in windows
:
 
Code:
 
Properties newProps = System.getProperties();
newProps.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
newProps.put("java.naming.provider.url","jnp://localhost:1099/");
newProps.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
System.setProperties (newProps);
 
InitialContext jndiContext = new InitialContext(newProps);
Object ref = jndiContext.lookup("ejb/CobrancaFacade");
CobrancaFacadeHome home = (CobrancaFacadeHome) PortableRemoteObject.narrow(ref,CobrancaFacadeHome.class);
cobrancaFacade = home.create();
 
 
Exception:
 
javax.naming.CommunicationException.  Root exception is java.rmi.ServerException: RemoteException oc
curred in server thread; nested exception is:
        java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
        java.net.MalformedURLException: no protocol: de
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
        at sun.rmi.transport.Transport$1.run(Transport.java:148)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
        at java.lang.Thread.run(Thread.java:536)
        at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
 
        at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
        at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:368)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:352)
        at javax.naming.InitialContext.lookup(InitialContext.java:354)
        at br.com.sicredi.cobranca.cliente.bd.CobrancaBD.<init>(CobrancaBD.java:46)
        at br.com.sicredi.cobranca.cliente.web.PesquisaPracaAction.executa(PesquisaPracaAction.java:
112)
        at br.com.sicredi.fw.cliente.web.TemplateAction.execute(TemplateAction.java:37)
        at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:437)
 
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:264)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1109)
        at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:452)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j
ava:247)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)

Reply via email to