Setting up Tomcat to run jsp/servlet's from USB keychain

D

DiscoStu

Thats right,

I've got this client program that runs as a series of JSP pages
and a few servlets. I want to distribute just my web application on
the keychains, and then have Tomcat5 installed on all the machines
that will run the client program. I know I can setup a Tomcat context
to point to a directory OTHER then in the /webapps folder. So I want
to point to my webapp stored on the keychain drive, but when Tomcat
loads the keychain wont be attached so it wont be able to load that
context on startup. If a user plugs his/her keychain drive in and the
directory then becomes valid, will tomcat know enough to then load-up
the context? (Does it rescan the server.xml file, like it does the
web.xml files?)

Also, what would be the consequences of having the user pull out the
keychain drive, thus making the web application unavailable to Tomcat.
Will tomcat be able to recognize and gracefully handle that?

Thanks everyone,

Greg
 
M

Murray

DiscoStu said:
Thats right,

I've got this client program that runs as a series of JSP pages
and a few servlets. I want to distribute just my web application on
the keychains, and then have Tomcat5 installed on all the machines
that will run the client program. I know I can setup a Tomcat context
to point to a directory OTHER then in the /webapps folder. So I want
to point to my webapp stored on the keychain drive, but when Tomcat
loads the keychain wont be attached so it wont be able to load that
context on startup. If a user plugs his/her keychain drive in and the
directory then becomes valid, will tomcat know enough to then load-up
the context? (Does it rescan the server.xml file, like it does the
web.xml files?)

Also, what would be the consequences of having the user pull out the
keychain drive, thus making the web application unavailable to Tomcat.
Will tomcat be able to recognize and gracefully handle that?

Thanks everyone,

Greg

I doubt very much any of that will work in the way you want. Tomcat doesn't
rescan the server.xml for changes, and doesn't automagically retry to load
contexts after they fail. However, it does monitor the webapps directory and
will hot-deploy a new app if it finds one.

Instead of defining the Context in server.xml, you can use a separate xml
descriptor which might look something like this

<Context path="/whatever" docBase="E:/myProject/war" debug="0"
reloadable="true">
<Loader reloadable="true" checkInterval="5"/>
</Context>

When the USB drive is connected, you could run a script that copies this XML
descriptor into the tomcat/webapps dir. Tomcat will detect the change and
deploy the app from the USB drive

As for removing the key, Tomcat will actually crash. I just tried it myself.
The entire server shuts down.
 
D

dan

Murray said:
I doubt very much any of that will work in the way you want. Tomcat doesn't
rescan the server.xml for changes, and doesn't automagically retry to load
contexts after they fail. However, it does monitor the webapps directory and
will hot-deploy a new app if it finds one.

Instead of defining the Context in server.xml, you can use a separate xml
descriptor which might look something like this

<Context path="/whatever" docBase="E:/myProject/war" debug="0"
reloadable="true">
<Loader reloadable="true" checkInterval="5"/>
</Context>

When the USB drive is connected, you could run a script that copies this XML
descriptor into the tomcat/webapps dir. Tomcat will detect the change and
deploy the app from the USB drive

As for removing the key, Tomcat will actually crash. I just tried it myself.
The entire server shuts down.


I am working on a similar task, and was wondering the following.

When I set my

<Context path="/whatever" docBase="E:/" debug="0"
reloadable="true"></Context>

And E: is the drive my USB key is in, everything works fine. Now in
some instances the webapps reside on a computer that I have mapped a
drive to. say drive W: When I set my context as

<Context path="/whatever" docBase="W:/" debug="0"
reloadable="true"></Context>

And try to view the pages, ( after restarting tomcat 5.x with the
drive already mapped ) i get a HTTP 404 error. And the log states it
is an invalid path, or no read access. Any idea what is causing this?
I can view the files fine through the mapped drive. ( also tried the
UNC path i.e. //servername/apps, still didn't work )
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top