service not bound
gduan2000 May 24, 2006 12:10 PMhello all,
I am trying to get my first jsr181 pojo example working... The service seems deployed ok, and I can go to the URL and see the wsdl. The problem is that when I call the service from the client, it gives me exception says "service not bound".
here is my TestService and EndpointInterface
@WebService(name = "EndpointInterface", targetNamespace = "http://org.jboss.ws/samples/jsr181pojo", serviceName = "TestService") @SOAPBinding(style = SOAPBinding.Style.RPC) public class JSEBean01 { @WebMethod public String echo(String input) { return input; } }
public interface EndpointInterface extends Remote { String echo(String input) throws RemoteException; }
and here is my client servlet:
private static EndpointInterface port; public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(); ActionMessages messages = new ActionMessages(); try { if (port == null) { Context ctx = getInitialContext(); Service service = (Service) ctx.lookup("java:comp/env/service/TestService"); port = (EndpointInterface) service.getPort(EndpointInterface.class); } Object retObj = port.echo("system"); } catch (NamingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ServiceException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; }
The exception given me is on this line:
Service service = (Service) ctx.lookup("java:comp/env/service/TestService");
exception:
11:06:18,187 ERROR [STDERR] javax.naming.NameNotFoundException: service not bound 11:06:18,187 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:529) 11:06:18,187 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:537) 11:06:18,203 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:543) 11:06:18,203 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:267) 11:06:18,203 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:270) 11:06:18,203 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625) 11:06:18,203 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:716) 11:06:18,203 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587) 11:06:18,203 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:351) 11:06:18,203 ERROR [STDERR] at com.mycomp.myapp.web.ws.UserClientAction.execute(UserClientAction.java:43) 11:06:18,203 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java: 419) 11:06:18,203 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224) 11:06:18,203 ERROR [STDERR] at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194) 11:06:18,203 ERROR [STDERR] at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) 11:06:18,203 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:697) 11:06:18,203 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) 11:06:18,203 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterCha in.java:252) 11:06:18,203 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java: 173) 11:06:18,203 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) 11:06:18,203 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterCha in.java:202) 11:06:18,203 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java: 173) 11:06:18,203 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) 11:06:18,203 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) 11:06:18,203 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValv e.java:175) 11:06:18,203 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74) 11:06:18,203 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) 11:06:18,203 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) 11:06:18,203 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) 11:06:18,203 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) 11:06:18,203 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) 11:06:18,203 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection (Http11BaseProtocol.java:664) 11:06:18,203 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) 11:06:18,203 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:1 12) 11:06:18,203 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
please help... thx