Skip to content
This repository has been archived by the owner on Jan 27, 2021. It is now read-only.

Fix for CDI Component Initialization on IBM WebSphere 8.5.5.12 Update #24

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

arnigu
Copy link

@arnigu arnigu commented Aug 16, 2017

Problem

After upgrading to IBM WebSphere Update 8.5.5.12, startup errors occur due to initialization error of the Jersey (JAX-RS) v.1.17.1 libraries, failing to setup the REST endpoints.

Reason

The the reason for the problem is that the initialization phase of the Jersey (v1.17.1), is accessing the java:comp/BeanManager from JNDI.

In the IBM WebSphere 8.5.5.12 Update, the fix APR PI66630 UnsatisfiedResolutionException thrown in non-CDI environment , changes the behaviour and returns an object of javax.naming.Reference, instead of previously throwing an UnsatisfiedResolutionException. (http://www-01.ibm.com/support/docview.wss?rs=180&uid=swg1PI66630)

This causes a java.lang.ClassCastException: javax.naming.Reference incompatible with javax.enterprise.inject.spi.BeanManager in the class com.sun.jersey.server.impl.cdi.CDIComponentProviderFactory constructor which is not caught, breaking the Jersey initialization, stopping the subsequent initialization to progress.

See: https://github.com/jersey/jersey-1.x/blob/1.19.3/jersey-servlet/src/main/java/com/sun/jersey/server/impl/cdi/CDIComponentProviderFactory.java#L90

The change in code involved capturing the exception and logging the problem, however still continuing with other initialization, invoked from https://github.com/jersey/jersey-1.x/blob/1.19.3/jersey-servlet/src/main/java/com/sun/jersey/spi/container/servlet/WebComponent.java#L572

Copy link
Member

@japod japod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants