I have a EAR file that contains a webmodule named foo-web-1.01-SNAPSHOT.war that I deploy in Weblogic and it works fine. When I try the same on Glassfish I get a FileNotFound.
java.io.FileNotFoundException: /glassfish/domains/domain1/applications/foo-1.01-SNAPSHOT/foo-web-1_01-SNAPSHOT_war/WEB-INF/web.xml
I'm not sure why it's expanded the dots in the filename with underscores. What's the exact specification around this? Is my filename invalid?
EDIT:
My EAR is structure is as follows.
foo-1.01-SNAPSHOT.ear
META-INF/MANIFEST.MF
META-INF/application.xml
APP-INF/lib/*.jar
foo-web-1.01-SNAPSHOT.war
The war is structured as follows
foo-web-1.01-SNAPSHOT.war
META-INF/MANIFEST.MF
WEB-INF/web.xml
WEB-INF/webservices.xml
WEB-INF/wsdl/foo.wsdl
WEB-INF/lib/*.jar
WEB-INF/classes/*.class
And the application descriptor
<application>
<display-name>foo</display-name>
<description></description>
<module>
<web>
<web-uri>foo-web-1.01-SNAPSHOT.war</web-uri>
<context-root>/foo</context-root>
</web>
</module>
</application>
Related
I tried to deploy an EAR file into the JBoss WildFly server, but it is not deploying the EAR file.
Steps that I followed:
Copy the EAR file and paste into jboss_dir/standalone/deployments location.
Run the command jboss_dir/bin/standalone.bat
If I put the JAR or WAR file than JBoss server can able to deploy.
Kindly help me out to fix this issue.
In JBoss 4.2 I just copy EAR file into the default/deploy folder and it is able to deploy, but I want to deploy EAR file into JBoss WildFly.
You need to place the application.xml deployment descriptor in META-INF inside the ear.
<?xml version="1.0" encoding="UTF-8"?>
<application version="7" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/application_7.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee">
<display-name>Your-ear-name</display-name>
<module>
<java>Your-jar-1</java>
</module>
<module>
<java>Your-jar-2</java>
</module>
<library-directory>lib</library-directory>
</application>
I have an ear with 2 .war files.
In war #1, under WEB-INF/classes/com/my there is a BatchTriggerBuildServlet.class
In war #2 i have the following in its web.xml (in its WEB-INF)
(a reference to a class in war #1):
<web-app id="WebApp">
<!-- other stuff -->
<servlet>
<servlet-name>BatchTriggerBuildServlet</servlet-name>
<display-name>BatchTriggerBuildServlet</display-name>
<servlet-class>com.my.BatchTriggerBuildServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>BatchTriggerBuildServlet</servlet-name>
<url-pattern>/BatchTriggerBuildServlet</url-pattern>
</servlet-mapping>
<!-- other stuff -->
</web-app>
This is deployed in Wildfly 10.
I also have a jboss-deployment-structure.xml in the META-INF folder of the containing .ear containing the following:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<!-- Make sub deployments NOT isolated by default, so they can see each others classes without a Class-Path entry -->
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
</jboss-deployment-structure>
Is this legitimate? Because I'm getting a ClassNotFoundException for the above class when i try to deploy the ear, along with the message that it
"Failed to start service ... from [Module "<my ear name>.<my war #2 name>:main" from Service Module Loader]"
Is there a way to get this to work?
thanks in advance.
ear-subdeployments-isolated does not apply to web modules, which are always isolated from each other. See Class Loading in WildFly.
Try moving the classes and their dependencies into a jar in the EAR/lib directory.
Is there a way to define order of .war deployments on JBoss 7?
What I would like to accomplish is that on startup of JBoss it first deploys .war A and then .war B.
I need this because .war A is a service which is consumed on a startup of .war B!
You have to specify the dependency on the B war by creating a jboss-all.xml file on the META-INF folder,with a content like this:
<jboss umlns="urn:jboss:1.0">
<jboss-deployment-dependencies xmlns="urn:jboss:deployment-dependencies:1.0">
<dependency name="A.war" />
</jboss-deployment-dependencies>
</jboss>
The procedure is explained here Control the order of Deployed Applications on JBoss
As mentioned in this JBoss's Forum thread, in order to ensure that A.war is deployed first than B.war, you should create a MANIFEST file under your B.war's src/main/webapp/META-INF folder, with the following entry:
dependencies: deployment.A.war
Furthermore, if you need to access A.war classes from B.war, you should also add a jboss-deployment-structure.xml, under your B.war's src/main/webapp/WEB-INF folder, with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:jboss:deployment-structure:1.2 http://www.jboss.org/schema/jbossas/jboss-deployment-structure-1_2.xsd">
<deployment>
<dependencies>
<module name="deployment.A.war" export="true"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
You can also take a look at JBoss AS 7 class loading documentation.
I have a modular web project and thus I am allowing modules to be a war archive including webapp folder. Using the following rebel.xml works fine on detecting class changes over all modules. But for some reason jrebel does not move when a html or js is changed.
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com"
xsi:schemaLocation="http://www.zeroturnaround.com http://www.zeroturnaround.com/alderaan/rebel-2_0.xsd">
<classpath>
<!-- appserver -->
<dir name="/home/xx/data/appserver/target/classes/main"/>
<dir name="/home/xx/data/appserver/target/resources/main"/>
<!-- module -->
<dir name="/home/xx/data/as.module.core/target/classes/main"/>
<dir name="/home/xx/data/as.module.core/target/resources/main"/>
<dir name="/home/xx/data/as.module.mqlcore/target/classes/main"/>
<dir name="/home/xx/data/as.module.mqlcore/target/resources/main"/>
</classpath>
<!-- web>
<link target="/">
<dir name="/home/xx/data/appserver/src/main/webapp"/>
<dir name="/home/xx/data/as.module.core/src/main/webapp"/>
<dir name="/home/xx/data/as.module.mqlcore/src/main/webapp"/>
</link>
</web -->
<web>
<link target="/">
<dirset dir="/home/xx/data">
<include name="**/src/main/webapp"/>
</dirset>
</link>
</web>
</application>
EDIT:
Interesting fact is. When I use the commented part of web configuration all three webapp folders are in the log and will be monitored for changes. But the application server can not find all of the webapp files. When I use the second <web> configuration all files are seen by the application server but are not observed by jrebel. I think it is not possible to have multiple directories linked to "/"
Each of the modules eg .war or .jar files need to have their own rebel.xml files. Otherwise all of them will reload same resources and when having different classloaders all kind of weird things can happen.
It is possible to check which instance of the file JRebel actually uses by searching "found resource" from jrebel.log. It should be written something like this
sun.misc.Launcher$AppClassLoader#184be29 found resource: 'cfg/log4j.xml' from 'file:/C:/Projects/testproject/Trunk/edm/target/cfg/log4j.xml'.
It is also seen which of the file changed by loking up lines with Event like this:
[IntelliJFSNotify] Event 'CHANGE' on: 'C:/Projects/testproject/Trunk/edm/target/cfg/log4j.xml'
Usually found resource and changed file paths do not match if the file is not reloaded. If they do match then it is recommended to send absolute path of the file and jrebel.log to support#zeroturnaround.com for investigation.
Ok, the answer is: indeed it is not possible to configure more than one directory under the <web><link target="/"></link></web> configuration. I have now a folder ./target/all-webapp where I smylink (cp -sR) all files via gradle task ... not nice but works ... and thank god jrebel is following symlinks!
Following matter is JBossAS 7.1 Developer Guider:
Change ResourceBundle location In previous versions of AS, the
JBOSS_HOME/server//conf/ was available in the classpath.
Hence the properties files in that location were available in the
classpath of the application.
In AS7, to get those properties available in the classpath, package
them within your application. For example, if you are deploying a .war
then package those properties in WAR WEB-INF/classes/ folder. If you
want those properties accessible to all components in a .ear, then
package them at the root of some .jar and place that jar in EAR lib/
folder.
But this method is not so good if there are too many resource files, we can't package all resource file to jar or ear.
For the new class loading method - module. I try following method:
create module.xml file .. you will chose module name... for instnace
custom.myconfig
<resources>
<resource-root path="."/>
<!-- Insert resources here -->
</resources>
<dependencies>
</dependencies> </module> In your jboss-deployment-structure.xml include this module to your app
<jboss-deployment-structure>
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<deployment>
<dependencies>
<module name="custom.myconfig/>
</dependencies>
<resources>
</resources>
</deployment>
<sub-deployment name="My_WAR.war">
<dependencies>
<module name="custom.myconfig" />
</dependencies>
</sub-deployment>
https://community.jboss.org/message/723631
But I found you can't set absolute path to path, like: [resource-root path=""C:\resourcefolder"].
That's means you also need include all resource files on JBossAS 7.
It is very simple on JBossAS 5.x-6.x, only need add folder path like "C:\resourcefolder" to classpath is OK. But its like an impossible mission on JBossAS7.
Finally, I soft link resource folder to JBossAS 7.....
Linux:
In -s
Windows:
MKLINK /D
or
Junction.exe