migration of jboss 4.2 to wildfly 8 - java

we have legacy java project with ear deployment structure.
.ear---| classes
| lib
| META-INF ---| application.xml
| .war | jboss-app.xml
| MENIFEST.MF
which is running fine on jboss 4.2. now we are migrating jboss 4.2 to wildfly 8.
ERROR : jboss-app.xml is deprecated and "loader-repository" is ignored.
we gone through the wildfly document then we came to know that we have to create jboss-deployment-structure.xml to define modules.
we have jboss-app.xml:-
<jboss-app>
<module-order>strict</module-order>
<loader-repository>
com.mono.myproject:archive=CompleteApp.ear
<loader-repository-config>
java2ParentDelegation=false
</loader-repository-config>
</loader-repository>
<library-directory>/lib</library-directory>
<module>
<web>
<web-uri>firstWeb.war</web-uri>
<context-root>firstWeb</context-root>
</web>
</module>
<module>
<web>
<web-uri>secondWeb.war</web-uri>
<context-root>secondWeb</context-root>
</web>
</module>
<module>
<web>
<web-uri>thirdWeb.war</web-uri>
<context-root>thirdWeb</context-root>
</web>
</module>
</jboss-app>
How can we load above (loader-repository) in jboss-deployment-structure.xml in wildfly 8?
Without loader repository we have tried but got ERROR:- linkage error (com.mono.myproject not found)
Thanks in advance.

Related

Gradle adds all modules as EJBs in application.xml

I have the following EAR project in my Gradle script having 2 deploy dependencies:
An EJB jar
An EJB client jar
What I want to do is create an EAR with the 2 jars in ear root but only the actual EJB jar in application.xml, i.e. something like this:
<?xml version="1.0" encoding="UTF-8"?>
<application id="Application_ID" version="6" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd">
<display-name>MyEJBEAR</display-name>
<module>
<ejb>MyEJB.jar</ejb>
</module>
</application>
Here is my build.gradle file:
project(':MyEJBEAR'){
apply plugin: 'ear'
dependencies {
deploy project(':MyEJBClient')
deploy project(':MyEJB')
earlib <common jars>
}
}
The produced EAR structure is what I want however it contains an application.xml file like this (i.e. adds all deploy dependencies as EJBs):
<?xml version="1.0"?>
<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" version="6">
<display-name>MyEJBEAR</display-name>
<module>
<ejb>MyEJB.jar</ejb>
</module>
<module>
<ejb>MyEJBClient.jar</ejb>
</module>
<library-directory>lib</library-directory>
</application>
I have tried to play with deploymentDescriptor like this but I had no luck:
ear {
deploymentDescriptor{
module("MyEJB.jar", "ejb")
}
}
Any idea on how could I exclude the MyEJBClient.jar reference from the application.xml file?
EDIT:
I have found a workaround solution to this by throwing my existing (IDE Generated) META-INF folder that contains a valid application.xml from the EAR project root to a dir(e.g. MyEJBEAR/resources) and adding the following
lines in project(':MyEJBEAR') closure:
ear {
appDirName = 'resources'
}
This done based on this section of Gradle Documentation but I still need to somehow generate a valid application.xml from my build script.

jboss 6.4 ignoring webapp directory structure

we are moving from jboss 5.1 to jboss 6.4 and i have below entries in my xxx.ear/META-INF/application.xml. it seems like jboss 6.4 is not able to identify webapp but when I change this to webapp.war then it is deployed, due to this I need to rename my webapp folder to webapp.war.
With jboss 5.1 it is working fine but jboss 6.4 needs this change, is their any way I can suppress this?
Application scripts needs update to rename webapp to webapp.war every where and I want to avoid it.
Thanks in advance.
<?xml version='1.0' encoding='UTF-8'?>
<application xmlns="http://java.sun.com/xml/ns/j2ee" version="1.4"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
<display-name>Web App</display-name>
<module>
<web>
<web-uri>webapp</web-uri>
<context-root>/app</context-root>
</web>
</module>
</application>

How can I get Wildfly to load my EAR deployments in the correct order?

