How can I get JBoss to explode a deployed WAR file

2019-02-08 04:42发布

问题:

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?

回答1:

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



回答2:

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



回答3:

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



回答4:

it does this in a tmp folder......

but you can explode the file in the deploy directoy just name it "app.war"



回答5:

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.



回答6:

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>