2 Replies Latest reply on Jan 10, 2006 11:49 AM by Neeraj Singh

    javax.naming.NameNotFoundException in web-service client

    Neeraj Singh Newbie

      I am trying to setup a sample web-service "QualityControlService" under JBoss 4.0.3.

      1. Below is the signature of remote web-service Interface:

      package gov.ed.fsa.payment.webservice;

      public interface QualityControlService extends Remote {
      public gov.ed.fsa.core.dto.PageableListDTO getQualityControlListing(gov.ed.fsa.payment.dto.QualityControlListingReqEDXDTO reqDTO) throws java.rmi.RemoteException;
      }

      2. I followed the JBoss web-service development process on WIKI and created necessary files using WSCOMPILE tool for client and server part:

      C:\Sun\jwsdp-1.6\jaxrpc\bin>wscompile -classpath I:\QualityControl\WebContent\WEB-INF\classes -gen:server -f:rpcliteral -mapp
      ing mapping.xml config.xml

      C:\Sun\jwsdp-1.6\jaxrpc\bin>wscompile -classpath I:\QualityControl\WebContent\WEB-INF\classes -gen:client -f:rpcliteral -mapp
      ing mapping.xml -keep config-client.xml

      WSCOMPILE tool has generated one "QualityControlListingReqEDXDTO_LiteralSerializer" class and I guess this class acts as serializer for my DTO object "QualityControlListingReqEDXDTO".

      3. I deployed server as "quality-control.war" as It is deployed correctly as I can see the deployed service using Admin console.

      4. I have created "application-client.xml" and "META-INF/jboss-client.xml" files. Below is "META-INF/jboss-client.xml":

      <jboss-client>
      <jndi-name>qualitycontrolservice-client</jndi-name>
      </jboss-client>

      5. Below is web-service client declaration:

      /** Test access to the JSE webservice via an app client */
      public static void main(String[] args)
      {
      try{
      InitialContext iniCtx = getInitialContext();
      ...
      ...
      } catch (Exception ex){
      System.out.println("???? Failed: "+ex);
      }
      }

      /** Build the InitialContext */
      private static InitialContext getInitialContext() throws NamingException
      {
      java.util.Properties env = new java.util.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", "qualitycontrolservice-client");
      return new InitialContext(env);
      }


      6. But when I try to run my web-service client following error message pops up:
      ???? Failed: javax.naming.NameNotFoundException: qualitycontrolservice-client not bound

      Theoretically my web-service client should not complain about name NOT found as it is declared in "META-INF/jboss-client.xml". Looks like something is missing on client part. Any help is appreciated, if someone can send me the directory structure for deployed components (classes and xml files) on client side it would be very helpful.

      Thanks,
      Neeraj

        • 1. Re: javax.naming.NameNotFoundException in web-service client
          Bruno Grieder Newbie

          How does your application-client.xml look like? Mine looks like this:
          (it is at the root of the jar like with jboss-client.xml)

          <?xml version="1.0" encoding="UTF-8"?>
           <application-client xmlns="http://java.sun.com/xml/ns/j2ee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application-client_1_4.xsd"
           version="1.4">
          
           <display-name>webservice client app</display-name>
          
           <service-ref>
           <service-ref-name>amalto/XtentisMDMServiceJSE</service-ref-name>
           <service-interface>com.amalto.provisioning.portal.jboss.webservices.XtentisService</service-interface>
           <wsdl-file>META-INF/wsdl/webservices.wsdl</wsdl-file>
           <jaxrpc-mapping-file>META-INF/mapping.xml</jaxrpc-mapping-file>
           </service-ref>
          
           </application-client>
          
          


          and I lookup this way:

          XtentisService service = (XtentisService)iniCtx.lookup("java:comp/env/amalto/XtentisMDMServiceJSE");


          Works fine (except for the issue posted earlier - but not linked to this specifically...)

          Also, verify that your application-client deploys correctly. It does not show in the console (because set to INFO): access the server log files or use chainsaw.

          Bruno

          • 2. Re: javax.naming.NameNotFoundException in web-service client
            Neeraj Singh Newbie

            My application-client.xml looks like:


            <application-client xmlns="http://java.sun.com/xml/ns/j2ee"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
            http://java.sun.com/xml/ns/j2ee/application-client_1_4.xsd"
            version="1.4">
            <display-name>Quality Control Service Client</display-name>
            <service-ref>
            <service-ref-name>service/QualityControlServiceServiceJSE</service-ref-name>
            <service-interface>gov.ed.fsa.payment.webservice.QualityControlServiceService</service-interface>
            <wsdl-file>WEB-INF/wsdl/QualityControlServiceService.wsdl</wsdl-file>
            <jaxrpc-mapping-file>WEB-INF/mapping.xml</jaxrpc-mapping-file>
            </service-ref>
            </application-client>

            As per WIKI I need to initialize JNDI context (see my web-service client code snippet above) before doing the initCtx.lookup(...) as mentioned by you. And in JNDI initialization I need to refer "j2ee-clientName" as the jndi-name defined in my jboss-client.xml. Thats where my web-service client fails.

            Can you write to me how you packaged your web-service client i.e. what files to put where and how to deploy it in JBoss, that'll help me. Because looks like when deploying web-service client I am NOT putting something at the right location in the JBoss.

            Thanks,
            Neeraj