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

WildFly creates too many instances of all web service classes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • 22.0.0.Beta1, 22.0.0.Final
    • 8.0.0.Final, 16.0.0.Final, 19.0.0.Final
    • Web Services
    • None
    • Hide

      Deploy the attached war in a Wildfly server, then call the SOAP function for example with SOAP-UI. Check the log messages of the constructor.

      http://localhost:8080/Test-1.0-SNAPSHOT/SoapService

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:test="http://test.mvneco.com/">
         <soapenv:Header/>
         <soapenv:Body>
            <test:test>
               <arg0>?</arg0>
            </test:test>
         </soapenv:Body>
      </soapenv:Envelope>
      
      Show
      Deploy the attached war in a Wildfly server, then call the SOAP function for example with SOAP-UI. Check the log messages of the constructor. http://localhost:8080/Test-1.0-SNAPSHOT/SoapService <soapenv:Envelope xmlns:soapenv= "http: //schemas.xmlsoap.org/soap/envelope/" xmlns:test= "http://test.mvneco.com/" > <soapenv:Header/> <soapenv:Body> <test:test> <arg0>?</arg0> </test:test> </soapenv:Body> </soapenv:Envelope>
    • Low

    Description

      1) My @Webservice classes are all constructed multiple times (3x - 4x) but I expected only one instance.
      2) Only the second instance receives a call to the observer method for initialization. I expect that this method is called in each instance.

      The issue can be reproduced with the attached minimum project on Wildfly 8 with JDK 8 as well as Wildfly 16 with JDK 11.

      Complete source code of the whole application:

      package com.mvneco.test;
      
      import javax.enterprise.context.ApplicationScoped;
      import javax.enterprise.context.Initialized;
      import javax.enterprise.event.Observes;
      import javax.jws.WebMethod;
      import javax.jws.WebService;
      import org.apache.commons.logging.Log;
      import org.apache.commons.logging.LogFactory;
      
      @ApplicationScoped
      @WebService
      public class SoapService
      {
          private Log log = LogFactory.getLog(SoapService.class);
      
          public SoapService() 
          {
              log.debug("Init SoapService 1");
          }
      
          @WebMethod(exclude = true)
          public void init(@Observes @Initialized(ApplicationScoped.class) Object init)
          {
              log.debug("Init SoapService 2");
          }
      
          @WebMethod
          public String test(String payload)
          {
              log.debug("Start test(). payload="+payload);
              return "OK";
          }
      }
      

      Extract from Log messages that show the issue (the complete log is in the attached ZIP):

      2019-04-17 13:12:21,399 DEBUG [com.mvneco.test.SoapService] (MSC service thread 1-2) Init SoapService 1
      2019-04-17 13:12:23,068 DEBUG [com.mvneco.test.SoapService] (ServerService Thread Pool -- 74) Init SoapService 1
      2019-04-17 13:12:23,070 DEBUG [com.mvneco.test.SoapService] (ServerService Thread Pool -- 74) Init SoapService 2
      2019-04-17 13:12:23,475 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 16.0.0.Final (WildFly Core 8.0.0.Final) started in 10514ms - Started 510 of 699 services (337 services are lazy, passive or on-demand)
      2019-04-17 13:12:28,920 INFO  [org.apache.cxf.services.SoapService.REQ_IN] (default task-1) REQ_IN
          Address: http://localhost:8080/Test-1.0-SNAPSHOT/SoapService
          ...
      2019-04-17 13:12:28,932 DEBUG [com.mvneco.test.SoapService] (default task-1) Init SoapService 1
      2019-04-17 13:12:28,937 DEBUG [com.mvneco.test.SoapService] (default task-1) Init SoapService 1
      2019-04-17 13:12:28,937 DEBUG [com.mvneco.test.SoapService] (default task-1) Start test(). payload=?
      2019-04-17 13:12:28,969 INFO  [org.apache.cxf.services.SoapService.RESP_OUT] (default task-1) RESP_OUT
          Content-Type: text/xml
          ...
      

      Attachments

        1. standalone.xml
          29 kB
        2. Test.zip
          11 kB
        3. Test-1.0-SNAPSHOT.war
          3 kB

        Issue Links

          Activity

            People

              parsharm Parul Sharma
              s.frings74 Stefan Frings (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: