Jersey 1.1 Style Servlet-Mapping Ignored and Unable to Start WLS 12.2.1 with "CDI definition failure:java.lang.NullPointerException"
(Doc ID 2149796.1)
Last updated on APRIL 03, 2025
Applies to:
Oracle WebLogic Server - Version 12.2.1.0.0 and laterInformation in this document applies to any platform.
Symptoms
When attempting to deploy a Jersey 1.1 application in WebLogic Server 12.2.1, it was discovered that the servlet-mapping for com.sun.jersey.spi.container.servlet.ServletContainer is ignored and an "weblogic.management.DeploymentException: CDI definition failure:java.lang.NullPointerException" occurs when starting WLS.
- This can also happen when not purposefully using Jersey APis. If you have any Jersey jar files included in the application archive you will get this same issue.
- Check the managed server logs (where deployed) for a series of warnings like <JAXRSIntegration> <BEA-219510> Cannot Add Jersey Servlet for application class com.sun.jersey,x,x,x,x,x
- See this screenshot of the logs and the primary error stack that follows:
<Error> <Deployer> <BEA-149231> <Unable to set the activation state to true for the application "xxx".
weblogic.management.DeploymentException: CDI definition failure:java.lang.NullPointerException
at com.oracle.injection.integration.CDIAppDeploymentExtension.initCdi(CDIAppDeploymentExtension.java:79)
at com.oracle.injection.integration.CDIAppDeploymentExtension.activate(CDIAppDeploymentExtension.java:41)
at weblogic.application.internal.flow.AppDeploymentExtensionFlow.activate(AppDeploymentExtensionFlow.java:39)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:753)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
Truncated. see log file for complete stacktrace
Caused By: java.lang.NullPointerException
at com.oracle.injection.provider.xxxx.BasicDeployment.getBeanClassCodeSourceUri(BasicDeployment.java:272)
at com.oracle.injection.provider.xxxx.BasicDeployment.loadBeanDeploymentArchive(BasicDeployment.java:240)
at org.jboss.xxxx.util.DeploymentStructures.getOrCreateBeanDeployment(DeploymentStructures.java:37)
at org.jboss.xxxx.bootstrap.events.AbstractBeanDiscoveryEvent.getOrCreateBeanDeployment(AbstractBeanDiscoveryEvent.java:70)
at org.jboss.xxxx.bootstrap.events.AfterBeanDiscoveryImpl.processBean(AfterBeanDiscoveryImpl.java:86)
- The application works fine in 12c Release 1 (12.1.1-12.1.3).
For example, with:
<servlet>
<display-name>My Jersey Application</display-name>
<servlet-name>MyJerseyApp</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>samples.helloworld</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MyJerseyApp</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
In 12.1.3 the URI is '/weblogicupgrade/rest/test/helloworld'
In 12.2.1 the URI is '/weblogicupgrade/resources/test/helloworld'
Per doc, https://docs.oracle.com/middleware/1221/wls/RESTF/jersey-back-comp.htm#RESTF385, servlet-mapping should take priority. A lower priority is the default 'resources' URI.
Cause
To view full details, sign in with your My Oracle Support account. |
|
Don't have a My Oracle Support account? Click to get started! |
In this Document
Symptoms |
Cause |
Solution |
References |