Problems with CDI in Websphere 8.5.5 during startup? the hidden solution. #websphere #ibm
This is not something I invented or discovered on my own, with this post I just want to raise the awareness of this major missing point IMHO in standard Websphere 8.5.5 configuration (and it's fix) and post about it, so it can be indexed and people can find the solution easily, rather than spend countless hours trying to find why their code does not work!
Thanks to this IBM forum post , and the user bpaskin who actually spotted the solution in one of the many fixes on Websphere 8.5.5 update releases.(so yes make sure you follow the release fixes)
To cut a long story short, if you are developing towards Websphere 8.5.5 (or 8) and you have resources like Startup EJB's or startup Servlet listeners and these resources are making use of CDI beans, then you will most probably have problems. Assuming that your deployable archive configuration and the classloading order of your deployed application is correct, make sure to edit your Webpshere's JVM settings and add the following.
Go to Application Application servers > serverX > Process definition > Java Virtual Machine > Custom properties and Add Name: com.ibm.ws.cdi.immediate.ejb.start Value: true
This will actually initialize the CDI engine soon enough so that CDI functionality is eventually available during startup!
IMHO again, this behavior should become standard when creating a new server /profile rather than making the application server admin, change it.