I have the following error launching my project with Maven (clean verify
):
[ERROR] it.bper.testing.integration.LocalStorageFoldersIT.testLocalStorageFoldersTimeout -- Time elapsed: 9.049 s <<< ERROR! java.lang.NoSuchMethodError: org.apache.cxf.common.jaxb.JAXBContextCache$CachedContextAndSchemas.getContext()Ljavax/xml/bind/JAXBContext; at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:356) at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:87) at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:425) at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:527) at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:262) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:199) at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:103) at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:91) at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:158) at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142) at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:492) at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:358) at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:349) at jakarta.xml.ws.Service.getPort(Service.java:139) at priv.gbbper.ws.documents_storage.v1.DocumentsStorageV1.getDocumentsStorageSoapV1(DocumentsStorageV1.java:72) at it.bper.testing.integration.AbstractIT.(AbstractIT.java:59) at it.bper.testing.integration.LocalStorageFoldersIT.(LocalStorageFoldersIT.java:24) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:250) at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:260) at org.junit.runners.BlockJUnit4ClassRunner$2.runReflectiveCall(BlockJUnit4ClassRunner.java:309) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:306) at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.apache.maven.surefire.junitcore.pc.Scheduler$1.run(Scheduler.java:345)
This is my pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.bper.ws</groupId>
<artifactId>DocumentsStorageWS</artifactId>
<packaging>war</packaging>
<version>1.22.0-SNAPSHOT</version>
<name>documents storage Maven Webapp</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<filenet.cpe.install.path>X:/Program Files/IBM/FileNet/ContentEngine</filenet.cpe.install.path>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- JBoss dependency versions -->
<version.wildfly.maven.plugin>4.2.1.Final</version.wildfly.maven.plugin>
<version.wildfly>23.0.0.Final</version.wildfly>
<!--Use JUnit 5 here - the WildFly bom still brings 4.x -->
<version.junit4>4.13.2</version.junit4>
<!-- other plugin versions -->
<version.compiler.plugin>3.11.0</version.compiler.plugin>
<version.surefire.plugin>3.0.0</version.surefire.plugin>
<version.failsafe.plugin>3.2.2</version.failsafe.plugin>
<version.war.plugin>3.4.0</version.war.plugin>
<!-- maven-compiler-plugin -->
<maven.compiler.release>11</maven.compiler.release>
</properties>
<dependencies>
<!-- Import the CDI API, we use provided scope as the API is included in WildFly -->
<!-- https://mvnrepository.com/artifact/org.wildfly/wildfly-feature-pack -->
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-feature-pack</artifactId>
<version>23.0.0.Final</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.26</version>
</dependency>
<!-- Common libraries -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.13.0</version>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-standalone</artifactId>
<version>3.0.1</version>
<scope>test</scope>
</dependency>
<!--
IBM Filenet libraries
A runtime servono tutti i JAR, come da documentazione FileNet:
- Jace.jar
- stax-api.jar
- xlxpScanner.jar
- xlxpScannerUtils.jar
- log4j.jar (la versione nel FileNet di BPER e' la 1.2.14)
ma qui riportiamo solo quelli strettamente necessari per compilare
ed eseguire i test, perche' gli altri JAR sono in WEB-INF/lib
quindi accessibili dal class loader della web application
-->
<dependency>
<groupId>com.ibm.filenet</groupId>
<artifactId>jace</artifactId>
<version>4.5.2</version>
<scope>system</scope>
<systemPath>C:/Users/ActionICT-Motti/IdeaProjects/DocumentsStorage_v1/src/main/webapp/WEB-INF/lib/Jace.jar
</systemPath>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>4.0.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.jaxb/jaxb-runtime -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>4.0.4</version>
</dependency>
<!--<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
-->
<!-- https://mvnrepository.com/artifact/org.glassfish.jaxb/jaxb-core -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-core</artifactId>
<version>4.0.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.activation/javax.activation-api -->
<dependency>
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
<version>1.2.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.jaxb/jaxb-xjc -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>4.0.4</version>
</dependency>
<!-- Test libraries -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.16.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.14.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>jakarta.xml.ws</groupId>
<artifactId>jakarta.xml.ws-api</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>jakarta.xml.soap</groupId>
<artifactId>jakarta.xml.soap-api</artifactId>
<version>3.0.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.cxf/cxf-rt-frontend-jaxws -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>4.0.3</version>
</dependency>
<dependency>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-api</artifactId>
<version>3.0.4</version>
</dependency>
<dependency>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j2-impl</artifactId>
<version>2.22.0</version>
</dependency>
<!-- <dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId>
<version>6.0.1</version>
</dependency>-->
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<argLine>
--illegal-access=permit
</argLine>
<parallel>all</parallel>
<useUnlimitedThreads>false</useUnlimitedThreads>
<threadCount>6</threadCount>
<perCoreThreadCount>true</perCoreThreadCount>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>4.0.2</version>
<executions>
<execution>
<id>1</id>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<xadditionalHeaders>true</xadditionalHeaders>
<executable>${tool.wsimport}</executable><!-- Piu' veloce nel generare i sorgenti -->
<wsdlDirectory>src/main/resources/wsdl</wsdlDirectory>
<target>3.0</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.4.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>external.atlassian.jgitflow</groupId>
<artifactId>jgitflow-maven-plugin</artifactId>
<version>1.0-m5.1</version>
<configuration>
<releaseBranchVersionSuffix>RC</releaseBranchVersionSuffix>
<noDeploy>true</noDeploy>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
<executions>
<!-- test unitari-->
<execution>
<id>prepare agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<!-- test integrazione -->
<execution>
<id>prepare agent integration</id>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
<configuration>
<propertyName>jacocoAgent</propertyName>
<classDumpDir>${project.build.directory}/dumpClassDir</classDumpDir>
<output>file</output>
<append>true</append>
<dumpOnExit>true</dumpOnExit>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>4.0.0.Final</version>
<configuration>
<!--
In produzione c'e' JBoss EAP 6.3 => JBoss AS 7.4.0.Final
7.4.0 => Wildfly 23
ma tale release non e' disponibile nei repo Maven
quindi usiamo la versione piu' simile disponibile
-->
<version>23.0.0.Final</version>
<commands>
<!-- **These are the commands that aren't going through** -->
<command>/subsystem=logging/root-logger=ROOT:write-attribute(name="level", value="DEBUG") </command>
<command>/subsystem=logging/console-handler=CONSOLE:write-attribute(name="level", value="DEBUG")</command>
<command>/subsystem=logging/file-handler=debug:add(level=DEBUG,autoflush=true,file={"relative-to"=>"jboss.server.log.dir", "path"=>"debug.log"})</command>
<command>/subsystem=logging/logger=org.jboss.as:add(level=DEBUG,handlers=[debug])</command>
<command>/subsystem=undertow/server=default-server/host=default-host/setting=console-access-log:add</command>
</commands>
<javaOpts>
-Xms64m
<!-- -Xmx512m-->
<!-- -XX:MaxMetaspaceSize=256m-->
-Djava.net.preferIPv4Stack=true
-Dorg.jboss.resolver.warning=true
-Dsun.rmi.dgc.client.gcInterval=3600000
-Dsun.rmi.dgc.server.gcInterval=3600000
-Djboss.socket.binding.port-offset=100
<!-- -Djboss.server.config.dir=${project.build.testOutputDirectory}/configuration-->
<!-- ${jacocoAgent}-->
<!-- <!–per eseguire il debug remoto rimuovere il commento dalla riga sottostante-->
<!-- -Xrunjdwp:transport=dt_socket,address=33333,server=y,suspend=y-->
</javaOpts>
<port>10090</port>
</configuration>
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
<configuration>
<startup-timeout>120</startup-timeout>
</configuration>
</execution>
<execution>
<id>avoid-console-logging</id>
<phase>pre-integration-test</phase>
<goals>
<goal>execute-commands</goal>
</goals>
</execution>
<execution>
<id>deploy</id>
<phase>pre-integration-test</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>undeploy</goal><!-- Per eseguire "mvn verify" e non solo "mvn clean verify" -->
<goal>shutdown</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>loadProperties</id>
<phase>process-resources</phase>
<configuration>
<exportAntProperties>true</exportAntProperties>
<target>
<exec executable="hostname" outputproperty="computer.hostname"/>
<!-- Default "overwrite=false" => non sovrascrive l'eventuale properties gia' presente -->
<copy file="src/test/resources/local.properties" tofile="${project.build.outputDirectory}/${computer.hostname}.properties" />
<loadproperties srcFile="${project.build.outputDirectory}/${computer.hostname}.properties" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<versionRange>[2.3,)</versionRange>
<goals>
<goal>wsimport</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute/>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>Jenkins</id>
<build>
<plugins>
<!--forza l'utilizzo della toolchain JDK 7 per la build -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
<configuration>
<toolchains>
<jdk>
<version>1.7</version>
</jdk>
</toolchains>
</configuration>
</plugin>
<!--Il plugin di JBoss non è toolchain-aware, per cui si deve forzare l'esecuzione di JBoss su JDK7 -->
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>4.2.0.Final</version>
<configuration>
<javaHome>${jdkJenkins}</javaHome>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<jdkJenkins>/opt/java/jdk1.7.0_71</jdkJenkins>
<!--disabilita il plugin enforcer (perche' non e' toolchain-aware e comunque non serve dal -->
<!--momento che si specifica esplicitamente il JDK utilizzato tramite JDK toolchain -->
<enforcer.skip>true</enforcer.skip>
<!-- imposta il path di wsimport nel server Jenkins per il maven-jaxws-plugin -->
<tool.wsimport>${jdkJenkins}/bin/wsimport</tool.wsimport>
</properties>
</profile>
</profiles>
</project>
I have tried to add any combination of jaxb related library, from a lot of answers here and in other sites, but still it continues to give this error. Thank you for help.
EDIT
Changing pom according to Laurent answer leads to this
[ERROR] it.bper.testing.integration.GetClassDefinitionIT.testGetClassDefinition -- Time elapsed: 5.866 s <<< ERROR! jakarta.xml.ws.WebServiceException: Could not send Message. at org.apache.cxf.jaxws.JaxWsClientProxy.mapException(JaxWsClientProxy.java:183) at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:145) at com.sun.proxy.$Proxy61.getClassDefinition(Unknown Source) at it.bper.testing.integration.GetClassDefinitionIT.testGetClassDefinition(GetClassDefinitionIT.java:35) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63) java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: org.apache.cxf.transport.http.HTTPException: HTTP response '405: Method Not Allowed' when communicating with http://localhost:8180/documentsstoragews/DocumentsStorage_v1 at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.doProcessResponseCode(HTTPConduit.java:1643) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1650) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1592) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1389) at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:689) at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:63) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307) at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:528) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:439) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:354) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:312) at
I think your pom.xml
file is a bit over-complicated and import dependencies twice.
Here are some suggestions :
com.sun.xml.bind:jaxb-impl
: it will import another version of jaxb-core
under the other groupId that may fail.javax.activation:javax.activation-api
: this is javax-based dependency and is not compatible with cxf 4.xorg.glassfish.jaxb:jaxb-xjc
: this is only needed for XML to Java build, and not needed by your application