glassfish
  1. glassfish
  2. GLASSFISH-16294

PostConstruct called twice for web service

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.1
    • Fix Version/s: None
    • Component/s: web_services
    • Labels:
      None
    • Environment:

      GlassFish 3.1, Windows Vista

      Description

      Simple annotated web service with public constructor, private @PostConstruct and @PreDestroy methods, and a single web service method.
      For each call to the web service method, I see a new service object created and two calls to the PostConstruct method, e.g.

      INFO: WEB0671: Loading application [PostConstructIssue] at [/PostConstructIssue]
      INFO: PostConstructIssue was successfully deployed in 959 milliseconds.
      INFO: parsing WSDL...

      INFO: Generating code...

      INFO: Compiling code...

      INFO: Invoking wsimport with http://localhost:8080/PostConstructIssue/MyWebServiceService?WSDL
      INFO: wsimport successful
      INFO: webapp.postconstructissue.MyWebService@d4d7db constructor
      INFO: webapp.postconstructissue.MyWebService@d4d7db @PostConstruct init
      INFO: webapp.postconstructissue.MyWebService@d4d7db @PostConstruct init
      INFO: webapp.postconstructissue.MyWebService@c8d0e constructor
      INFO: webapp.postconstructissue.MyWebService@c8d0e @PostConstruct init
      INFO: webapp.postconstructissue.MyWebService@c8d0e @PostConstruct init

      Example Maven project attached.

      Aside from the double-call to the @PostConstruct method, I notice each webservice method call results in a new service object being created. This is different from GlassFish 2.1 behaviour - is it expected, and if so, is the old behaviour configurable?

        Activity

        Hide
        Romich added a comment -

        The same problem occurs even if CDI used and WebService marked with javax.enterprise.context.ApplicationScoped annotation.

        It is expected the only bean instance is created for application.

        Any news about this issue?

        Thanks.

        Show
        Romich added a comment - The same problem occurs even if CDI used and WebService marked with javax.enterprise.context.ApplicationScoped annotation. It is expected the only bean instance is created for application. Any news about this issue? Thanks.
        Hide
        dmitriy.balakin added a comment -

        Glassfish 3.1.2.2, bug is still there.

        Show
        dmitriy.balakin added a comment - Glassfish 3.1.2.2, bug is still there.

          People

          • Assignee:
            Bhakti Mehta
            Reporter:
            sennen
          • Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated: