Spring configuration for CXF WebService got java.lang.NoClassDefFoundError: javax/xml/ws/EndpointReference
Asked Answered
K

6

5

I'm trying to get CXF to work with spring, maven on weblogic.the project compile/build fine, but when I try to deploy it I got this error:

  <User defined listener org.springframework.web.context.ContextLoaderListener failed:    org.springframework.beans.factory.BeanCreationException: Error creating bean with name   'ibanInfos': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/ws/EndpointReference.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ibanInfos': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/ws/EndpointReference
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    at  org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    Truncated. see log file for complete stacktrace
java.lang.NoClassDefFoundError: javax/xml/ws/EndpointReference
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2395)
    at java.lang.Class.getDeclaredMethods(Class.java:1763)
    at java.beans.Introspector$1.run(Introspector.java:1265)
    at java.security.AccessController.doPrivileged(Native Method)

Any idea how to solve this? In fact, I'm using the java first strategy to generate WSDL.

Here is my spring file :

  <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:jaxws="http://cxf.apache.org/jaxws"
    xsi:schemaLocation="
http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
    <import resource="classpath:service-definition-beans.xml"/> 
    <jaxws:endpoint id="ibanInfos" implementor="#ibanInfosService" address="http://localhost:7001/IbanInfos" />  
</beans>
Ko answered 30/11, 2012 at 11:20 Comment(0)
K
1

I finally found the problem : im actually using weblogic under 10.0 version which provide Jaxws2.0 that doest contain EndPointInterface. A workaroud is to add the jar into setDomainEnv.sh and it will work perfectly. Thanks alot for your answers.

Ko answered 3/12, 2012 at 16:35 Comment(0)
N
10

Make sure you have jaxws-api-2.3.1.jar in your classpath.

It can be download via the above link or from maven.

<dependency>
    <groupId>javax.xml.ws</groupId>
    <artifactId>jaxws-api</artifactId>
    <version>2.3.1</version>
</dependency>
News answered 30/11, 2012 at 12:31 Comment(2)
Thanks for answering, Actually i already have Jaxws-api in my POM.xml.Ko
@AmenSehli make sure its not set to provided.News
K
1

I finally found the problem : im actually using weblogic under 10.0 version which provide Jaxws2.0 that doest contain EndPointInterface. A workaroud is to add the jar into setDomainEnv.sh and it will work perfectly. Thanks alot for your answers.

Ko answered 3/12, 2012 at 16:35 Comment(0)
L
0

EndpointReference was introduced in JAX-WS 2.1, and JAX-WS 2.1 is included into JRE since Java 1.6.0_04.

So, if EndpointReference is unavailable in your environment you need to upgrade your JRE/JDK, or include a recent version JAX-WS API as a separate dependency.

Labarum answered 30/11, 2012 at 12:29 Comment(0)
D
0

Seems like this class is not in your classpath. You should add the relevant item to your POM. From searching the web, this class is present in many libraries. Here is an excerpt for including such aritfact:

<dependency>
  <groupId>javax.xml.ws</groupId>
  <artifactId>jaxws-api</artifactId>
  <version>2.2.3</version>
</dependency>
Driving answered 30/11, 2012 at 12:31 Comment(1)
Thanks everyBody, Actually i already have Jaxws-api in my POM.xml and by checking my classPath lib i see jaxws-api-2.2.8 jar. is that possible that weblogic contains some jaxws old librairies and using them instead ?Ko
F
0

Looks like you are using higher version of java, for an application which is not compatible to it yet.

If you are building the app in Intellij, try changing the jdk setup to java11 or java8, this would fix the issue.

Fab answered 2/12, 2022 at 11:33 Comment(0)
H
0

In my case it helped to change

javax.xml.ws.Endpoint

into

jakarta.xml.ws.Endpoint
Haletky answered 3/4 at 7:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.