Note: this is fixed by applying WebLogic patch 20690287.
First lets look at what the Java EE 7 specification says about @PostConstruct:
If the method throws an unchecked exception the class MUST NOT be put into service except in the case of EJBs where the EJB can handle exceptions and even recover from them.
...
So there you go, it's quite clear that the method can throw an unchecked exception which will cause the class that the annotated method is a part of to not be put into service i.e. it should fail deployment.
So to try this out, I created a very simple JAX-WS web service and added the following method:
I used the jwsc Ant task to build the service and then the wldeploy task to deploy it. It succeeded! This is where it should have failed. To verify, I went into the WLS console...
My service was in the Active state meaning it was good to serve requests. In my example service, calls would succeed, however in the real service that I was moving over we were relying on having certain information available that was set up in the @PostConstruct annotated method. Since that information was not available, that service would fail all the time.
I wanted to be absolutely sure that WebLogic was doing something fishy, so I checked out the logs, I could definitely see my service initialising and throwing the exception.
So it looks like the issue is with WebLogic ignoring the exceptions being thrown. I've logged a service request with Oracle Support on this and they confirm the issue does not exist in 12.1.3, however at the moment 12.1.2 still has this problem.
-i