Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2006

Tip: Looking for answers? Try searching our database.

Moving webapps around

Thread view: 
DaLoverhino - 24 Jun 2006 21:22 GMT
Hello.  I am trying to learn j2ee using Apache Tomcat 5.5.17 under
Windows XP Personal edition.  I have the following app which I copied
out of a book:

C:\Program Files\....\webapps\stock

Now, I want to place the "stock" web app in a subdirectory with other
webapps:

C:\Program Files\....\webapps\BookExamples\stock

So I cut and paste the stock directory under BookExamples.  Now I use
to type

http://localhost:8080/stock/index.html

I now type

http://localhost:8080/MyApps/stock/index.html

I get the first page up alright, but subsequent links from index.html
do not work.  I get "HTTP Status 404 blah blah is not available."

Here's a link from index.html:
 <a href="StockList/AnalystForm">See all Analysts</a>

Here's an excerpt from web.xml:

<servlet>
 <servlet-name>StockList</servlet-name>
 <servlet-class>web.StockListServlet</servlet-class>
</servlet>

<servlet-mapping>
 <servlet-name>StockList</servlet-name>
 <url-pattern>StockList</url-pattern>
</servlet-mapping>

Now, keep in mind, everything works, if I didn't move the app to a
subdirectory.  So what do I need to change to make this app work under
a sub directory?  I've tried a bunch of things, and none of them work.
I'm hoping someone here can tell me, or at least tell me it's
impossible.

thanks!
Juha Laiho - 25 Jun 2006 20:26 GMT
"DaLoverhino" <DaLoveRhino@hotmail.com> said:
>Hello.  I am trying to learn j2ee using Apache Tomcat 5.5.17 under
>Windows XP Personal edition.  I have the following app which I copied
[quoted text clipped - 6 lines]
>
>C:\Program Files\....\webapps\BookExamples\stock
...

at which point web.xml becomes "hidden" from the server;
the server expects to find web.xml at <applicationroot>/WEB-INF/web.xml,
and only one web.xml per application. WIth the way you combine them,
you'd have the files at <applicationroot>/something/WEB-INF/web.xml,
which are more or less ignored by the server.

What you could do is:
- move the applications completely out of webapps/
- create a separate context descriptor (either a separate file,
 or a segment in Tomcat server.xml) to point to the new directory
 (see http://tomcat.apache.org/tomcat-5.5-doc/config/context.html)

>So I cut and paste the stock directory under BookExamples.  Now I use
>to type
[quoted text clipped - 3 lines]
>I now type
>http://localhost:8080/MyApps/stock/index.html

... and with what I proposed above, you'd still refer to the applications
in the "short" way (unless you force something else with the "path" element
of the context descriptors).

However, depending on the quality of your examples, it could be that they
only work where the author expected them to be located (so, perhaps you're
only expected to change the host name, but not the context path).
Signature

Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
        PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.