[GLASSFISH-16294] PostConstruct called twice for web service Created: 31/Mar/11  Updated: 14/Feb/13

Status: Open
Project: glassfish
Component/s: web_services
Affects Version/s: 3.1
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: sennen Assignee: Bhakti Mehta
Resolution: Unresolved Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

GlassFish 3.1, Windows Vista

Attachments: Zip Archive postconstructissue.zip    


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?

Comment by dmitriy.balakin [ 28/Dec/12 ]

Glassfish, bug is still there.

Comment by Romich [ 14/Feb/13 ]

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?


Generated at Thu Feb 23 09:49:25 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.