I have a JBoss EAP 6 instance, which has a couple of deployments (An EAR and a few WARs):
The thing is that on shutdown, I need myWar1.war to be undeployed after myEar.ear, but the actual result is that myEar.ear is being undeployed last, causing errors in the logs on shutdown due to the dependency.
I've already tried declaring dependencies of that war to the ear through jboss-deployment-structure.xml, and myWar1.war/WEB-INF/jboss-all.xml. Here are the examples:
myWar1.war/WEB-INF/jboss-deployment-structure.xml
<dependencies>
<module name="deployment.myEar.ear">
<imports>
<exclude path="***" />
</imports>
</module>
<module name="javax.annotation.api" />
</dependencies>
myWar1.war/WEB-INF/jboss-all.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss umlns="urn:jboss:1.0">
<jboss-deployment-dependencies xmlns="urn:jboss:deployment-dependencies:1.0">
<dependency name="myEar.ear" />
</jboss-deployment-dependencies>
</jboss>
None of these solutions seem to work. Although, it looks like jboss-all.xml is being read and parsed by JBoss, but it makes no effect on the order of undeployment of the dependant WAR on the EAR. (I guess it's not the expected behaviour, as states HERE.)
All the WARs are being deployed through JBoss CLI (then the server is restarted), but the myEar.ear is being exploded inside the server /deployments, and it's also added as a deployment through the CLI. Here are the entries for that in standalone-full.xml.
Also, the WAR is a SpringBoot application, built and packaged by Maven.
standalone-full.xml
<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1">
<deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-enabled="false" scan-interval="5000"/>
</subsystem>
<deployments>
. . .
<deployment name="myWar1.war" runtime-name="myWar1.war">
<content sha1="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"/>
</deployment>
<deployment name="myEar" runtime-name="myEar.ear">
<fs-exploded path="$JBOSS_HOME/standalone/deployments/myEar.ear"/>
</deployment>
. . .
</deployments>
Is there another way I can alter the undeployment sequence when shutting down JBoss? Is there a way to make jboss-all.xml be recognized properly by JBoss, or I am missing some configuration?
The deployment dependencies tag in jboss-all.xml is usually referenced only for ensuring applications deploy after dependencies are established (As in your example myear has to be deployed before mywar1 deploys) but not for shutdown.
Commonly JBoss' command line commands (look up JBoss CLI) are used to handle startup, deployments and shutdowns, but the CLI is not meant to be invoked from within your program's code. There is a parallel api called the Management API, for the management interface, which has shutdown/startup functionality, and which is meant to be called from within your code.
The AS7 Management API is applicable to the JBoss EAP 6.x, as should the newest Wildfly version of the API. Only the wildfly api is supposed to be the most updated page for the API and it lists the startup/shutdown procedures though YMMV. Here is the wildfly API and the 6.x/AS7 api in case you run into issues using the wildfly reference. Here is how to use the Management Interface API programmatically.
We are using artesia 3rd party product for our project and it is deployed in JBOSS EAP6.4, I want to use spring boot in our project and when I write sample REST webservices I am able to access the REST web service via URL.
As per the documentation of our product if we need to customize the project we need to write our custom war by specifying below two JBOSS files inside META-INF folder
jboss-all.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss umlns="urn:jboss:1.0">
<jboss-deployment-dependencies xmlns="urn:jboss:deployment-dependencies:1.0">
<dependency name="artesia.ear" />
</jboss-deployment-dependencies>
</jboss>
so our custom logic should begin after successful start of artesia.ear.
our jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<sub-deployment>
<dependencies>
<module name="deploy" />
</dependencies>
</sub-deployment>
</jboss-deployment-structure>
Above deploy module contains all jars necessary for the project to run.
When I follow the same and created the war without spring in it, it was successful and there are no issues, we are able to use to customize war.
Now I want to do the same in Spring-boot 1.4.1 application, where my spring boot app should start after artesia.ear starts successfully and apart from spring jars my spring-boot app should use jars from module.xml.
I have placed the above two xml's inside META-INF of spring boot application but it is failing when deployed in JBOSS EAP6.4
Below is the error that I get
jboss-server.log
What I need to do to use same for my spring-boot app
EDIT 1:
I tried by placing both jboss files under WEB-INF folder of spring-boot application but still the facing the same issue
We need to make sure that META-INF and WEB-INF folders are lying side by side instead of keeping META-INF folder inside classes folder of WEB-INF which is where default spring-boot META-INF folder resides.
I am creating a web application for WildFly, which will connect to a MySQL database through JPA (Hibernate). For now, I am just trying to get WildFly to start up and load the MySQL driver in standalone mode. I am using this page as a guide: http://wildfly.org/news/2014/02/06/GlassFish-to-WildFly-migration/
I am running WildFly and MySQL locally on a Windows system:
Windows 7 Enterprise SP1
Oracle Java SE 1.8.0_45
WildFly 9.0.0.Final
MySQL Server 5.6
Attempts to use the recommended console commands did not succeed, so I have manually edited to WildFly configuration files to look like those in the examples on the page linked above. First, I created the module directory and placed in it the MySQL connector JAR and module.xml file:
Directory of C:\wildfly-9.0.0.Final\modules\system\layers\base\com\mysql\main
07/06/2015 09:54 AM <DIR> .
07/06/2015 09:54 AM <DIR> ..
07/06/2015 10:12 AM 334 module.xml
07/01/2015 02:38 PM 968,668 mysql-connector-java-5.1.35.jar
The above connector jar was copied from my local Maven repository, which Maven obtained through the following dependency:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.35</version>
</dependency>
The module.xml file was manually edited as follows, to resemble the example I found on wildfly.org:
<?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.35-bin.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
Finally, I added the driver and datasource to the datasources section of standalone.xml:
<datasource jndi-name="java:/MySQLDS" pool-name="MyDS" enabled="true" use-java-context="true">
<connection-url>jdbc:mysql://localhost:3306/mydb</connection-url>
<driver>mysql</driver>
<security>
<user-name>root</user-name>
<password>secret</password>
</security>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="mysql" module="com.mysql">
<driver-class>com.mysql.jdbc.Driver</driver-class>
</driver>
</drivers>
Upon starting WildFly in standalone mode, by running %WILDFLY_HOME%\bin\standalone.bat, the following is the first error listed in %WILDFLY_HOME%\standalone\logs\server.log:
2015-07-06 10:25:47,321 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 33) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("jdbc-driver" => "mysql")
]) - failure description: "WFLYJCA0041: Failed to load module for driver [com.mysql]"
Similar issues that I have seen posted on Stack Overflow and other question/answer sites usually point to an oversight such as a typo in config files or a misnamed file. However, I've been over this over and over and cannot see any such mistake, and the same error has occurred even after upgrading from Java SE 7 and WildFly 8.2 and re-creating the configuration files from scratch. Any assistance would be greatly appreciated.
In my case it was a matter of having the wrong user:group for the directories and files under ../com/mysql/main
I changed it to wildlfy and everything worked as expected.
There was a typo in module.xml. The name of the connector JAR listed in module.xml did not match the actual JAR file in modules\system\layers\base\com\mysql\main.
In my case, it was an issue with double quotes. When I copied a WordPress sample of module.xml, I got (note the curly quotes):
<resource-root path=”postgresql-9.4.1211.jar”/>
... but Wildfly is very picky and needs this (straight quotes):
<resource-root path="postgresql-9.4.1211.jar"/>
In my case I have missed the main folder which module.xml and connector jar file need to be included.
Earlier it was
JBOSS_HOME\modules\system\layers\base\com\mysql\module.xml
and the correct path should be,(module.xml and jar needed be included inside of main)
JBOSS_HOME\modules\system\layers\base\com\mysql\main\module.xml
I know it has been while but that may help for others. The recommended approach is to deploy a driver is using the wildfly console (localhost:9990/console). once you deployed the driver jar then create your DS again by using the console then it will create it automatically in the standalone.xml. Sometimes, when doing those stuffs manually may cause missing tiny details which drive us crazy.
For me, it seems to be a coding problem. Before the tag
<module>
...
</module>
in my module.xml file, there is a mysterious blank, which is not utf-8 or English, causing my failure. After I deleted the blank or changed it to an English one. Everything is ok. Also, I looked for some solutions to this problem. Most of them can be summed to the module.xml file's problem. A name typo or the content coding. Hope it heplful for others.
Maybe two solutions for your issue:
You forgot the attribute slot on module element in module.xml file,
e.g.:
<?xml version="1.0" ?>
<module xmlns="urn:jboss:module:1.3" name="org.postgresql" slot="main">
<resources>
<resource-root path="postgresql-9.4.1212.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
add code slot="main" in module element, it will take effect.
If above approach doesn't work, it is considered with XML Module descriptors . The same issue with Wildfly Failed to Load Module for Oracle Driver:
Change the namespace version of module element in module.xml.
enjoy it.
I'm running JBoss 6.1 EAP, one of the default modules has its own version of the org/omg/CORBA/ORB.class file, I want to use my own jar for that file. I've tried including it in my app's war file but it is still picking up the one from the JBoss module.
So the question is, what is the load order of modules in JBoss and how can I change it?
You need to include a jboss-deployment-structure.xml file with your artifact, and configure the file to exclude the container's CORBA impl.
Below is an example which will exclude log4j
<jboss-deployment-structure>
<deployment>
<!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
<exclusions>
<module name="org.apache.log4j" />
</exclusions>
</deployment>
</jboss-deployment-structure>
I'm developing some App and at some point I already had code using xmlsec 1.4.3 but JBoss 7 loads by default xmlsec 1.5.1 so my code blows up.
I've been reading through the documentation and ended here: https://docs.jboss.org/author/display/AS7/Developer+Guide#DeveloperGuide-JBossDeploymentStructureFile
So, theoretically if I put the jboss-deployment-structure.xml on my WEB-INF folder (It is reading the XML because I failed writing properly the xsd and JBOSS crashed, and now without the xsd it says nothing) with this content:
<jboss-deployment-structure>
<ear-subdeployments-isolated>true</ear-subdeployments-isolated>
<deployment>
<!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
<exclusions>
<module name="org.apache.santuario.xmlsec" />
</exclusions>
</deployment>
</jboss-deployment-structure>
Then I would be able to use my xmlsec 1.4.3 and the module of JBOSS would be disabled.
However this isn't working.
What I am missing here? This should work right?