2

First of all, I found similar question but there are not so many information - pom.xml is missing, so the root cause could be different.

In pom.xml I have:

        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-cxf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-metrics</artifactId>
        </dependency>
        <dependency>
            <groupId>com.sun.activation</groupId>
            <artifactId>javax.activation</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.3.4</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-rt</artifactId>
            <version>3.0.1</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.ws</groupId>
            <artifactId>jaxws-api</artifactId>
            <version>2.3.1</version>
        </dependency>
        <dependency>
            <groupId>javax.jws</groupId>
            <artifactId>javax.jws-api</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
        </dependency>

Versions which are missing here are defined in parent pom.

Error which I get is:

TOMCAT 2021-08-01 19:03:37,603 [main] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/provisioning/webservice/lbx]- Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener]
java.lang.NoClassDefFoundError: javax/jws/WebService
    at org.apache.camel.component.cxf.CxfEndpointUtils.hasWebServiceAnnotation(CxfEndpointUtils.java:84) ~[camel-cxf-3.0.1.jar:3.0.1]
Caused by: java.lang.ClassNotFoundException: javax.jws.WebService

I also tried with <artifactId>jaxb-core</artifactId> and

<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>

and

<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>

but without success.

Michu93
  • 5,058
  • 7
  • 47
  • 80
  • 1
    Have you tried using javaxb-api from camel-cxf dependency? – Yayotrón Aug 02 '21 at 07:10
  • You mean exclude javax.xml.bindjaxb-api? I haven't, let me try. @Edit unfortunatelly, it didn't help - I excluded `javax.xml.bind jaxb-api` from `camel-cxf` but still see the same error ;/ – Michu93 Aug 02 '21 at 08:13

1 Answers1

1

Adding these dependencies fixed the issue for me:

implementation group: 'com.sun.xml.ws', name: 'jaxws-ri', version: '4.0.0', ext: 'pom'
    implementation group: 'com.sun.xml.bind', name: 'jaxb-core', version: '4.0.1'
    implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.4.0-b180830.0359'
    implementation group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '4.0.1'
    implementation group: 'org.glassfish.main.javaee-api', name: 'javax.jws', version: '3.1.2.2'
Arar
  • 1,926
  • 5
  • 29
  • 47