Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-3262

WebServiceRef injection without explicit wsdl file fails during Servlet initialization

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 8.1.0.CR1
    • Web Services
    • None
      • Add explicit wsdl file to an archive and specify 'wsdlLocation' parameter in @WebServiceRef
      • do not initialize the servlet on startup (not aplicable for servlet filters)

      Reproducer test available at https://github.com/bafco/wildfly/commits/wsServletInjection

      I have the following servlet

      @WebServlet(/*..., */ loadOnStartup = 1)
      public class ServletLoadOnStartup extends HttpServlet {
          @WebServiceRef(value = EndpointService.class)
          private EndpointInterface endpoint1;
          //...
      

      (It is located in the package org.jboss.as.test.integration.ws.serviceref. There you can find more info about the other classes.)

      And i get the following exception:

      org.jboss.arquillian.container.spi.client.container.DeploymentException: Cannot deploy: ws-servlet-test.war
      ...
      Caused by: java.lang.Exception: {"JBAS014671: Failed services" => {"jboss.undertow.deployment.default-server.default-host./ws-servlet-test" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./ws-servlet-test: javax.servlet.ServletException: UT010013: Could not instantiate ServletLoadOnStartup
          Caused by: javax.servlet.ServletException: UT010013: Could not instantiate ServletLoadOnStartup
          Caused by: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
          Caused by: java.lang.RuntimeException: JBAS011875: Resource lookup for injection failed: env/org.jboss.as.test.integration.ws.serviceref.ServletLoadOnStartup/endpoint1
          Caused by: javax.naming.NamingException: JBAS011878: Failed to lookup env/org.jboss.as.test.integration.ws.serviceref.ServletLoadOnStartup/endpoint1 [Root exception is org.jboss.wsf.spi.WSFException: Cannot create service]
          Caused by: org.jboss.wsf.spi.WSFException: Cannot create service
          Caused by: java.lang.reflect.InvocationTargetException
          Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
          Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
          Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem parsing 'http://localhost:8080/ws-servlet-test/EndpointService/EJB3Bean?wsdl'.: java.io.FileNotFoundException: http://localhost:8080/ws-servlet-test/EndpointService/EJB3Bean?wsdl
          Caused by: java.io.FileNotFoundException: http://localhost:8080/ws-servlet-test/EndpointService/EJB3Bean?wsdl"}}
      

      If I change loadOnStartup parameter to -1, everything works fine, i.e. servlet gets instantiated and WS is injected correctly. Therefore, I suppose this is a bug.

      Another workaround exists - adding wsdl file to the deployment archive and using the 'wsdlLocation' parameter in @WebServiceRef (as can be seen in ServiceRefSevletTestCase).

              rsearls r searls
              bafco Matus Abaffy (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: