Hi
I have developed a camel springboot project and it works fine standalone with
Cxf and Tomcat or Jetty servlet.
But I met the following problems when I tried to deploy the project on
Weblogic. It seems the cxf related jars might have problem with Weblogic jars.
Here is the similar problem on the web:
https://stackoverflow.com/questions/47650275/spring-boot-camel-cxf-on-weblogic-12c-java-lang-noclassdeffounderror-javax?rq=1
I have spring boot 1.5.9 and cxf 3.2.1 and weblogic 12. I have cxfendpoints for
soap and restful WS. When I deployed on the weblogic:
I got the same error msg: java.lang.NoClassDefFoundError:
javax/cache/configuration/Configuration
I don't think I have to add javax.cache jar as I really don't use it.
I don't have web.xml but I defined CxfServlet in Java code.
public SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(SpringBootCDA09TrxnApplication.class);
}
@Bean
public ServletRegistrationBean servletRegistrationBean() {
CXFServlet servlet = new CXFServlet();
ServletRegistrationBean bean = new ServletRegistrationBean(servlet,
"/service/*");
bean.setLoadOnStartup(0);
return bean;
}
Here is my weblogic.xml
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>org.slf4j.*</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>
Following the suggestions from the web, I tried to remove rs-api.jar from
camel-cxf but the problem still exists.
In my Pom, I corrected by doing
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf-starter</artifactId>
<version>2.21.0</version>
<exclusions>
<exclusion>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
<version>3.2.1</version>
<exclusions>
<exclusion>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</exclusion>
</exclusions>
</dependency>
Thanks a lot!
Jessie Ding