0 Replies Latest reply on Jan 5, 2006 12:17 PM 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();
      gov.ed.fsa.payment.webservice.QualityControlServiceService service = (gov.ed.fsa.payment.webservice.QualityControlServiceService)iniCtx.lookup("java:comp/env/service/QualityControlServiceServiceJSE");
      QualityControlService endpoint = service.getQualityControlServicePort();

      QualityControlListingReqEDXDTO qcListByCycleDTO =
      new QualityControlListingReqEDXDTO();
      qcListByCycleDTO.setApproved(true);
      qcListByCycleDTO.setRecordCycle(-1);
      qcListByCycleDTO.setApplicationID(-1);
      qcListByCycleDTO.setYear(-1);
      qcListByCycleDTO.setMonth(-1);
      RequestPageInfoDTO iRequestPageInfoDTO = new RequestPageInfoDTO();
      iRequestPageInfoDTO.setPageSize(10);
      qcListByCycleDTO.setRequestPageInfoDTO(iRequestPageInfoDTO);

      QualityControlService qcService = (QualityControlService) service.getPort(QualityControlService.class);
      PageableListDTO oDTO = null;
      try {
      oDTO = (PageableListDTO)endpoint.getQualityControlListing(qcListByCycleDTO);
      } catch (java.lang.reflect.UndeclaredThrowableException ioex){
      System.out.println("???? Getting quality control listing: "+ioex.getUndeclaredThrowable());
      } catch (Exception ioex){
      System.out.println("???? Getting quality control listing: "+ioex);
      }
      System.out.println("output:" + oDTO);
      } 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