standalone.xml doesn't delete deployment after stop jboss application server wildfly - deployment

I have a project which uses Wildfly to deploy. But when I stop the server, the development tags in standalone.xml aren't deleted. So the next time I run the server, it will catch error.
Here is standalone.xml deployment tags
<deployments>
<deployment name="sqljdbc42.jar" runtime-name="sqljdbc42.jar">
<content sha1="ff439c53190a987d327165dec8b148f670cb7ca8"/>
</deployment>
<deployment name="nts.uk.com.js.web.war" runtime-name="nts.uk.com.js.web.war">
<fs-exploded path="/home/local/3SI/ha.dhv/3SProjects/UniversalK/nts.uk/uk.base/base.web/nts.uk.com.js.web/build/libs/exploded/nts.uk.com.js.web.war"/>
</deployment>
</deployments>

Related

Possibility to access wildfly / app server libraries via jboss-deployment-structure.xml?

I have a web application running on a wildfly app server (22.X). It contains a war file which has the ability (besides the actual functionality) to query the wildfly itself for its active running sessions via JMX and display that number on an simple html page.
Originally the following dependency was added (via maven) to make this work:
<dependency>
<groupId>org.jboss.remotingjmx</groupId>
<artifactId>remoting-jmx</artifactId>
<version>3.0.4.Final</version>
However this dependency brings lots of other transitive dependencies along like jboss-marshalling, xnio, jboss-threads, wildfly-*, (...) - all packages which does exist within the wildfly app server anyway. So I was wondering whether it is possible to use those app server packages instead of bundling it as part of the war. I tried to add the following to the jboss-deployment-structure.xml to the EAR:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.3">
<deployment>
<dependencies>
<system export="true">
<paths>
<path name="sun/reflect"/>
</paths>
</system>
</dependencies>
</deployment>
<sub-deployment name="service.war">
<dependencies>
<module name="org.jboss.remoting3.remoting-jmx" services="import"/>
</dependencies>
</sub-deployment>
However it didn't work - as soon as the dependencies were removed from the war file it stopped working. My question:
Is it possible to specify/configure the deployment structure file to allow access to the necessary packages from the application server? (I know that this is a wildfly specific solution but this is intended)
It looks like this module has moved to org.jboss.remoting-jmx. The org.jboss.remoting3.remoting-jmx does export the org.jboss.remoting-jmx module in WildFly 22, however the services are not exported which could be the issue.
Either way, it's best to use the org.jboss.remoting-jmx.

JBOSS 7.2.2 External Folder Linking

I have been searching around for this specific problem of mine. We have a folder that is on a shared folder on another server "\\server1\shares\web\images" and I want to link this folder into my web application in Jboss 7.2.2. I'm migrating from Jboss 4.2.2 to Jboss 7.2.2.
Here is my server.xml file from Jboss 4.2.2. You'll notice that the <Context> tag handles this link for me.
<Server>
<Service name="jboss.web">
<!-- ... -->
<Engine name="jboss.web" defaultHost="localhost">
<!-- ... -->
<Host name="myApp" autoDeploy="false" deployOnStartup="false"
deployXML="false" configClass="org.jboss.web.tomcat.security.config.JBossContextConfig">
<!-- ... -->
<Context path="/images" appBase="" docBase="\\server1\shares\web\images"
debug="99" reloadable="true" />
<!-- ... -->
</Host>
</Engine>
</Service>
My research has lead me to use modules, but I cannot figure out how to use the modules properly for this problem. Most examples shows how to provide some link to a folder on the same machine as the Jboss server is on.
So, am I suppose to use modules or is there another way of doing this?

I don't want to refer server side jars for my project, My primefaces+spring project has to use the jars that i added to lib folder

