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

Discussion in 'Java' started by DiscoStu, Sep 1, 2004.

  1. DiscoStu

    DiscoStu Guest

    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
     
    DiscoStu, Sep 1, 2004
    #1
    1. Advertising

  2. DiscoStu

    Murray Guest

    "DiscoStu" <> wrote in message
    news:...
    > 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.
     
    Murray, Sep 2, 2004
    #2
    1. Advertising

  3. DiscoStu

    dan Guest

    "Murray" <> wrote in message news:<wuuZc.16220$>...
    > "DiscoStu" <> wrote in message
    > news:...
    > > 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.



    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 )
     
    dan, Oct 1, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sean Clarke
    Replies:
    1
    Views:
    1,952
    Sudsy
    Jan 7, 2004
  2. circuit_breaker
    Replies:
    2
    Views:
    2,095
    Jack Jia
    Apr 4, 2004
  3. Doug McCann
    Replies:
    1
    Views:
    1,154
    William Brogden
    Aug 5, 2004
  4. galapogos
    Replies:
    4
    Views:
    411
    Kenny McCormack
    May 11, 2007
  5. LittleAlex
    Replies:
    0
    Views:
    459
    LittleAlex
    Sep 15, 2008
Loading...

Share This Page