According to Wildfly's documentation, it should be possible to declare the order by which subdeployments are deployed within an EAR. However, I am not able to get it to respect the order of dependencies I have defined within my application.
The EAR has specified the initialize-in-order AND I have specified a dependency chain of webapp-three -> webapp-two -> webapp-one in the JBoss-specific file.
Am I missing something about how to declare this?
application.xml:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" version="6">
<display-name>ear</display-name>
<initialize-in-order>true</initialize-in-order>
<module>
<web>
<web-uri>webapp-one-1.0-SNAPSHOT.war</web-uri>
<context-root>/one</context-root>
</web>
</module>
<module>
<web>
<web-uri>webapp-two-1.0-SNAPSHOT.war</web-uri>
<context-root>/two</context-root>
</web>
</module>
<module>
<web>
<web-uri>webapp-three-1.0-SNAPSHOT.war</web-uri>
<context-root>/three</context-root>
</web>
</module>
</application>
jboss-deployment-structure.xml:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<sub-deployment name="webapp-one-1.0-SNAPSHOT.war">
</sub-deployment>
<sub-deployment name="webapp-two-1.0-SNAPSHOT.war">
<dependencies>
<module name="deployment.wildfly-deployment-order.ear.webapp-one-1.0-SNAPSHOT.war" />
</dependencies>
</sub-deployment>
<sub-deployment name="webapp-three-1.0-SNAPSHOT.war">
<dependencies>
<module name="deployment.wildfly-deployment-order.ear.webapp-two-1.0-SNAPSHOT.war" />
</dependencies>
</sub-deployment>
</jboss-deployment-structure>
I would expect the deployment order to be:
webapp-one
webapp-two
webapp-three
Here is how Wildfly deploys:
11:27:31,046 INFO MSC service thread 1-1 [deployment] JBAS015973: Starting subdeployment (runtime-name: "webapp-two-1.0-SNAPSHOT.war")
11:27:31,046 INFO MSC service thread 1-1 [deployment] JBAS015973: Starting subdeployment (runtime-name: "webapp-three-1.0-SNAPSHOT.war")
11:27:31,047 INFO MSC service thread 1-1 [deployment] JBAS015973: Starting subdeployment (runtime-name: "webapp-one-1.0-SNAPSHOT.war")
Even though we start deploying all of them at the same time, initialise-in-order means that the individual components in the deployment will be initialised in order, so EJB's Servlets etc in webapp-two will not be started until webapp-one has started.
We still parse the deployments and build deployment metadata in parallel, because there is no reason not to.
I had the same problem with a sub deployment. You can define a sub deployment deployment order with dependencies in every sub deployment. You need to add a Class-Path: webapp-one-1.0-SNAPSHOT.war to the MANIFEST.MF file of webapp-two-1.0-SNAPSHOT.war. If you use maven, you can use in the config described in the maven-war-plugin documentation. It puts the dependency entries, defined in the pom.xml into the Class-Path: section, but this works not, if the dependencies defined as provided. In this case use the following configuration in the pom.xml:
<archive>
<manifestEntries>
<Class-Path>webapp-one-1.0-SNAPSHOT.war</Class-Path>
</manifestEntries>
</archive>
I found the solution in the Class Loading in Wildfly section of the Wildfly documentation posted in the question. In this documentation section is a green box with a green checkmark:
Portability
The Java EE specification says that portable applications should not rely on sub deployments having access to other sub deployments unless an explicit Class-Path entry is set in the MANIFEST.MF. So portable applications should always use Class-Path entry to explicitly state their dependencies.

HTTP Status 404 when packaging WAR in EAR file

I'm using JBoss AS 7.1.1.Final and have been having problems getting my deployment to work. I have a couple of EJB jar files and a WAR file that I'm packaging into a single EAR. If I deploy the WAR file separately, I'm able to access it by the context-root specified in the jboss-web.xml file. However, when I package it up into an EAR file, I keep getting a "HTTP Status 404 - /pacbridge-web/" error for the same URL.
Here is what I have
EAR File:
|---pacbridge-app-6.0.0.jar
|---pacbridge-dom-6.0.0.jar
|---pacbridge-ejb-6.0.0.jar
|---pacbridge-web-6.0.0.war
|---META-INF
|---application.xml
|---MANIFEST.MF
|---lib
|----bunch of jar files
My application.xml looks like this:
<application ...>
<display-name>pacbridge-ear</display-name>
<module>
<web>
<web-uri>pacbridge-web-6.0.0.war</web-uri>
<context-root>/pacbridge-web</context-root>
</web>
</module>
<module>
<ejb>pacbridge-ejb-6.0.0.jar</ejb>
</module>
<module>
<ejb>pacbridge-app-6.0.0.jar</ejb>
</module>
<module>
<ejb>pacbridge-dom-6.0.0.jar</ejb>
</module>
<library-directory>lib</library-directory>
</application>
I'm not sure that it's applicable but there is my jboss-web.xml file:
<jboss-web>
<context-root>pacbridge-web</context-root>
</jboss-web>
Could someone give me some hints as to what I might be doing wrong?
Thanks

Do JBoss Seam applications have to be packages in an EAR?

Is it possible to package up a Seam application as a WAR file? I am trying to deploy a current Seam application that was running in JBoss to JBoss 6. It is packaged as a WAR file, but every example included with the Seam download seem to be packaged in an EAR with the Seam jar and application code, both deployed as EJBs
Sharing the error message at deployment would be helpful.
Was the web application (file.war) referencing services not in the file.war?
Most projects are deployed as an ear because the ejb modules are packaged separately (see below application.xml). Take a look at the application.xml back on the original pre JBoss 6 server that it was running on. It likely it had other modules besides the war file.
<application xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
version="5">
<display-name>Seam Registration</display-name>
<module>
<web>
<web-uri>jboss-seam-registration.war</web-uri>Chapter 1. Seam
Tutorial 14
<context-root>/seam-registration</context-root></web>
</module>
<module>
<ejb>jboss-seam-registration.jar</ejb>
</module>
<module>
<ejb>jboss-seam.jar</ejb>
</module>
<module>
<java>jboss-el.jar</java>
</module>
</application>

Categories

Resources