[GLASSFISH-17842] Deployment of not spec conform EJB succeeds / @PostConstruct Created: 29/Nov/11  Updated: 20/Dec/16  Resolved: 20/Mar/13

Status: Resolved
Project: glassfish
Component/s: deployment
Affects Version/s: 3.1.1
Fix Version/s: 4.0_dev

Type: Bug Priority: Major
Reporter: myfear Assignee: Hong Zhang
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Win 7, JDK 7

Attachments: File PostConstructTest.war     Java Source File PostConstructTestBean.java    
Tags: 3_1_2-exclude, deployment, spec


According to Java EE 6 spec an EJB method with @PostConstruct MUST NOT throw a checked Exception.

Deployment validation seems not to check this, as it is possible to deploy such an EJB without any warnings.
See example below.

Comment by marina vatkina [ 14/Dec/11 ]

This is a generic annotation

Comment by Hong Zhang [ 14/Dec/11 ]

ok, we will see what we can do from the deployment side in the next release.

Comment by Jeremy_Lv [ 03/Sep/12 ]

I'll look into this issue and try to check the validation about it.

Comment by Jeremy_Lv [ 05/Sep/12 ]

I think the deployment validation about @PostConstruct and @PostDestroy haven't checked the specification documented by community.
We'd better add a validation method about checking it from the deployment side as the specification documented.

Comment by Hong Zhang [ 07/Sep/12 ]

Ok, you can look into where would be the best place to add this and how to add this. If this is a EJB specific check, probably the check should go into main/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/util/EjbBundleValidator.java, if it's a validation applied to multiple areas, probably the check should be added to the base class validator main/appserver/deployment/dol/src/main/java/com/sun/enterprise/deployment/util/ComponentValidator.java

Comment by Hong Zhang [ 20/Mar/13 ]

Added validation logic to validate lifecycle methods annotated with @PostConstruct and @PreDestroy to conform to the EE spec.

Generated at Mon Apr 24 09:15:56 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.