I have a microprofile application using Smallrye Mutiny, which I need to deploy on JBoss EAP 7.3. I have applied JBoss EAP XP patch to enable microprofile features. I have also added mutiny jar as a module in EAP.
Below are the module file contents
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1"
name="io.smallrye.reactive.mutiny">
<resources>
<resource-root path="mutiny-0.9.0.jar" />
</resources>
<dependencies>
<module name="org.reactivestreams" />
</dependencies>
</module>
And the module.xml for reactivestreams is
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.reactivestreams">
<resources>
<resource-root path="reactive-streams-1.0.3.jar" />
</resources>
</module>
However in my application I'm getting the below Exception
Failed to define class io.smallrye.mutiny.Multi in Module "deployment.SampleReactive.war" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link io/smallrye/mutiny/Multi (Module "deployment.SampleReactive.war" from Service Module Loader): org/reactivestreams/Publisher
How can I configure JBoss EAP to work with reactive applications built using Microprofile? Any help is appreciated.
Edit: I have managed to get the app working on EAP 7.3. But now I am facing a different issue.
App has REST Apis which emit Uni and Multi. The REST API produces Json. But when I run this program in EAP, I see and object as the response instead of a JSON.
It seems that EAP is not able to convert Uni and Multi to JSON.
Is there any library that I need to add for this to work?
Related
Goal - Migrating EAR application from JBoss EAP 5 to Wildfly 10
Issue : Code has CXF 2.7.0 web service client code (to call third party web service) and its added to the EAR/lib folder. But during deployment, I am getting below exception
log:
2016-02-26 12:17:48,075 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC000001: Failed to start service jboss.deployment.unit."rts-comcast-01.01.75.ear".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."rts-comcast-01.01.75.ear".WeldStartService: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745) Caused by: org.jboss.weld.exceptions.DefinitionException: WELD-000071: Managed bean with a parameterized bean class must be #Dependent: class org.apache.cxf.jaxrs.provider.DataBindingProvider
at org.jboss.weld.bean.ManagedBean.checkType(ManagedBean.java:208)
at org.jboss.weld.bean.AbstractBean.initializeAfterBeanDiscovery(AbstractBean.java:107)
at org.jboss.weld.bean.ManagedBean.initializeAfterBeanDiscovery(ManagedBean.java:122)
at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$AfterBeanDiscoveryInitializerFactory.doWork(ConcurrentBeanDeployer.java:136)
at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$AfterBeanDiscoveryInitializerFactory.doWork(ConcurrentBeanDeployer.java:127)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:63)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
beans-xml
I have added below beans-xml to the META-INF and WEB-INF as well
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
bean-discovery-mode="annotated">
Alternate try
I was in a doubt whether the given libs are getting loaded to the application and want confirm my dependencies are good. so made a sample web application and loaded all the CXF jar files this time to WEB-INF/lib folder itself and deployed this time also the same issue as mentioned above
CXF version in Wildfly 10
Wildfly 10 comes with CXF 3.1.4, but i have given my needed jars in my lib folder and did not mention any container provided CXF modules, to ensure CXF version in libs to load.
Could some provide an insight where I am doing wrong? Thanks for your help
After searching for a while i added the below config changes in jboss-deployment-strucutre.xml and still having issues. Please use this link for detailed information
https://developer.jboss.org/thread/268163
Issue resolved after adding proper exclusion entries of container provided CXF3.1.4 and provided CXF version 2.7 or 2.4.4 (not sure about other lower versions)
jboss-deployment-structure.xml must be in the parent level META-INF in case your application has multiple modules (JAR, WAR, MDB)
These are my entries:
<!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
<exclusions>
<!-- Exclude Version cxf of JBOSS -->
<module name="org.apache.cxf" />
<!-- Exclude JAVA EE of JBOSS (javax.ws..) => Add dependency javax.annotation -->
<module name="javaee.api" />
<!-- Exclude RestEasy conflict (javax.ws.rs.ext.RunDelegate) -->
<module name="org.jboss.resteasy.resteasy-jackson-provider" />
<!-- module name="org.apache.log4j" />
<module name="org.apache.commons.logging"/ -->
<module name="org.jboss.as.jaxrs"/>
<module name="org.jboss.resteasy.resteasy-jaxrs"/>
<module name="org.jboss.resteasy.resteasy-cdi"/>
<module name="org.jboss.resteasy.jackson-provider"/>
<module name="org.jboss.resteasy.resteasy-atom-provider"/>
<module name="org.jboss.resteasy.resteasy-hibernatevalidator-provider"/>
<module name="org.jboss.resteasy.resteasy-jaxb-provider"/>
<module name="org.jboss.resteasy.resteasy-jettison-provider"/>
<module name="org.jboss.resteasy.resteasy-jsapi"/>
<module name="org.jboss.resteasy.resteasy-multipart-provider"/>
<module name="org.jboss.resteasy.resteasy-yaml-provider"/>
<module name="org.codehaus.jackson.jackson-core-asl"/>
<module name="org.codehaus.jackson.jackson-jaxrs"/>
<module name="org.codehaus.jackson.jackson-mapper-asl"/>
<module name="org.codehaus.jackson.jackson-xc"/>
<module name="org.codehaus.jettison"/>
<module name="javax.ws.rs.api"/>
</exclusions>
Hi StackOverflow Community,
I have a WAR which I have deployed to a JBoss Wildfly 8.2 instance. Also in Wildfly, I have created two modules:
a third party JMS JCA adapter module,
and a model module (model.jar) that contains message classes used to communicate between the JMS broker and the WAR
The WAR has a jboss-deployment-structure.xml that declares a dependency on the JCA module:
<?xml version='1.0' encoding='UTF-8'?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<dependencies>
<module name="com.thirdparty.mq.ra" slot="main"/>
<module name="com.company.model" slot="main">
</dependencies>
</deployment>
</jboss-deployment-structure>
The WAR has the model.jar file packaged in its WEB-INF/lib folder.
The JMS module has a dependency on the model module:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="com.thirdparty.mq.ra">
<resources>
<resource-root path="."/>
<resource-root path="thirdparty-jms-provider.jar"/>
...
<resource-root path="thirdparty-lib.jar"/>
</resources>
<dependencies>
<module name="com.company.model"/>
<module name="javax.api"/>
<module name="javax.jms.api"/>
<module name="javax.transaction.api"/>
<module name="javax.management.j2ee.api"/>
<module name="javax.resource.api"/>
<module name="org.jboss.invocation"/>
<module name="org.jboss.remote-naming" optional="true"/>
<module name="org.slf4j"/>
</dependencies>
</module>
When running, I get the following exception:
Caused by: java.lang.ClassCastException: com.company.model.web.dto.WebAuthenticationResponse cannot be cast to com.company.model.web.dto.WebAuthenticationResponse
I suspect it is a classloader issue. Is there some extra information I have to specify in the module.xml or jboss-deployment-structure.xml files?
Thanks for your help!
Assuming that your model.jar corresponds to your com.company.model module, your WAR classloader now sees the model classes twice, both from its own libraries in WEB-INF/lib and via the module dependency.
You should either import or embed a module/library, but not both.
By the way, importing a RAR module looks a bit suspicious. You should never depend on the implementation of a resource adapter. Maybe you can factor out an API module and import that.
I have a module.xml that looks like:
<module xmlns="urn:jboss:module:1.1" name="com.oracle">
<resources>
<resource-root path="ojdbc6.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
Using JBOSS-CLI one can do this:
./jboss-cli.sh -c --command="module add --name=com.oracle --resources=<path-to-file>/ojdbc6.jar --dependencies=javax.api,javax.transaction.api,javax.servlet.api"
to deploy the module. It is almost the same exact thing and the module.xml is generated; so I need not keep track of another xml.
But how can I get the 'optional="true"' from JBOSS-CLI?
Version: JBOSS-EAP 6.2.0. (would be great if I can find a solution that would work for either jboss 6.x EAP and wildfly 8x).
The CLI module command appears to only support simple dependencies.
You could work around it by supplying a pre-generated modules.xml file and specifying it in the CLI command using
--module-xml=filepath_to_modules.xml
I am new to JBoss 7.1 and trying to migrate our appplication to migrate from jboss 6.0 to jboss 7.1 but at development time it loads only few specific jars automatically which is different from jboss 6.0 which loads all the jars from lib folder.If i add them externally then at deployement time it conflicts with the already available jars in jboss 7.1 /module folder.
so please let me know how to configure the jboss 7.1 so that it loads all or specified its internal jars.
If you need to use your own jar for the deployed application, then you can exclude these using a jboss-deployment-structure.xml file in your WEB-INF directory. Here is an example that describes about the format of the xml file.
I too faced same issue. One best thing I did was removing conflicting jars in JBoss lib folder as your deployment ear would have those already.
JBoss As 7.1 & JSF1.2, 2.0
Following required steps...
You have manually configure some files
1.Create folder MySQL folder\main folder
jboss-as-7.1.1.Final\modules\com\mysql
2.MySQL folder\module folder\add-> module.xml file and MySQL connector file
Module.xml code:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.10-bin.jar"/>
<!-- Insert resources here -->
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
</module>
3.Go to the JBoss-as-7.1.1.Final\modules\org\hibernate\main
open the module.xml file & add
<module name="com.mysql"/>
4.Go to the JBoss-as-7.1.1.Final\modules\org\jboss\as\weld\main
open the module.xml file & add
<module name="javax.faces.api" slot="1.2"/>
5.Go to the JBoss-as-7.1.1.Final\modules\org\jboss\weld\core\main
open the module.xml file & add
<module name="javax.faces.api" slot="1.2"/>
I am a newbie to JBoss 7. Forgive me if some of my questions below does not make senseā¦
My question is not necessarily related to 'EclipseLink' but I am giving reference of below example just to those who also like me did not know that we have to configure our modules/libraries first.
I was running an example which makes use of EclipseLink JPA EntityManager on JBoss 7.1. I have also configured the JTA datasource(mysql) with the help of link( https://zorq.net/b/2011/07/12/adding-a-mysql-datasource-to-jboss-as-7/ ). My persistence.xml looks like as below...
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="CustomerDetailsPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>java:/mysql_customerdb</jta-data-source>
<class>com.springforbeginners.model.Customer</class>
</persistence-unit>
</persistence>
When I tried to run the example, I encounted with error(org.jboss.modules.ModuleNotFoundException: Module org.eclipse.persistence is not found). I searched over the net and got the link (http://mpashworth.wordpress.com/2012/01/25/configuring-eclipselink-2-3-1-in-jboss-7-1/). The link says that we have to first configure EclipseLink as a module in JBoss 7.1. This involves listing dependencies of our module(in this case 'EclipseLink') in a module.xml file which looks like below stored at path(jboss-as-7.1.1.Final\modules\org\eclipse\persistence\main)...
<?xml version="1.0" encoding="UTF-8"?>
<!-- Represents the EclipseLink 2.3.x module-->
<module xmlns="urn:jboss:module:1.1" name="org.eclipse.persistence">
<resources>
<resource-root path="eclipselink-2.3.0.jar"/>
</resources>
<dependencies>
<module name="asm.asm"/>
<module name="javax.api"/>
<module name="javax.persistence.api"/>
<module name="javax.transaction.api"/>
<module name="javax.validation.api"/>
<module name="javax.xml.bind.api"/>
<module name="org.antlr"/>
<module name="org.apache.ant"/>
<module name="org.apache.commons.collections"/>
<module name="org.dom4j"/>
<module name="org.javassist"/>
<module name="org.jboss.logging"/>
</dependencies>
</module>
We also have to place eclipselink-2.3.0 at the same path. I ran the example again to know that the error is resolved.
Why do we have to configure our libraries as modules?(as in earlier versions(JBoss 5.1) we just used to copy the jars in lib directory).
What I want to know is how do I know what are the dependencies that need to be listed in module.xml? The specified module.xml is working but I am still searching answer for my question? This is a general question and not just related to EclipseLink (as We may need to configure any other module in JBoss 7.1). Can anyone provide me a general pointer for knowing the dependencies for a module that we are going to configure with JBoss 7?
Thanking You in Advance.
Prakash