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

12,829

Solution 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.

Solution 2

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>
Share:
12,829
Amen Sehli
Author by

Amen Sehli

Updated on June 04, 2022

Comments

  • Amen Sehli
    Amen Sehli almost 2 years

    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>