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"/>
Related
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?
I have two .Ear files, namely ABC.EAR and XYZ.EAR.
ABC.ear has some dependencies on some jars which are in XYZ.ear.
I cannot pack them into one .EAR file.
I cannot put the used libraries in lib folder of WildFly(WildFly\modules\system\layers\base).
jars which are in XYZ.ear.
If the jars are sub-deployments, you can specify dependencies in jboss-deployment-structure.xml in dependent ear.
E.g. ABC.ear/META-INF/jboss-deployment-structure.xml:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="deployment.XYZ.ear.xxxx1.jar"> <!-- xxxx1.jar is a sub-deployement of XYZ.ear -->
<imports>
<include path="**"/>
</imports>
</module>
<module name="deployment.XYZ.ear.xxxx2.jar"> <!-- xxxx2.jar is a sub-deployement of XYZ.ear -->
<imports>
<include path="**"/>
</imports>
</module>
<!-- other dependencies here ... -->
</dependencies>
</deployment>
</jboss-deployment-structure>
You can check the list of sub-deployments for the ear in the WF management console: Deployments menu -> select ear -> Subdeployments.
If the jars are just libs (NOT sub-deployments), then you should be able to add the same libs to ABC.ear.
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
We have some DLL's which are related to Java,VB. In Joss 4.X , We used to place in bin directory under Application Server.
We migrated to JBOSS 7.1.1 and when I removed from bin directory and placed them in libraries folder under C:\jboss-as-7.1.1.Final\modules\com\correction\main\libraries .
I am getting this exception
java.lang.UnsatisfiedLinkError: no xxxJavaWrapper in java.library.path
java.library.path = C:\Program Files\Java\jdk1.6.0_24\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\apache-maven-3.0.4;C:\apache-maven-3.0.4\bin;C:\Python27;C:\Program Files\Java\jdk1.6.0_24;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
java.lang.UnsatisfiedLinkError: com.xxxJavaWrapperJNI.new_xxx()J
module.xml
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.correction">
<resources>
<resource-root path="xxx.jar"/>
<resource-root path="xyz.jar"/>
<resource-root path="libraries"/>
</resources>
<dependencies>
<system export="true">
<paths>
<path name="libraries"/>
</paths>
<exports>
<include-set>
<path name="libraries"/>
</include-set>
</exports>
</system>
</dependencies>
</module>
But I place the same dll's in bin folder, it is working fine.
I want to place them in module folder and set the path from there instead of bin so that I can have all the application related jar's, properties and dll files at one place for ease maintainance.
Also I want to know how to set the path of txt and properties files in jboss 7.1.1
Regards
Srini
Configure module.xml as below:
<module xmlns="urn:jboss:module:1.1" name="com.correction">
<resources>
<resource-root path="xxx.jar"/>
<resource-root path="xyz.jar"/>
<resource-root path="lib/win-x86_64"/>
</resources>
<dependencies>
<module name="sun.jdk"/>
</dependencies>
</module>
Put the DLLs into the directory lib/win-x86_64. Check the another dependencies of your project.
In WEB-INF of your application creating the file jboss-deployment-structure.xml and put the content below:
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="com.correction"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
That's all.
Another Question: How can you make these properties files accessible to applications deployed on JBoss 7?
create a custom module where you put your properties files and put jboss-deployment-structure.xml to your application archive (WAR/EAR) to use that custom module.
Create the new module directory under $JBOSS_HOME/modules(using app/conf in this example)
mkdir -p $JBOSS_HOME/modules/app/conf/main/properties/
Put your properties files in $JBOSS_HOME/modules/app/conf/main/properties/
Create a module.xmlhere $JBOSS_HOME/modules/app/conf/main/module.xml
<module xmlns="urn:jboss:module:1.1" name="app.conf">
<resources>
<resource-root path="properties"/>
</resources>
</module>
put the following jboss-deployment-structure.xml in WEB-INF:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="app.conf" />
</dependencies>
</deployment>
</jboss-deployment-structure>
Then you can access your properties files using thecode below (example assumes you have a
example.propertiesfile in $JBOSS_HOME/modules/app/conf/main/properties/)
Thread.currentThread().getContextClassLoader().getResource("example.properties");
Ps: I used JBoss AS 7.1.2 ( JBoss EAP 6 )
Regards
Mauricio Magnani