Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Mixing JSP pages between Apache and Tomcat (http://www.velocityreviews.com/forums/t366009-mixing-jsp-pages-between-apache-and-tomcat.html)

euroq 08-22-2006 09:31 PM

Mixing JSP pages between Apache and Tomcat
 
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


Soren Kuula 08-22-2006 10:23 PM

Re: Mixing JSP pages between Apache and Tomcat
 
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

euroq 08-24-2006 03:39 PM

Re: Mixing JSP pages between Apache and Tomcat
 
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


Juha Laiho 09-02-2006 05:51 PM

Re: Mixing JSP pages between Apache and Tomcat
 
"euroq" <euroquigs@gmail.com> 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)


All times are GMT. The time now is 03:01 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.