2 Replies Latest reply on Jun 27, 2003 12:03 PM by billelmehdi

    Problem accessing to ejb by external Servlet

    billelmehdi Newbie

      Hi, I've problem to access Ejbs deployed in jboss 3.0.4, by my servlet deployed in Tomcat 4.1.

      this my lookup method in the servlet:

      private ManagerHome lookupManager() throws NamingException {
      Properties env = new Properties();
      env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
      "org.jnp.interfaces.NamingContextFactory");
      env.setProperty(Context.PROVIDER_URL,
      "localhost:1099");
      env.setProperty(Context.URL_PKG_PREFIXES,"org.jnp.interfaces");
      InitialContext jndiContext = new InitialContext(env);
      Object objref = jndiContext.lookup("ejb/SimpleManager");
      return (ManagerHome) PortableRemoteObject.narrow(objref,ManagerHome.class);
      }

      and this is my web.xml:

      <web-app>

      <display-name>WebWAR</display-name>


      <servlet-name>ServletXml2</servlet-name>
      <display-name>ServletXml2</display-name>
      <servlet-class>servlets.ServletXml2</servlet-class>


      <servlet-mapping>
      <servlet-name>ServletXml2</servlet-name>
      <url-pattern>/ServletSave2</url-pattern>
      </servlet-mapping>

      <session-config>
      <session-timeout>30</session-timeout>
      </session-config>

      <resource-ref>
      <res-ref-name>jdbc/TestDB</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>

      <ejb-ref>
      <ejb-ref-name>ejb/SimpleManager</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      manager.ManagerHome
      manager.Manager
      <ejb-link>Manager</ejb-link>
      </ejb-ref>

      </web-app>

      My ejbs are correctly deployed in jboss, but when I try to access it from my servlet, I obtain this in Tomcat console:

      RemoteException occurred in server thread; nested exception is:
      java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
      java.net.MalformedURLException: no protocol: 4.1/common/classes/
      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: 4.1/common/classes/
      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.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
      at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:138)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:108)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
      at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:198)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
      at $Proxy0.create(Unknown Source)
      at servlets.ServletXml2.init(ServletXml2.java:52)
      at javax.servlet.GenericServlet.init(GenericServlet.java:256)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:935)
      at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:668)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
      at java.lang.Thread.run(Thread.java:536)
      Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
      java.net.MalformedURLException: no protocol: 4.1/common/classes/
      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:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      ... 1 more
      Caused by: java.net.MalformedURLException: no protocol: 4.1/common/classes/
      at java.net.URL.(URL.java:579)
      at java.net.URL.(URL.java:476)
      at java.net.URL.(URL.java:425)
      at sun.rmi.server.LoaderHandler.pathToURLs(LoaderHandler.java:743)
      at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:159)
      at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:631)
      at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:257)
      at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:200)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1513)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
      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

      Where is the problem? I can't find it, please help me.
      Thanks.