I'm working on Primefaces + Spring project.Recently we migrated the project from JSF 1.2 to 2.2 Version.Previously our project was using jsf Implementation and API jars from Project's lib folder but now it's using the jars located in,
**\wildfly-10.0.0.Final\modules\system\layers\base\com\sun\jsf-impl\main**
**\wildfly-10.0.0.Final\modules\system\layers\base\javax\faces\api\main**
and it is throwing Services which failed to start error while deploying on wildfly 10.x,
JBAS014777: Services which failed to start: service jboss.deployment.unit."abc.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."abc.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "abc.war"
How can configure my project to use lib jars.Which will helps in deployment.
Some dependencies are added implicitly by Wildfly 10. You can find a list of them here.
For the web subsystem these are:
javaee.api
com.sun.jsf-impl
org.hibernate.validator
org.jboss.as.web
org.jboss.logging
If you don't want one of them, like in your case com.sun.jsf-impl, you can exclude them using a jboss-deployment-structure.xml file as explained here.
In your case it might look like this:
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="com.sun.jsf-impl" />
</exclusions>
</deployment>
</jboss-deployment-structure>
Probably you may need more exclusions, but the principle should be clear.

Wildfly Maven Plugin ignores deployment name?

I added the name parameter on my deployment using Wildfly Maven Plugin:
mvn wildfly:deploy -Dname=myapp -Dwildfly.hostname=myserver -Dwildfly.username=user -Dwildfly.password=pwd
However, it keeps on deploying with the Maven version and extension.
Here's how it looks in standalone.xml
<deployment name="myapp-1.1-SNAPSHOT.war" runtime-name="myapp-1.1-SNAPSHOT.war">
<content sha1="17e09de2cd8f78ffd033a90b4e82bdb52eb9485b"/>
</deployment>
The reason is to streamline the deployment process. After a Maven release, the deployment name changes to myapp-1.1.war, and the new development becomes myapp-1.2-SNAPSHOT.war. Instead of undeploying release myapp-1.1.war, and deploying myapp-1.2-SNAPSHOT.war, we want to reduce it to a single step - just redeploy myapp, and it should overwrite the old one.
Btw, if I just deploy, I'll have the two versions.
Just to be clear, this is the goal:
<deployment name="myapp" runtime-name="myapp-1.1-SNAPSHOT.war">
<content sha1="17e09de2cd8f78ffd033a90b4e82bdb52eb9485b"/>
</deployment>
This seems like a very simple case, and it should work as per the documentation: https://docs.jboss.org/wildfly/plugins/maven/latest/deploy-mojo.html
You can't override the name parameter on the via the command line. You'd need to add a configuration property for the name configuration parameter and override that on the command line.
...
<properties>
<deployment.name>${project.build.finalName}.${project.packaging}</deployment.name>
</properties>
...
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.1.0.Alpha7</version>
<configuration>
<name>${deployment.name}</name>
</configuration>
</plugin>
...
Then on the command you could use -Ddeployment.name=myapp. One note though is you'll want to use the appropriate file extension, e.g. .war, so the deployment will be processed properly.

JBoss (liferay) no context.xml so where to put JNDI resource

I've got the order to switch from Liferay on tomcat, to Liferay on JBoss.
One issue I'm having is that unlike in tomcat, I can't seem to find a context.xml in liferay-portal-6.0.5\jboss-5.1.0\server\default\conf
Will it work if I just copy the context.xml from my tomcat installation to my jboss installation? (I don't know if JBoss scans that folder).
Or is there an alternative location where I can put my resource?
<Resource name="jdbc/x" auth="Container"
type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
url="y"
username="z" password="A" maxActive="20" maxIdle="10"
maxWait="-1"/>
Add a file named "*- ds.xml" in the deploy directory server with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/myds</jndi-name>
<connection-url>jdbc:oracle:thin:#127.0.0.1:1521:sid</connection-url>
<user-name></user-name>
<password></password>
<new-connection-sql>SELECT * FROM DUAL</new-connection-sql>
<check-valid-connection-sql>SELECT * FROM DUAL</check-valid-connection-sql>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
</local-tx-datasource>
</datasources>