8 Replies Latest reply on May 30, 2006 4:02 PM by Thomas Diesler

    service not bound

    Gang Duan Newbie

      hello 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 {
       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
       } catch (ServiceException e) {
       // TODO Auto-generated catch block
       } catch (RemoteException e) {
       // TODO Auto-generated catch block
       return null;

      The exception given me is on this line:
      Service service = (Service) ctx.lookup("java:comp/env/service/TestService");

      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:
      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
      11:06:18,203 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
      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
      11:06:18,203 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
      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
      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
      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
      11:06:18,203 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)

      please help... thx

        • 1. Re: service not bound
          Gang Duan Newbie

          oh, I actually used this in my client to get the Context, and it did not work neither:

          Context ctx = new InitialContext();

          • 2. Re: service not bound
            Chander Pechetty Newbie

            Check this link

            jbossws-samples-jsr181pojo-client.jar(with application-client.xml, jaxrpc-mapping.xml etc) should be deployed on the J2EE client set up.

            You may want to set the jndi property j2ee.clientName to jbossws-client.

            • 3. Re: service not bound
              Gang Duan Newbie

              i thought the jsr181 does not need jaxrpc-mapping.xml anymore... check out this thread where thomas' comment stated

              "thomas.diesler@jboss.com" wrote:
              The jaxrpc-mapping.xml is not used - full stop.
              It is a JSR109 artifact and does not enter the game with JSR181. With JSR181 the required webservice meta data are obtained through annotations.

              • 4. Re: service not bound
                Chander Pechetty Newbie

                Sorry for the confusion. If your question is "why you shld create a mapping file", you need not as Thomas's link below mentions.
                If you build the sample using ant, it will generates the jbossws-samples-jsr181pojo-client.jar and this jar contains the jaxrpc-mapping.xml file.
                You should still be able to run the sample client by the wiki link provided below.

                • 6. Re: service not bound
                  Gang Duan Newbie


                  thanks for the help... still trying to get it work...

                  another question, once the TestService is implemented, should I see a "TestService" listed in the JNDI list? However I don't see it there... is this a problem?


                  • 7. Re: service not bound
                    Chander Pechetty Newbie

                    Yes, that would be a problem, because you are trying to look up the service .

                    I have the service deployed on JBOSS AS and run the test case successfully. Check your server log files to identify any other issues with your setup.

                    Here's the test case I use to test my client code.

                    import java.util.Properties;
                    import javax.naming.*;
                    import javax.xml.rpc.Service;
                    import org.jboss.test.ws.samples.jsr181pojo.EndpointInterface;
                    import junit.framework.*;
                    public class JBossClientTest extends TestCase
                     /** Test access to the JSR181pojo webservice via an app client */
                     public void testJSR181pojo() throws Exception
                     InitialContext iniCtx = getInitialContext();
                     Service service = (Service)iniCtx.lookup("java:comp/env/service/TestService");
                     EndpointInterface endpoint = (EndpointInterface)service.getPort(EndpointInterface.class);
                     String info = endpoint.echo("mafia");
                     assertEquals("mafia", info);
                     /** Build the InitialContext */
                     private InitialContext getInitialContext() throws NamingException
                     Properties env = new Properties();
                     env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
                     env.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming.client:org.jboss.naming");
                     env.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
                     env.setProperty("j2ee.clientName", "jbossws-client");
                     return new InitialContext(env);

                    • 8. Re: service not bound
                      Thomas Diesler Master

                      JSR181 is about server side meta data. It does not need jaxrpc-mapping.xml.

                      A WS client is fundametally disconnected and does not know nor care about the implementation details of the the server side. It relies on the abstract contract defined in wsdl and needs jaxrpc-mapping.xml to map wsdl contructs to the java.

                      With JSR109 the server also obtains the meta data from wsdl + jaxrpc-mapping.xml