EJB 3.0 on JBoss Server and JSF client on Apache Tomcat
grdzeli_kaci Jul 24, 2006 10:15 AMi've jboss-4.0.4.GA and a'm using EJB 3.0 on my local machine
i've created one table on DataBase and Entity Bean
also i've remote session fasade bean .
it's all working when i run client on my machine
client code :
try { InitialContext ctx = new InitialContext(); StudentFasade bean = (StudentFasade) ctx .lookup("StudentFasadeBean/remote"); for (int i = 0; i < 10; i++) { StudentBean stbean = new StudentBean(); stbean.setName("Paata"); stbean.setSurname("Lominadze"); stbean.setAge(new BigDecimal(24)); GroupsBean gbean = new GroupsBean(); gbean.setFaculty("Economic with Informatics"); gbean.setGroupnumber(new BigDecimal(108940)); gbean.setSpecial("Programming"); Integer retID = bean.addStudent(stbean, gbean); System.out.println(retID); } } catch (NamingException e) { e.printStackTrace(); }
but i want run my client in other machine on the network using tomcat
client code :
Properties jndiProps = new Properties(); jndiProps.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); jndiProps.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interface"); jndiProps.setProperty(Context.PROVIDER_URL, "jnp://192.168.9.6:1099"); InitialContext ctx = new InitialContext(jndiProps ); StudentFasade bean = (StudentFasade) ctx .lookup("StudentFasadeBean/remote"); for (int i = 0; i < 10; i++) { StudentBean stbean = new StudentBean(); stbean.setName("Paata"); stbean.setSurname("Lominadze"); stbean.setAge(new BigDecimal(24)); GroupsBean gbean = new GroupsBean(); gbean.setFaculty("Economic with Informatics"); gbean.setGroupnumber(new BigDecimal(108940)); gbean.setSpecial("Programming"); Integer retID = bean.addStudent(stbean, gbean); System.out.println(retID);
but i get an error like this :
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: 5.5/common/classes/] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:722) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587) at javax.naming.InitialContext.lookup(InitialContext.java:351) at com.magti.jsf.doConnect(jsf.java:44) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126) at javax.faces.component.UICommand.broadcast(UICommand.java:305) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75) at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595) Caused by: 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: 5.5/common/classes/ at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:325) at sun.rmi.transport.Transport$1.run(Transport.java:153) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:149) 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:595) 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:126) at org.jnp.server.NamingServer_Stub.lookup(Unknown Source) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625) ... 29 more Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: java.net.MalformedURLException: no protocol: 5.5/common/classes/ at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:282) at sun.rmi.transport.Transport$1.run(Transport.java:153) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:149) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701) ... 1 more
can anybody help me :( it's make me crazy. :(
thanks.