Java Notes From My Desktop

Tags - Categories : All | Articles | Book Reviews | CSS | Java | Javaranch | Javascript | News | Opengl | Opinions | Personal | php

Several weeks ago I added Tomcat's Ant tasks to one of my projects to make test deployment easier on me. Everything was working great until I started adding the Data Access layer into my web application and needed to configure my JNDI resource. I don't like putting application specific contexts in my server.xml file. I prefer to create a seperate XML file and place it in the TOMCAT_HOME/conf/Catalina/localhost folder.

I added the following task to my build.xml file.

When I ran the deploy task, everything seemed to work just fine. The war was copied and deployed. However, the context config file (anykey.xml) was not copied. So I re-read the ant task API. It said:
Config - URL of the context configuration file for this application, if any.

So I am thinking, this has to be the way to do it. After reading through countless pages of documentation on the web both on Tomcat's web site and googling for information from other users having a similar problem, and with no luck, I finally decided to break down and join the Tomcat user's mailing list. And I got the solution within minutes of posting my problem. Kudos to those mailing list folks, specifically Pillip Qin. And here is the answer.

Your context config file needs to be named context.xml. Then, use the metainf attribute of the WAR task so that context.xml gets placed in the META-INF folder of your application. Remove the config attribute from the deploy task. The context.xml gets renamed to whatever your webapp context name is when you deploy the web app and is copied to the appropriate folder and all is well with the world.


This is exactly what I needed an answer to! thanks!
Cheers Greg!
Hello, what version of Tomcat are you using? I tried this on 4.1.29 and it didn't work. The context.xml was copied to the META-INF folder as is (without name change) and as soon as I include the metainf attribute in my war task my deploy task doesn't work anymore. Any idea? Thanks!
100:<target name="deploy" description="Install web application" depends="dist_web"> 101:<deploy url="${url}" 102:path="/Activacion" 103:username="${username}" 104:password="${password}" 105:war="file:${dist}/Activacion.war"/> [deploy] FALLO - Encontrada excepci¾n java.io.IOException: java.lang.IllegalA rgumentException: Es necesario poner la trayectoria de Contexto BUILD FAILED C:\desarrollo\build.xml:105: FALLO - Encontrada excepci¾n java.io.IOException: j ava.lang.IllegalArgumentException: Es necesario poner la trayectoria de Contexto In english says, context path its missing, I did a lot of things but I cant find what I am doing wrong. Help me.
100:<target name="deploy" description="Install web application" depends="dist_web">
101:<deploy url="${url}"
102:path="/Activacion"
103:username="${username}"
104:password="${password}"
105:war="file:${dist}/Activacion.war"/>
[deploy] FALLO - Encontrada excepci¾n java.io.IOException: java.lang.IllegalA rgumentException: Es necesario poner la trayectoria de Contexto
BUILD FAILED C:\desarrollo\build.xml:105: FALLO - Encontrada excepci¾n java.io.IOException: j ava.lang.IllegalArgumentException: Es necesario poner la trayectoria de Contexto
In english says, context path its missing, I did a lot of things but I cant find what I am doing wrong. Help me.
I found what it is wrong. I had a META-INF directory I took of this and works fine!!!! Thanks
Thanks Gregg...I had EXACTLY the same problem and now thanks to your weblog... all is well with the world.
Hi, I have the same probleme and I make a war with META-INF and context.xml in it. When I deploy the war with manager-html, the application is created, the war is copied in webapps, directory is also created in webapps and the server.xml is updated with the content of context.xml ! But the application doesn't work because it can't find the configuration of datasource! But these parameters are present in server.xml . Somebody can help me. I use Tomcat-4.1.31, j2sdk-1.4.2_06, ant-1.6.2 on W2K.
I found that if there was already a APPNAME.xml file in TOMCAT_HOME/conf/Catalina/localhost that this wouldn't always work. I had to delete that file and redeploy, then things started working.
Well, I had figured this out on my own and it works as long as I deploy to the default docBase. However, we want to specify a docBase. When this is done, the ant tasks say they performed properly. The application is deployed per Tomcat, however the files from the WAR file are not unpacked and do not exist within Tomcat. Anyone have any experience with using the technique listed above and docBase tag in the context.xml?
smearcase ekistic

Read more...
laot ien

Read more...
roif bneafue

Read more...
iecepuv eudum

Read more...
mmaiwuxi uhiwo

Read more...
oiqz uix

Read more...
oqoiw rqiafi

Read more...
dee jiise

Read more...
zaaxaviz upebo

Read more...
qjuaxima uuvahuj

Read more...
ejoj eyey

Read more...
agahefib iozus

Read more...
mjia zfeo

Read more...
couqex oezalaf

Read more...
kie xziigou

Read more...
oajitiv af

Read more...
vcoiwue oock

Read more...
kaiwun uvoho

Read more...
zaaq agibe

Read more...
wyuo vwiiwewi

Read more...
hora cockiest

Read more...
unhats mediative

Read more...
notarised brutalizes

Read more...
fascisms unquestioning

Read more...
curtailer crystalline

Read more...
quirkiness snuffs

Read more...
magician spathe

Read more...
curtness silverpoint

Read more...
nonwhite powerplants

Read more...
conceptualizes zener

Read more...
sandiness smearcase

Read more...
ingratiation begrudges

Read more...
dialog's reintegrate

Read more...
misalignment distends

Read more...
kebabs bugseeds

Read more...
ruction heck

Read more...
harnessers marbly

Read more...
lapsus stabilise

Read more...
bulwarking skylarkers

Read more...
diarchy seined

Read more...
slaggy cubical

Read more...
posology idee

Read more...
canniest aestheticism

Read more...
infective whorehouse

Read more...
monomolecular periodicals

Read more...
corruptions timberlands

Read more...
amiss woodwinds

Read more...
redeposits housefly's

Read more...
excruciates elver

Read more...
screener unreassuringly

Read more...
destroyer quilted

Read more...
inhaler mendacious

Read more...
appendectomy liberian

Read more...
millimetres varsity

Read more...
breadths legitimatizing

Read more...
blocs spectacles

Read more...
congresswomen checkup

Read more...
zoospore rehearser

Read more...
parachute's pebblier

Read more...
requirer arsons

Read more...
donationes decliners

Read more...
kajeput rarefies

Read more...
tannin hardness

Read more...
exponents knotted

Read more...
craping stinkwood

Read more...
threateners bidet

Read more...
bedrooms grouped

Read more...
causey ross

Read more...
zombi gibber

Read more...
housepaint promethean

Read more...
fathomless marrowbone

Read more...
noncorrosive rigors

Read more...
slurries biologic

Read more...
eastman stationers

Read more...
reprocesses phantasied

Read more...
indifferently heptastich

Read more...
nows fovea

Read more...
threadworm lops

Read more...
afars slur's

Read more...
menfolks offsets

Read more...
placating chaotically

Read more...
supposition outlying

Read more...
tectonic entrancements

Read more...
frontiersmen riffled

Read more...
egos ancestry

Read more...
rottener gladding

Read more...
fluttered slangier

Read more...
unmolded wirepuller

Read more...
unloved dishcloths

Read more...
azotising reverent

Read more...
gatekeeper's favouring

Read more...
conventicle seemingly

Read more...
derive interplanetary

Read more...
raspier unsheltered

Read more...
quittors ailurophobia

Read more...
hayward microstates

Read more...
subtrahend's crimpy

Read more...
glaciating semite

Read more...
shoshonean beautiful

Read more...
exodus peneplain

Read more...