I am relatively new to the whole JBoss ecosystem and am migrating an application from EAP 6.4 to EAP 7.1. I keep getting the issue:
.DeploymentUnitProcessingException: WFLYWS0059: Apache CXF library (cxf-core-(version).jar) detected in ws endpoint deployment; either provide a proper deployment replacing embedded libraries with container module dependencies or disable the webservices subsystem for the current deployment adding a proper jboss-deployment-structure.xml descriptor to it
where (version) changes on my altered attempts - changing the dependencyManagement in pom.xml.
Below is my dependencyManagement in my pom.xml file - the first is what it was on eap 6.4, the second was me attempting to upgrade it to v 7, and the third is what I have currently, copy-pasted from another application that does work on EAP 7.1:
<dependencyManagement>
<dependencies>
<!--<dependency>-->
<!--<groupId>org.jboss.fuse.bom</groupId>-->
<!--<artifactId>jboss-fuse-parent</artifactId>-->
<!--<version>6.3.0.redhat-283</version>-->
<!--<type>pom</type>-->
<!--<scope>import</scope>-->
<!--</dependency>
<!--<dependency>-->
<!--<!– https://mvnrepository.com/artifact/org.jboss.fuse/jboss-fuse-parent –>-->
<!--<groupId>org.jboss.fuse</groupId>-->
<!--<artifactId>jboss-fuse-parent</artifactId>-->
<!--<version>7.0.0.fuse-000191-redhat-1</version>-->
<!--<type>pom</type>-->
<!--<scope>import</scope>-->
<!--</dependency>-->
<dependency>
<groupId>org.jboss.bom</groupId>
<version>7.1.0.GA</version>
<artifactId>jboss-eap-javaee7-with-spring4</artifactId>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
I have also tried updating the jboss-deployment-structure.xml to exclude webservices (which leads no NoClassDefFoundErrors), and have tried adding dependency modules apache.cxf and apache.cxf.impl.
In my eap 7.1 instance, the modules folder has a system/layers/base/org/apache/cxf/main/cxf-core-3.1.12.redhat-1.jar, which is what I believe is clashing with the cxf-core library in my application.
One thing I'm not quite sure of is that the people I took over this application from kept mentioning that it required FUSE, however outside of the fuse BOM in the pom.xml it seems deployed on a standard EAP 6.4 instance so I'm not sure if I'm missing something.
How do I go about ignoring this library or fixing this?
Thanks
EDIT:
The only cxf in the pom is as follows:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
</dependency>
and
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${apache.cxf.version}</version>
<executions>
Related
I am converting an application that uses JAXB and JAX-WS from JDK 8 to JDK 11. The code runs when I use Eclipse IDE but exactly the same code fails with IntelliJ IDEA
I have created a Maven project using both Eclipse and IntelliJ IDEA. The problems of finding a working combination of Maven resources has been described in another question. JDK 11 with JAXB and JAXWS problems
The code builds without error in both environments. I have tried creating the IntelliJ IDEA project as a Maven project as well as a standard IDEA project
part of pom.xl
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11.0.2</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>11.0.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.0</version>
</dependency>
<!-- JAXWS for Java 11 -->
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>rt</artifactId>
<version>2.3.1</version>
</dependency>
module-info.java
module org.openfx.gustfx {
requires javafx.controls;
requires javafx.fxml;
requires transitive javafx.graphics;
requires java.xml.bind;
requires java.xml.ws;
requires javax.jws;
opens com.agile.ws.schema.common.v1.jaxws to javafx.fxml;
opens org.openfx.gustfx to javafx.fxml;
exports org.openfx.gustfx;
}
When the code is run from Eclipse, there are no errors.
Running the same code from IntelliJ IDE results in this error
java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl
Searching through the jar files confirms that ProviderImpl.class is now located in com.sun.ws.spi not in com.sun.xml.internal.ws.spi This does not cause a problem with eclipse but IDEA reports the ClassNotFoundException
Therefore, my question "How does eclipse resolve this problem while IntelliJ does not ?"
With help from Roman Shevchenko at IntelliJ, I have solved this problem using the following pom.xml
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>javax.jws</groupId>
<artifactId>javax.jws-api</artifactId>
<version>1.1</version>
</dependency>
and module-info.java
requires java.xml.ws;
requires java.xml.bind;
requires javax.jws;
I'm trying to convert my project from EAP 6.3 to Wildfly Swarm...
I'm having some trouble with CXF.
I've got the fraction dependency:
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>camel-cxf</artifactId>
</dependency>
And then later, I include this, because otherwise I get a "package org.apache.cxf.message does not exist" error in my Camel Processor code
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>3.1.9</version>
</dependency>
So if I include it, I get the error:
Apache CXF library (cxf-core-3.1.9.jar) detected in ws endpoint
deployment; either provide a proper deployment replacing embedded
libraries with container module dependencies or disable the
webservices subsystem for the current deployment adding a proper
jboss-deployment-structure.xml descriptor to it. The former approach
is recommended, as the latter approach causes most of the webservices
Java EE and any JBossWS specific functionality to be disabled.
Ok, so maybe there's a lib conflict between the camel-cxf modules and my jar... or it's not picking up my jboss-deployment-structure.xml file?
I've tried a few things as suggested by other posts.
I tried adding this to jboss-deployment-structure.xml under ${basedir}/src/main/webapp/WEB-INF and adding the xml file to the webResources of the maven-war-plugin.
<deployment>
<exclude-subsystems>
<subsystem name="webservices" />
</exclude-subsystems>
</deployment>
I've also tried adding this to jboss-deployment-structure.xml:
<dependencies>
<module name="org.apache.cxf" />
<module name="org.apache.cxf.impl" />
</dependencies>
But I keep getting that error. So I'm not sure how to resolve this conflict. Any idea?
One Approach is to use Jboss provided CXF libraries and set <scope>provided</scope> for cxf-rt-transports-http, so that it compiles and but not package the CXF dependencies .
You find more on Jboss specific configuration
I am doing migration from JDev 12.1.3 to 12.2.0. Now there was some problem durnng compilation but it has been resolved by modifiying class path.
Now when I go for deployment then it showing me one exception. That is ...
"java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V"
I am using following dependencies..
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.0.Final</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>5.0.1.Final</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
Apart from these dependencies I also looked into "C:\oracle_home12c\wlserver\modules" folder and found there was one "org.jboss.logging.jboss-logging.jar" file.
I replaced the maven repo file from "jboss-logging-3.3.0.Final".
I also looked into "jboss-logging-3.3.0.Final" jar file. There is one Logger class file but it does not contain the debugf(String) method.
Exception type;
Caused by: java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V
at org.hibernate.internal.NamedQueryRepository.checkNamedQueries(NamedQueryRepository.java:149)
at org.hibernate.internal.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:764)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:495)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:802)
at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:135)
at weblogic.persistence.BasePersistenceUnitInfo.initializeEntityManagerFactory(BasePersistenceUnitInfo.java:611)
Can someone help to get rid off this problem?
Thanks in advance
If you are using the glassfish server the the problem might be with the lib provided by glassfish. This error is caused by the use of incompatible version.
Just create a glassfish-web.xml file in the WEB-INF directory. The contents of the file are shown below:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
<class-loader delegate="false"/>
</glassfish-web-app>
This ensures that glassfish does not load it's internal libraries, but libraries from your project.
I don't know how JDev classloading works, but maybe it takes the a wrong version of jboss-logging which doesn't have the method? Try removing that from the modules dir. And make sure that your app bundles jboss-logging in the .war. It should be brought in by Hibernate's dependencies. If not, add it to the pom.xml.
I'm migrating an application from JBoss 6.1.0 JBoss EAP 4.2.xa.
I know I have changed many things, one of the most important is that JBoss now includes most of the framework / most used libraries (modules), which is great (war files smaller).
Now, I have two applications, both mounted with Spring / CXF and Maven2. One exposes a web services and the second for the first client.
The problem is in the client application, at runtime, when I try to instantiate the proxy web service I get the following error:
------ java.lang.NoClassDefFoundError: org/apache/cxf/jaxws/JaxWsProxyFactoryBean
at es....MyFactory.getService_WSC(MyFactory.java:59)
...
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
...
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
...
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920)
at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.ClassNotFoundException: org.apache.cxf.jaxws.JaxWsProxyFactoryBean from [Module "deployment.myapp.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:196)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:444)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:432)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:399)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:374)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:119) ... 21 more ------
In my pom.xml, I have the following (CXF as provided):
<properties>
<cxf.version>2.6.6</cxf.version>
<cxf.scope>provided</cxf.scope>
</properties>
<!-- CXF -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
<scope>${cxf.scope}</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
<scope>${cxf.scope}</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
<version>${cxf.version}</version>
<scope>${cxf.scope}</scope>
</dependency>
Could include CXF libraries but presumably this is not necessary and that JBoss EAP 6 already has them?, Though, if this is so why do I get the error above NoClassDefFoundError -> Caused by: java.lang.ClassNotFoundException?
Thank you!
Finally I've solved it.
First of all, thank willome response.
By the nature of the services architecture (implemented with Apache CXF) I preferred to solve using CXF.
JBoss EAP 6 embed a full version of CXF framework, with the particularity that is "divided" into modules and the key has been to identify exactly the modules included in the application.
The good thing about all this is that the war now are very light, and you can NOT include the vast majority of frameworks / libraries ... in my case I went from one war of 30MB to final 5MB.
Then finally I added the file to the application jboss-deployment-structure.xml, with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.jboss.ws.cxf.jbossws-cxf-client" services="import" />
<module name="org.apache.cxf.impl">
<imports>
<include path="META-INF"/>
<include path="META-INF/cxf"/>
</imports>
</module>
<!-- ... -->
</dependencies>
</deployment>
</jboss-deployment-structure>
And I kept the scope "provided" in my pom.xm for CXF framework.
Your CXF libraries scope is <cxf.scope>provided</cxf.scope>. I am not sure if JBoss EAP 6 is embedding CXF-jaxrs (the REST part of CXF - you should inspect the jboss version of CXF 2.4.x-redhat-1). I think it uses Rest Easy instead. So it will not find org/apache/cxf/jaxws/JaxWsProxyFactoryBean.
Change the scope of cxf-rt-frontend-jaxws from provided to compile.
See https://access.redhat.com/site/articles/112673 to get the list of all embedded libs inside Jboss EAP 6.x
We are running JBoss 5.1.0 and I'm trying to get just a simple test app up and running with RESTEasy. However, I cannot figure out what I need in order to do this. Apparently new versions of JBoss have everything included, but that doesn't help me. From what I understand, I need to modify the web.xml of my app to include the bootstrap and some other things. And then I need to include some jars in the WEB-INF/lib. This is where I'm stuck.
Do I need to include any jars in the server/lib in JBoss, or are they all supposed to be in the WEB-INF/lib of my app?
What jars do I need to include? We are not using Maven. I've seen very few tutorials actually mention which jars to use, and when I download RESTEasy there 65 jars in the lib folder. I'm not including 65 jars in my HelloWorld app just to get RESTEasy to run. I can't find any documentation that tells me plainly what I need in order to get a RESTEasy app up and running on JBoss 5
Resteasy libraries are not bundled with JBOSS.5.1.0.
You should include following libraries in your WEB-INF/lib
To add to Prasobh.K's answer - if using the pom.xml in a maven project setup - then you can just add the following inside the dependencies tags:
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>jaxrs-api</artifactId>
<version>2.3.4.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>2.3.4.Final</version>
</dependency>
<dependency>
<groupId>org.scannotation</groupId>
<artifactId>scannotation</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
<version>2.3.4.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<version>2.3.4.Final</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<version>1.8.5</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.8.5</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.8.5</version>
</dependency>
(instead of copying the jars into the lib folder)
It may also help some doing a port from Wildfly to JBoss 5.1 that the
...\WEB-INF\web.xml should be changed to:
<?xml version="1.0" encoding="UTF-8"?>
from the wildfly version which is:
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >