deploy.last in JBoss 5.1 in web configuration? - jboss

We have ear that depends on war file.
We use web configuration.
I put war file to <jboss_home>/server/web/deploy directory.
And I put ear file to <jboss_home>/server/web/deploy/deploy.last directory.
But ear starts prior to war.
Why?

I use a similar configuration to what you describe, though I put all the apps I want to deploy first in deploy/myapps and all the ones to deploy afterwards in deploy/myapps.last. This works correctly for me on JBoss 5.1.2.
Although I can't explain why it isn't working for you, I can offer an alternative solution. You can make the EAR declare a dependency on the WAR and JBoss will then ensure the WAR is deployed first.
First, add a file called aliases.txt into the META-INF directory of your WAR. This file should just contain a single line with an arbitrary name / identifier for your WAR. For example, if you have mywebapp.war, your META-INF/aliases.txt file could contain 'mywebapp'. It just needs to be something that won't clash with any other aliases declared by other apps deployed on the same server.
Next, add a jboss-dependency.xml file to the META-INF directory of your EAR, containing the following (subsituting 'mywebapp' for the alias you created above):
<dependency xmlns="urn:jboss:dependency:1.0">
<item whenRequired="Real" dependentState="Create">mywebapp</item>
</dependency>
This should ensure the WAR is deployed before the EAR.
Also, if you try to deploy the EAR without the WAR being present, JBoss will log a clear deployment error message telling you about the missing dependency.

Related

Using "/" as default project root on Jboss Wildfly

I have a wildfly-14.0.1.Final server and a project (foodHosting) with a deployable ear module named foodHosting-ear and a web war module named fooHosting-web. After the deploy to reach my index.xhtml I have to write localhost:8080/foodHosting-web/ to my browser. Is there any solution to write only localhost:8080 and show my application? Like localhost:8080/index.xhtml?
You have to rename the fooHosting-web.war to ROOT.war
Edit: It's not needed to rename the .war inside your .ear, you have to change the context-root as the answer #wirnse said in the comment, but instead of /WEB-INF/jboss-web.xml check your /META-INF/application.xml and empty the context-root tag: <context-root></context-root>

JBOSS7 external jar with dependency on ear file

I am using JBOSS 7
In my custom jar I am implementing an Interface. The interface is in a jar packaged with ECM.ear file. Unless I put my custom jar inside the web-inf/lib folder (of the war file located in ear file) I am getting ClassNotFoundException w.r.to the interface.
I created a module for my custom jar but I don't how to set up a dependency with ear file. I copied the jar containing the interface say mdm.jar and placed it in the module and also added an entry in the resource root of module.xml. After restarting I am getting ClassNotFoundException for the classes referred by mdm.jar, which arein ear file.
How to achieve this dependency?
Thanks,
Raghu
JBOSS 7 needs you to place the packaged jar files in the lib folders of your web-inf/lib or the ear/lib cos of the Class Loading Precedence that JBOSS server follows.
Alternatively you could load it as a module, but you need to specify any addition of this kind outside of JBOSS default supplied modules using your MANIFEST file or jboss-deployment-structure.xml
This link should provide you more insight on what would suit you best.
Hope it helps.

JBoss 4.2.3 EAR and Apache 2.2 virtual hosts with jk_mod serving blank white page

I have an EAR file I am trying to deploy alongside various WAR deployments on JBoss 4.2.3
The individual standalone WAR deployments are all working fine and are just a copy of the same application that is contained inside the EAR but the EAR deployment and it's included WAR(s) does not work correctly.
I am receiving a blank white page in the browser when I visit the virtual host that the jboss-web.xml is configured to associate with this EAR. The other virtual hosts associated with the standalone WAR deployments all work fine and are configured the same way.
I get no errors on startup and JBoss reports that the site was started. I have a jboss-web.xml file in the WAR's WEB-INF that ties it into a definition from server.xml. This works on every other type of configuration except the EAR. I keep getting just a white page, as if JBoss can't connect the WAR in the EAR to the host or maybe the WAR isn't starting right or I have some config wrong here.
When I fire up JBoss it creates the flex and railo directories in webwar1.war/WEB-INF as well as a railo-server directory as railo.ear/lib/railo-server but still just serves me a blank white page.
Here is where I stand...
I have a set of shared Railo JAR files are located in /JBoss/server/default/deploy/jboss-web.deployer/railojars/lib (I have told jboss-service.xml to include this as a classpath)
My site1.WAR and site2.WAR files are in the deploy folder and each contain an index.cfm and a WEB-INF with web.xml and jboss-web.xml mapped to a virtual host. They each use this shared Railo JAR instance and run perfectly. The sites I've configured in server.xml with a docPath and appPath to an outside folder use this shared JAR installation and run perfectly. Everything is good with this.
If I place a railo1.war, railo2.war, etc in the /JBoss/server/default/deploy folder (the full WAR with Railo lib folder) those sites use the Railo instance contained within the WAR. This is also great.
So, my only problem left is this:
under /JBoss/server/default/deploy I have created railo.ear
Inside railo.ear is:
META-INF which contains application.xml with:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN" "http://java.sun.com/j2ee/dtds/application_1_2.dtd">
<application id="RailoInstance1">
<display-name>Railo3</display-name>
<description>Railo3</description>
<module id="Module1">
<web>
<web-uri>webwar1.war</web-uri>
<context-root>/webwar1</context-root>
</web>
</module>
</application>
It also contains webwar1.war which contains: index.cfm and WEB-INF
WEB-INF has has web.xml, lib and jboss-web.xml
jboss-web.xml looks like this:
<jboss-web>
<context-root>/</context-root>
<virtual-host>foo3.com</virtual-host>
</jboss-web>
From server.xml:
<Host name="foo3.com">
<Alias>www.foo3.com</Alias>
</Host>
foo3.com is using jk_mod to send to JBoss via a virtual host from Apache. The other two sites (foo1.com, foo2.com) which are mapped to WAR deployments are configured the exact same way and work fine.
The WEB-INF includes the lib folder so I would expect this webwar1.WAR instance to use the Railo JAR files contained in that lib folder. The problem is that when I start JBoss, all of my other sites configured their various ways work, but the site in webwar1.war is not coming up. I simply see a white page in the browser.
So, either the jboss-web.xml in WEB-INF in the webwar1.war file is not being connected to the defined in server.xml or something else is going wrong here. My other standalone WAR installations and the shared JARs sites all see their respective descriptors as marked in their jboss-web.xml and have the same content as this deployment.
So, I'm just trying to figure out what I need to do to get this last EAR configuration to work.
The way I am trying now seems like each WAR would try to use the JAR files it contains, but I want to have one set of shared JAR files for the whole EAR and then each WAR file in the ear use those JARS.
I want to be able to have webwar1.war, webwar2.war, etc under this one EAR configuration so I have moved the lib folder out of webwar1.war/WEB-INF/lib and into railo.ear/lib
I would love to set it up this way, but I can't even get one WAR with its own JAR files to load up right when inside the EAR. I have tried this new configuration and get the same blank white page in the browser.
Any ideas?
JBoss gives me no errors. Another odd thing is that I don't get an error from Apache like I do when I try to visit a site that is improperly configured and did not start up. And if I visit a site that is not set up as a host in JBoss and I am redirected via jk_mod to JBoss, I see the JBoss default page. I am not seeing this default page when I visit the virtual host associated with this webwar1.war in the railo.ear, so JBoss must know that it's supposed to do something with the domain / virtual host or else it would show me that default JBoss page. Instead I see a blank white one.
I should also mention that this works on JBoss 5.1. The railo.ear configured the exact same way latches onto the virtual host and works properly.
Help? Thanks!!!!
Sounds like a complicated job; the folks on the railo-users mailing list might be able to help : http://groups.google.com/group/railo
Railo also has a professional services team who are ace : http://www.getrailo.com/index.cfm/contact-us/

JBoss 4.0.5 MDB Configuration

This one is beating me, and I have not been able to figure it out ... So here it goes.
I want to add a Message Drive Bean to my app which is packaged as a .ear file
Following the documentation I've created a jboss.xml and a ejb-jar.xml, which I tried to put on the META-INF and the root and on the WEB-INF but I just don;t see it working (i.e. the MDB is never loaded, nor it received the messages.
My ear file looks like:
META-INF/
META-INF/MANIFEST.MF
META-INF/application.xml
myapp.war
My final solution was to separate the MDB code (and supporting classes) into a separate file inside the ear (myapp-mdb.jar) And to support that with the same hibernate mappings and classes, the hibernate related files were packaged on the myapp.har.
META-INF\MANIFEST.MF
META-INF\application.xml
META-INF\jboss-app.xml
myapp-mdb.jar
myapp.har
myapp.war
Just posting the answer for reference.

How can I get JBoss to explode a deployed WAR file?

I am running JBoss 4.3 on Ubuntu under /usr/local/jboss-4.3/. I have deployed my application as a WAR file i.e. myapp.war, to /usr/local/jboss-4.3/server/myserver/deploy. However, there doesn't seem to be an 'exploded' /myapp directory under the deploy folder, how come?
I am used to Tomcat running on Windows so I am a bit new to JBoss. When you deply WAR to Tomcat, the physical contents of this WAR will be exploded to a /myapp directory. With this it is then possible to modify files under the web app, such as config settings etc.
How can I do this in JBoss?
You can unzip your .war contents in a "myapp.war" folder, which JBoss will consider a deployed application just as if it was a zipped war.
Even better, most IDEs (Eclipse for sure, but i guess other IDEs such as Netbeans) allow you to deploy the exploded package instead of the zipped .war, allowing you to change just the single files you modify instead of the whole .war package
This link can be useful:
http://community.jboss.org/wiki/DeployTipsAndBuildSampleScripts
Quick Summary of what the article concerns: When it comes application builds/deployments in JBoss, there are a plethora of viable approaches. This wiki highlights several build/deploy scenerios, along with steps and pertinent build script samples. The following approaches are covered:
Point/click deployment using JBossIDE - For users that don't like ANT build scripts
Exploded EAR, JAR, SAR, WAR deployment (Option 1) - Maximize development productivity by eliminating ANT copy tasks
Exploded EAR, JAR, SAR, WAR deployment (Option 2) - Separate IDE from the compile, build and deploy process
Normal EAR, JAR, SAR, WAR deployment - Deploy a zipped archive (Necessary when using Clustering/Farm Deployment
Same problem facing, when I export as .war file from Eclipse and copy it into (UAT or Prod) JBOSS Server 7.1.1 Final AS deployement directory, And Start Windows JBOSS Service
.war file deployed sucessfully but .war file not unpacked or exploded into deployment folder.
For This solution is copy example.war exploded folder (name of folder) into deployment folder and then start. And mentions auto-deploye-exploded=true in standalon.xml
it does this in a tmp folder......
but you can explode the file in the deploy directoy just name it "app.war"
I had exactly the same problem with JBoss 7. My ant script would copy the .war file to the JBoss deployments folder (jboss-as-7.1.1.Final/standalone/deployments in my system) but the .war wouldn't explode. The .war was perfectly deployable through the administration CLI so it wasn't an unsatisfied dependency or anything. It was solved when I instructed my Ant war task to not compress the war (set the property compress to false) as in:
...
<target name="war" depends="build">
<mkdir dir="${build.dir}"/>
<war
compress="false"
needxmlfile="false"
basedir="${webroot.dir}"
warfile="${build.dir}/${project.distname}.war">
<exclude name="WEB-INF/${build.dir}/**"/>
<exclude name="WEB-INF/src/**"/>
</war>
</target>
In the standalone.xml I do see only this part of the code:
<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1">
I do not see the deployment-scanner parameters like:
auto-deploy-exploded" => false,
"auto-deploy-zipped" => true,
"deployment-timeout" => 60L,
and so on.