*
The moose likes Servlets and the fly likes Web app deployment model depends on build.xml?  (Lomboz) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Web app deployment model depends on build.xml?  (Lomboz)" Watch "Web app deployment model depends on build.xml?  (Lomboz)" New topic
Author

Web app deployment model depends on build.xml? (Lomboz)

Ivan Jouikov
Ranch Hand

Joined: Jul 22, 2003
Posts: 269
I am re opening this topic since the problem might be not in IDE but in Servlet concept itself.
Everything used to be fine when eclipse/lomboz deployed my project into my /webapps/modulename/ folder.. it made testing a snap and everything was cool...
But one day (yesterday) for some reason it started deploying my project into /webapps/modulename.war and it bugs the shit out of me because I takes me forever to do the whole thing and my stupid tomcat doesnt want to extract the archive anyway..
so what I want is for the software to go back to deploying it in a folder manner, rather than WAR manner... does anybody have any ideas?
I dont remember changing anything (and I am the only 1 who has access to my comp)... IT just started doing it and that's all...
I have a suspicion the reason might be in build.xml... which I also haven't changed... help anybody?

Thank you in advance, your help is greatly appreciated
Ivan
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
Tomcat should automatically extract a .war file into its directory structure. At least, mine does.


Ron Newman - SCJP 1.2 (100%, 7 August 2002)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

Additionally, if the problem is in build.xml this is an ant question.
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ivan Jouikov
Ranch Hand

Joined: Jul 22, 2003
Posts: 269
do you hae any idea why doesnt my tomcat automatically extract it? I do restart the server...
but still, I'd rather have a folder-type rathern than WAR
Faisal Khan
Ranch Hand

Joined: Jun 29, 2003
Posts: 285
If its a tomcate issue (which its not primarily), then tomcat cane be set to either automatically unwar the WAR files or leave them as is. You can change this in the server.xml file.
I think what is probably happening is that you have different build options (i have compile, deploy etc) and its has switched from doing a simply compile and tranfer files to war it all up.
You should check which option is being called in Eclipse of the build file.
I hope this helps.


The secret to creativity is knowing how to hide your sources.
Ivan Jouikov
Ranch Hand

Joined: Jul 22, 2003
Posts: 269
That's what I was thinking.. I probably switched the deploy configuration or something... I will look into how to configure tomcat to unwar wars, but here's my build.xml:
<!-- Copyright (c) 2002 by ObjectLearn. All Rights Reserved. -->
<project name="AnotherTest" default="deploy" basedir=".">

<!-- set global properties for this build -->
<property file="build.properties"/>
<property name="dist" value="../../dist" />
<property name="web" value="../" />


<target name="init">
<!-- Create the dist directory structure used by compile
and copy the deployment descriptors into it-->
<mkdir dir="${dist}"/>
<mkdir dir="${dist}/WEB-INF"/>
<mkdir dir="${dist}/WEB-INF/classes"/>
<mkdir dir="${dist}/WEB-INF/lib"/>
<copy todir="${dist}">
<fileset dir="${web}">
<include name="**/*.*"/>
<exclude name="**/jsp_servlet/*.class"/>
<exclude name="**/build.xml"/>
<exclude name="**/build.properties"/>
<exclude name="**/servers.xml"/>
<exclude name="**/targets.xml"/>
<exclude name="**/*.war"/>
</fileset>
</copy>
<copy todir="${dist}/WEB-INF/classes">
<fileset dir="${build}">
<include name="**/*.*"/>
<exclude name="**/jsp_servlet/*.class"/>
</fileset>
</copy>

</target>

<target name="deploy" depends="undeploy,init" >
<!-- Create the distribution directory -->
<delete file="${war}.war"/>
<jar jarfile="${war}.war" basedir="${dist}"/>
<copy file="${war}.war" todir="${domain}"/>
<delete file="${war}.war"/>
<!-- Create the distribution directory -->
<delete dir="${dist}"/>
</target>


<target name="undeploy">
<!-- Create the distribution directory -->
<delete file="${domain}/${war}.war"/>

<!-- Tomcat -->
<delete dir="${domain}/${war}"/>
<!-- Tomcat 4.0.x-->
<delete dir="${serverhome}/work/localhost/${war}"/>
<!-- Tomcat 4.1.x-->
<delete dir="${serverhome}/work/Standalone/localhost/${war}"/>
</target>


</project>

___________
build.properties:
build=../../bin
war=web
domain=/var/tomcat4/webapps
serverhome=/var/tomcat4

... war=web is the name of web module to be deployed as far as I understand....

Any suggestions?
BTW I am very disappointed with Eclipse/Lomboz's poor documentation
Ivan Jouikov
Ranch Hand

Joined: Jul 22, 2003
Posts: 269
Ok I configured my server.xml to unpack wars... now at least I have some hope ))
BUt still... Any suggestions on how to make it deploy in folders rather than wars??? That allowed me to test my app within a touch of a button.... now I have to wait for restart and blah and blah blah
Hung Tang
Ranch Hand

Joined: Feb 14, 2002
Posts: 148

BUt still... Any suggestions on how to make it deploy in folders rather than wars??? That allowed me to test my app within a touch of a button.... now I have to wait for restart and blah and blah blah

What do you mean "deploy in folders rather than wars???" Isn't your "dist" folder basically you're webapp folder? Just copy the whole entire thing over to tomcat.home/webapps using ANT's copy task. Along the way, you might want to change "dist" to another name that describes your app, i.e. FooApp. Then access it http://localhost:8080/FooApp
You should read Tomcat's documentation. It outlines various ways in which you can deploy your application. I think using a WAR file is one of five ways, but the documentation can tell you more on it.
Ivan Jouikov
Ranch Hand

Joined: Jul 22, 2003
Posts: 269
K will reade it... thx for tip
Faisal Khan
Ranch Hand

Joined: Jun 29, 2003
Posts: 285
Looking at your build.xml file, if you call "ant deploy" this will war up your app but not if you simply call the "ant init".
To test this, you can open up a console in Eclipse and run at init and see how it goes.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Web app deployment model depends on build.xml? (Lomboz)
 
Similar Threads
Eclipse deployment with Tomcat
Basic build.xml file required
How can I prevent my software from deploying web in WAR format? I want folders!
How can I prevent my software from deploying web in WAR format? I want folders!
Eclipse + Lomboz problem