Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Tomcat 5.0.28 Deploy apps in a /dir/appname like Context

Alberto Romero

2005-02-08


============
What does work: deploying app in a /appname Context
============
- I defined a host myhost with a /hostappbase dir as
appBase
- I took the sample HelloWorld app, renamed myapp and
wanted it as http://myhost/myapp
- I added a META-INF/context.xml file
- I compiled it with "ant all" using a build.xml like
the one from
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/appdev/build.xml.txt
- Then compiled and validated the jsp with "ant -f
deploy.xml compile" where deploy.xml is like build.xml
example from tomcat-deployer-5.0.28
- I also modified the jar destfile to   <jar
destfile="/hostappbase /${webapp}.war" so after
compile, Tomcat automagically detects the new .war and
unpacks it and loads the new application
=> Navigation, reloading and even restarting the new
app OK
- I tried "ant -f deploy.xml deploy"
=> Tomcat manager undeploy and again redeploy the
application, everithing OK.

================
What does NOT work: deploying similar app in a
/dir/appname Context
================
- I want a copy of HelloWorld, copied all as myapp2
and edited build.xml deploy.xml context.xml and
web.xml
- THE DIFFERENCE is that now I want it as
http://myhost/SOMEDIR/myapp2
- So I mkdir /hostappbase/SOMEDIR
- Changed the files that way:

--- build.xml ---
<  <property name="app.name"    value="myapp"/>
<  <property name="app.path"  
value="/${app.name}"/>
---
>  <property name="app.name"    value="myapp2"/>
>  <property name="app.path"  
value="/SOMEDIR/${app.name}"/>

<  <property name="build.home"  
value="....../myapp"/>
---
>  <property name="build.home"  
value="....../myapp2"/>

--- deploy.xml ---
<  <property name="webapp"  value="myapp"/>
<  <property name="path"   value="/myapp"/>
---
>  <property name="webapp"  value="myapp2"/>
>  <property name="path"  
value="/SOMEDIR/myapp2"/>

<   <jar destfile="/hostappbase/${webapp}.war"
---
>   <jar
destfile="/hostappbase/SOMEDIR/${webapp}.war"

<         path="${path}"
war="/hostappbase/${webapp}.war" update="true" />
---
>         path="${path}"
war="/hostappbase/SOMEDIR/${webapp}.war" update="true"
/>

--- context.xml ---
<  workDir="work/Catalina/myhost/myapp"
<  path="/myapp"
---
>  workDir="work/Catalina/myhost/SOMEDIR_myapp2"
>  path="/SOMEDIR/myapp2"

<  docBase="/hostappbase/myapp"
---
>  docBase="/hostappbase/SOMEDIR/myapp2"

--- web.xml ---
(no changes)

I followed the same steps and the result was:
1- when executed "ant -f deploy.xml compile" Tomcat
does not realize there is a new .war and does not load
nor unpacks the new app.
2- when executed "ant -f deploy.xml deploy" it seems
to load the app, but I got this error from Tomcat (so
ant says BUILD FAILED):

StandardContext[/manager]Manager:
ManagerServlet.install[/SOMEDIR/myapp2]
java.net.MalformedURLException: no !/ in spec


I found this note:
http://java.sun.com/j2se/1.4.2/docs/api/java/net/JarURLConnection.html

So I tried this change in deploy.xml:
war="jar:file:/hostappbase/SOMEDIR/${webapp}.war!/"
And I got a FileNotFound error from ant.
I tried combinations but none of them worked.

What is my mistake?
Thanks in advance.



   
______________________________________________
Renovamos el Correo Yahoo!: ?250 MB GRATIS!
Nuevos servicios, m��s seguridad
http://correo.yahoo.es

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.