'I can´t deploy cxf 3.5.0 project in weblogic 12.2.1.4
I can´t deploy a cxf project (v3.5.0) in weblogic server 12.2.1.4.
Error: NoClassDefFoundError: Could not initialize class org.glassfish.jersey.media.sse.SseFeature
My maven pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>es.jose.miproyecto</groupId>
<artifactId>Proyecto</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Proyecto</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.version>5.3.15</spring.version>
<slf4j.version>1.7.35</slf4j.version>
<log4j.version>2.17.1</log4j.version>
<cxf.version>3.5.0</cxf.version>
<apache.poi.version>4.1.2</apache.poi.version>
</properties>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<directory>target</directory>
<finalName>${project.artifactId}-${project.version}</finalName>
<outputDirectory>WebContent/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<warName>proyecto</warName>
<warSourceDirectory>WebContent</warSourceDirectory>
<webResources>
<resource>
<directory>/src/main/resources</directory>
<targetPath>WEB-INF/classes</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-client</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.13.1</version>
</dependency>
...
<dependency>
<groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
weblogic.xml
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app
xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_2.xsd
http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.9/weblogic-web-app.xsd">
<wls:weblogic-version>12.2.1</wls:weblogic-version>
<wls:context-root>proyecto</wls:context-root>
<wls:jsp-descriptor>
<wls:page-check-seconds>0</wls:page-check-seconds>
</wls:jsp-descriptor>
<wls:session-descriptor>
<wls:cookie-name>JSID_PROYECTO</wls:cookie-name>
</wls:session-descriptor>
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>javax.ws.*</wls:package-name>
<wls:package-name>org.apache.cxf.*</wls:package-name>
<wls:package-name>org.slf4j.*</wls:package-name>
<wls:package-name>org.springframework.*</wls:package-name>
<wls:package-name>com.fasterxml.*</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>
</wls:weblogic-web-app>
Error when start weblogic server:
24-02-2022 19:27:20,374 [INFO ][org.apache.cxf.endpoint.ServerImpl][ServerImpl.initDestination:95]: Setting the server's publish address to be /
<24-feb-2022 19H27' CET> <Error> <HTTP> <BEA-101216> <Servlet: "JAX-RS/Jersey#1" failed to preload on startup in Web application: "WebContent".
A MultiException has 1 exceptions. They are:
1. java.lang.LinkageError: ClassCastException: attempting to castzip:D:/Oracle/Middleware/Oracle_Home/user_projects/domains/dominio/servers/AdminServer/tmp/_WL_user/Proyecto/k92um7/war/WEB-INF/lib/jakarta.ws.rs-api-2.1.6.jar!/javax/ws/rs/ext/RuntimeDelegate.class to jar:file:/D:/Oracle/Middleware/Oracle_Home/oracle_common/modules/javax.ws.rs.javax.ws.rs-api.jar!/javax/ws/rs/ext/RuntimeDelegate.class
at org.jvnet.hk2.internal.Utilities.justCreate(Utilities.java:1085)
at org.jvnet.hk2.internal.ServiceLocatorImpl.create(ServiceLocatorImpl.java:978)
at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1082)
at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1074)
at org.glassfish.jersey.model.internal.CommonConfig.configureFeatures(CommonConfig.java:711)
Truncated. see log file for complete stacktrace
Caused By: java.lang.LinkageError: ClassCastException: attempting to castzip:D:/Oracle/Middleware/Oracle_Home/user_projects/domains/dominio/servers/AdminServer/tmp/_WL_user/Proyecto/k92um7/war/WEB-INF/lib/jakarta.ws.rs-api-2.1.6.jar!/javax/ws/rs/ext/RuntimeDelegate.class to jar:file:/D:/Oracle/Middleware/Oracle_Home/oracle_common/modules/javax.ws.rs.javax.ws.rs-api.jar!/javax/ws/rs/ext/RuntimeDelegate.class
at javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:146)
at javax.ws.rs.ext.RuntimeDelegate.getInstance(RuntimeDelegate.java:120)
at javax.ws.rs.core.MediaType.valueOf(MediaType.java:179)
at org.glassfish.jersey.media.sse.SseFeature.<clinit>(SseFeature.java:62)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
Truncated. see log file for complete stacktrace
>
<24-feb-2022 19H27' CET> <Error> <HTTP> <BEA-101216> <Servlet: "weblogic.management.rest.Application" failed to preload on startup in Web application: "wls-management-services.war".
A MultiException has 1 exceptions. They are:
1. java.lang.NoClassDefFoundError: Could not initialize class org.glassfish.jersey.media.sse.SseFeature
at org.jvnet.hk2.internal.Utilities.justCreate(Utilities.java:1085)
at org.jvnet.hk2.internal.ServiceLocatorImpl.create(ServiceLocatorImpl.java:978)
at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1082)
at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1074)
at org.glassfish.jersey.model.internal.CommonConfig.configureFeatures(CommonConfig.java:711)
Truncated. see log file for complete stacktrace
Caused By: java.lang.NoClassDefFoundError: Could not initialize class org.glassfish.jersey.media.sse.SseFeature
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.glassfish.hk2.utilities.reflection.ReflectionHelper.makeMe(ReflectionHelper.java:1375)
Truncated. see log file for complete stacktrace
>
It works in tomcat server. If install application in weblogic it works, but if reboot weblogic server it crash with this error.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
