4 Replies Latest reply on Apr 28, 2004 2:48 PM by barre30

    Problem accessing JBoss from Tomcat 4.1

    barre30 Newbie

      Hi all

      I have basic stateless EJB on Jboss when access these EJB from java stand alone application it works fine. However I have problem when I try to access from servlet on tomcat. I think the problem is on lookup. please help.

      this is servlet code
      Hashtable env = new Hashtable();

      //byte[] bt = {10, 142, 50, 124};
      env.put( Context.INITIAL_CONTEXT_FACTORY , "org.jnp.interfaces.NamingContextFactory");

      env.put(Context.PROVIDER_URL , "10.142.50.61:1099");
      env.put("java.namig.factory.url.pkgs" , "org.jboss.naming:org.jnp.interfaces");

      try
      {
      Context ctx = new InitialContext( env );
      Object ob = ctx.lookup("jnp://localhost:1099/FirstEjbBean");
      FirstEjbHome home = (FirstEjbHome)PortableRemoteObject.narrow( ob , FirstEjbHome.class );
      ejb = home.create();
      System.out.println( ejb.sayHello() );
      ejb.remove();
      }

      catch( Exception e )
      {
      e.printStackTrace();
      }
      this is EJB References in tomcat web.xml
      <ejb-ref>
      First Ejb
      <ejb-ref-name>FirstEjbBean</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      FirstEjbHome
      FirstEjb
      </ejb-ref>

      this is server out put

      javax.naming.CommunicationException [Root exception is java.rmi.ServerException:
      RemoteException occurred in server thread; nested exception is:
      java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
      tion is:
      java.net.MalformedURLException: no protocol: Files/Apache]
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:647)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at FirstEjbServlet.doLookUp(FirstEjbServlet.java:59)
      at FirstEjbServlet.doGet(FirstEjbServlet.java:31)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServl
      et.java:466)
      at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java
      :180)
      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(Appl
      icationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
      ilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
      alve.java:256)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
      t.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
      a:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
      alve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
      t.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
      a:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
      2417)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
      ava:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
      t.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
      rValve.java:171)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
      t.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
      ava:172)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
      t.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
      a:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
      ve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
      t.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
      a:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:19
      3)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
      :781)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
      ssConnection(Http11Protocol.java:549)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
      :589)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
      ool.java:666)
      at java.lang.Thread.run(Thread.java:534)
      Caused by: java.rmi.ServerException: RemoteException occurred in server thread;
      nested exception is:
      java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
      tion is:
      java.net.MalformedURLException: no protocol: Files/Apache
      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:4
      60)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
      .java:701)
      at java.lang.Thread.run(Thread.java:534)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
      RemoteCall.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:528)
      ... 39 more
      Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested ex
      ception is:
      java.net.MalformedURLException: no protocol: Files/Apache
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:249)
      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:4
      60)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
      .java:701)
      ... 1 more
      Caused by: java.net.MalformedURLException: no protocol: Files/Apache
      at java.net.URL.(URL.java:537)
      at java.net.URL.(URL.java:434)
      at java.net.URL.(URL.java:383)
      at sun.rmi.server.LoaderHandler.pathToURLs(LoaderHandler.java:747)
      at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:147)
      at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:631)
      at org.jboss.system.JBossRMIClassLoader.loadClass(JBossRMIClassLoader.ja
      va:74)
      at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:257)
      at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.jav
      a:200)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:151
      3)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
      626)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
      at javax.naming.CompoundName.readObject(CompoundName.java:554)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:838
      )
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1746)

      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
      646)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
      at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:297)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:246)
      ... 6 more