Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Mixing JSP pages between Apache and Tomcat

Reply
Thread Tools

Mixing JSP pages between Apache and Tomcat

 
 
euroq
Guest
Posts: n/a
 
      08-22-2006
Hello all. I am just starting this project for my company. I already
have a web directory that is running on my company's server with
Apache. I needed to have some dynamic content going on, and PHP was
unfortunately not an option because I needed PHP-MySQL and the Linux
distribution on the server is dated (RedHat 8.0) and I couldn't for the
life of me find the compatible PHP-MySQL .RPM with the right
dependencies.

So... I installed Tomcat and mod_jk. In the httpd.conf for Apache, I
have here:
# Send everything ending with .jsp to worker named worker1 (ajp13)
JkMount /*.jsp worker1

Well I figured out that when mod_jk sends the requests over to Tomcat,
Tomcat expects the .jsp files to be stored _IN_ Tomcat's directory.
Which already presents a problem, because now I have to deploy from one
directory structure to multiple locations. (Does anybody have another
suggestion?)

Besides that, here is my problem:
I have this test page "test.jsp" in my root apache directory. The url
is
http://my.domain.com/test.jsp

I copied "test.jsp" to the Tomcat directory:
TOMCAT_DIR/webapps/ROOT/

And it worked great. But when I have the url:
http://my.domain.com/subdir/test.jsp
And "test.jsp" is copied to the Tomcat directory:
TOMCAT_DIR/webapps/subdir/
Tomcat gives me a 404 (Not Found) error!

How do I have .jsp pages in subdirectories with Tomcat? From what I
can see, the only things in the Tomcat directories are webapps, i.e.
they all have WEB-INF/web.xml files and each webapp is probably stored
in another large .XML file. This seems overly complicated, as all I
need is a simple .JSP page to be processed.

Thanks for any help out there universe,
-euroq

 
Reply With Quote
 
 
 
 
Soren Kuula
Guest
Posts: n/a
 
      08-22-2006
euroq wrote:

Hi, just a naive suggestion:

> JkMount /*.jsp worker1


> Tomcat gives me a 404 (Not Found) error!


Did you not only map everything in the server ROOT to Tomcat? And is it
really really Tomcat and not Apache that gives you the 404?

Usually, just throwing a .jsp in webapps/something/blah.jsp should work
without further ado...

What happens if you make Tomcat accessible through a local port (like
8080) (I can't remember the details, but Tomcat comes configured for
that by default anyway) and access your jsp through that?

Søren
 
Reply With Quote
 
 
 
 
euroq
Guest
Posts: n/a
 
      08-24-2006
Hello all. I found the answer and am posting it for anyone else who
may need it.

> I have this test page "test.jsp" in my root apache directory. The url is
> http://my.domain.com/test.jsp
>
> I copied "test.jsp" to the Tomcat directory:
> TOMCAT_DIR/webapps/ROOT/
>
> And it worked great. But when I have the url:
> http://my.domain.com/subdir/test.jsp
> And "test.jsp" is copied to the Tomcat directory:
> TOMCAT_DIR/webapps/subdir/
> Tomcat gives me a 404 (Not Found) error!
>


The answer is to put "test.jsp" in
TOMCAT_DIR/webapps/ROOT/subdir/
which points to
http://my.domain.com/subdir/test.jsp

 
Reply With Quote
 
Juha Laiho
Guest
Posts: n/a
 
      09-02-2006
"euroq" <(E-Mail Removed)> said:
>Hello all. I am just starting this project for my company. I already
>have a web directory that is running on my company's server with
>Apache. I needed to have some dynamic content going on, and PHP was
>unfortunately not an option because I needed PHP-MySQL and the Linux
>distribution on the server is dated (RedHat 8.0) and I couldn't for the
>life of me find the compatible PHP-MySQL .RPM with the right
>dependencies.


Ok; how about dropping Apache and moving also the static content into
Tomcat? Just a suggestion, but depending on your loads, might be one
possibility.

>Well I figured out that when mod_jk sends the requests over to Tomcat,
>Tomcat expects the .jsp files to be stored _IN_ Tomcat's directory.


However, also that directory is configurable. On the other hand, also
the document root for Apache is configurable.

>Which already presents a problem, because now I have to deploy from one
>directory structure to multiple locations. (Does anybody have another
>suggestion?)


So, you can arrange for the Apache document root and Tomcat webapp
directory be the same. Be careful with permissions, though - you
should configure Apache to deny any and all downloads from the WEB-INF/
directory tree.

>Besides that, here is my problem:
>I have this test page "test.jsp" in my root apache directory. The url
>is
>http://my.domain.com/test.jsp
>
>I copied "test.jsp" to the Tomcat directory:
>TOMCAT_DIR/webapps/ROOT/
>
>And it worked great. But when I have the url:
>http://my.domain.com/subdir/test.jsp
>And "test.jsp" is copied to the Tomcat directory:
>TOMCAT_DIR/webapps/subdir/
>Tomcat gives me a 404 (Not Found) error!


How about using webapps/ROOT/subdir/test.jsp? You really don't want to
sprinkle your dynamic content into several webapps (which would happen
if you used several subdirs within webapps/ .
--
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)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Jakatra tomcat- Ant - Apache tomcat - Difference ? Oom Computer Support 1 10-08-2007 05:13 PM
[JSP] difference between jsp:forward and jsp:include alexjaquet@gmail.com Java 0 06-02-2006 01:21 PM
tomcat-maven-plugin problem - mvn is looking for org.apache.maven.plugins:maven-tomcat-plugin Marcin Cenkier Java 1 04-12-2006 08:00 PM
Difference between Apache Tomcat and Jakrata Tomcat twins Java 1 11-25-2005 05:57 PM
Apache Tomcat 4.1.24: problem with Tomcat Administration link Christos Gravvanis Java 0 07-07-2004 05:21 PM



Advertisments