You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by John Calsbeek <ne...@gmail.com> on 2007/04/18 00:29:38 UTC

Getting a project deployed

I'm trying to manually deploy a JSP website that I didn't make on a
web server that I didn't set up, so I'm kind of in strange territory
here (first time using Tomcat). Here's what I have/know:

Linux webserver using Apache 2 and Tomcat 5, mod_jk. Tomcat is
working—the default base URL of /jsp-examples is working. I can give
sections of the config web.xml and server.xml files if needed.

I've got a website located at <tomcat5>/base/webapps/jmarks. I believe
it was created with NetBeans 5. It's a royal hodgepodge of *.html,
*.jsp, JavaScript/CSS/images/etc., with a WEB-INF and META-INF folder.
WEB-INF contains classes and libs folders, fully loaded, and a web.xml
file. META-INF has a context.xml file. All files have identical
permissions, owner, and group to the jsp-examples. Here is the
WEB-INF/web.xml file. I added the <servlet> and <servlet-mapping> tags
to what NetBeans generated.

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
         version="2.4">
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>
            index.jsp
        </welcome-file>
    </welcome-file-list>

    <servlet>
        <servlet-name>DoverWebsite</servlet-name>
        <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>DoverWebsite</servlet-name>
        <url-pattern>*.jsp</url-pattern>
    </servlet-mapping>
</web-app>

This folder is aliased to /path/to/jmarks in Apache's configuration,
in the jk.conf file (as per /jsp-examples). It also includes a
'JkMount /path/to/jmarks/*.jsp ajp13' line. This partially works—I can
read any of the *.html pages. However, trying any of the *.jsp files
gives me this error in the browser:

HTTP Status 404 - /path/to/jmarks/index.jsp

type: Status report

message: /path/to/jmarks/index.jsp

description: The requested resource (/path/to/jmarks/index.jsp) is not
available.

Apache Tomcat/5.0

I'm not sure where to go to get more information on the exact error.
The Tomcat log I found
(<tomcat5>/base/logs/localhost_log.2007-04-17.txt) shows this at the
last restart of the Tomcat daemon:

2007-04-17 12:00:12
StandardContext[/servlets-examples]ContextListener:
attributeReplaced('org.apache.catalina.WELCOME_FILES',
'[Ljava.lang.String;@b05acd')
2007-04-17 12:00:12
StandardContext[/servlets-examples]ContextListener:
attributeReplaced('org.apache.catalina.WELCOME_FILES',
'[Ljava.lang.String;@1989b5')
2007-04-17 12:00:12
StandardContext[/servlets-examples]ContextListener:
attributeReplaced('org.apache.catalina.WELCOME_FILES',
'[Ljava.lang.String;@a00185')
2007-04-17 12:00:12
StandardContext[/servlets-examples]SessionListener: contextDestroyed()
2007-04-17 12:00:12
StandardContext[/servlets-examples]ContextListener: contextDestroyed()
2007-04-17 12:00:12 StandardContext[/jsp-examples]ContextListener:
attributeReplaced('org.apache.catalina.WELCOME_FILES',
'[Ljava.lang.String;@1328c7a')
2007-04-17 12:00:12 StandardContext[/jsp-examples]ContextListener:
attributeReplaced('org.apache.catalina.WELCOME_FILES',
'[Ljava.lang.String;@1a4ded3')
2007-04-17 12:00:12 StandardContext[/jsp-examples]ContextListener:
attributeReplaced('org.apache.catalina.WELCOME_FILES',
'[Ljava.lang.String;@121177e')
2007-04-17 12:00:12 StandardContext[/jsp-examples]SessionListener:
contextDestroyed()
2007-04-17 12:00:12 StandardContext[/jsp-examples]ContextListener:
contextDestroyed()
2007-04-17 12:00:33 StandardContext[/jsp-examples]ContextListener:
contextInitialized()
2007-04-17 12:00:33 StandardContext[/jsp-examples]SessionListener:
contextInitialized()
2007-04-17 12:00:34
StandardContext[/servlets-examples]ContextListener:
contextInitialized()
2007-04-17 12:00:34
StandardContext[/servlets-examples]SessionListener:
contextInitialized()

Doesn't show my application anywhere on startup, only the example
applications. start.log, stop.log, and mod_jk.log don't appear to be
any help.

Does anyone have any suggestions as to what I can do to figure out the
problem from here? I've seen references to a webapp manager JSP
application, but I haven't had any success in finding it on this web
server.

Sorry if this kind of thing comes up a lot—I appreciate any help!

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Getting a project deployed

Posted by Hassan Schroeder <ha...@gmail.com>.
On 4/18/07, John Calsbeek <ne...@gmail.com> wrote:

> Yeah, it's just nicer to have a port 80 connection…

So run Tomcat on port 80 -- is there any aspect of Apache httpd you
actually /require/? PHP, proxy to Mongrel, whatever?

If not, simplify your life and run Tomcat standalone :-)

FWIW,
-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Getting a project deployed

Posted by John Calsbeek <ne...@gmail.com>.
On 4/19/07, Rashmi Rubdi <ra...@gmail.com> wrote:
> Check the configuration of the above aliasing. Normally URL Rewriting
> is done in a sequence, the first matching path pattern is applied, so
> it helps to check all patterns and see which is the first one that's
> being applied.

The alias looks like this:

Alias /path/to/jmarks "/srv/www/tomcat5/base/webapps/jmarks"
<Directory "/srv/www/tomcat5/base/webapps/jmarks">
    Options Indexes FollowSymLinks
    allow from all
</Directory>

It is copied wholesale from aliases that already exist for the
built-in /jsp-examples and /servlets-examples, which work correctly.
In addition, I know that the alias works correctly for all other
content in the directory, and that I get the same error without
aliasing.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Getting a project deployed

Posted by Rashmi Rubdi <ra...@gmail.com>.
Ok, if you insist on having an Apache Httpd (even though you may or
may not need it), someone on this list might help you further
configure it.

But I just wanted to say a few things... my reply is below...

On 4/19/07, John Calsbeek <ne...@gmail.com> wrote:
> Yeah, this isn't my webserver. I'm not excited about pulling out an
> existing Apache setup...
>
> On 4/18/07, Rashmi Rubdi <ra...@gmail.com> wrote:
> > It is most likely that the project is not configured properly. We can
> > fix the 404 error by properly configuring your project for Tomcat
> > alone.
> >
> > For starters, what is the absolute path of this index.jsp from the
> > root folder of the Linux machine?
>
> /srv/www/tomcat5/base/webapps/jmarks/index.jsp

Normally in Tomcat a JSP page with the above absolute path is accessible at
http://localhost:8080/jmarks/index.jsp , where jmarks is known as the context

As Hassan mentioned earlier you would be able to change the port to 80
, the port configuration is in server.xml , look for where it says
8080 (only in case you want to change it in Tomcat and not through
Apache).

>
> /srv/www/tomcat5/base/webapps/jmarks is aliased with Apache to the
> HTTP path /path/to/jmarks

The above aliasing of paths also works in Tomcat alone with the use of
Filters. The aliasing is commonly known as URL Rewriting - normally
people write their own Filters or download and install a pre-written
one - Google will help here.

>
> When I had this folder directly in /srv/www/htdocs/path/to/jmarks, I
> had the same problem—*.html works fine, *.jsp does not.

Check the configuration of the above aliasing. Normally URL Rewriting
is done in a sequence, the first matching path pattern is applied, so
it helps to check all patterns and see which is the first one that's
being applied.

-Rashmi

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Getting a project deployed

Posted by John Calsbeek <ne...@gmail.com>.
Yeah, this isn't my webserver. I'm not excited about pulling out an
existing Apache setup...

On 4/18/07, Rashmi Rubdi <ra...@gmail.com> wrote:
> It is most likely that the project is not configured properly. We can
> fix the 404 error by properly configuring your project for Tomcat
> alone.
>
> For starters, what is the absolute path of this index.jsp from the
> root folder of the Linux machine?

/srv/www/tomcat5/base/webapps/jmarks/index.jsp

/srv/www/tomcat5/base/webapps/jmarks is aliased with Apache to the
HTTP path /path/to/jmarks

When I had this folder directly in /srv/www/htdocs/path/to/jmarks, I
had the same problem—*.html works fine, *.jsp does not.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Getting a project deployed

Posted by Rashmi Rubdi <ra...@gmail.com>.
On 4/18/07, John Calsbeek <ne...@gmail.com> wrote:
> For anyone tuning in, my problem is this message displayed in the browser:
>

I just want to add that the following error message is not related to
mod_jk or Apache, this error commonly occurs on Tomcat alone if the
project is not configured correctly.

It is most likely that the project is not configured properly. We can
fix the 404 error by properly configuring your project for Tomcat
alone.

For starters, what is the absolute path of this index.jsp from the
root folder of the Linux machine?

> HTTP Status 404 - /path/to/jmarks/index.jsp
>
> type: Status report
>
> message: /path/to/jmarks/index.jsp
>
> description: The requested resource (/path/to/jmarks/index.jsp) is not
> available.
>
> Apache Tomcat/5.0
>


-Rashmi

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Getting a project deployed

Posted by John Calsbeek <ne...@gmail.com>.
On 4/18/07, Rashmi Rubdi <ra...@gmail.com> wrote:
> I personally haven't worked with mod_jk , I'm sure there's someone on
> this list who could help you with mod_jk config.
>
> A lot of info is available in the docs also:
> http://tomcat.apache.org/connectors-doc/index.html
>
> But simply running JSPs doesn't require any connection with Apache Httpd.

Yeah, it's just nicer to have a port 80 connection…

At the moment my pressing question is where to find more information
about errors. The mod_jk log doesn't appear to have any details, nor
does the Apache log. So I don't really have anything to go on.

For anyone tuning in, my problem is this message displayed in the browser:

HTTP Status 404 - /path/to/jmarks/index.jsp

type: Status report

message: /path/to/jmarks/index.jsp

description: The requested resource (/path/to/jmarks/index.jsp) is not
available.

Apache Tomcat/5.0

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Getting a project deployed

Posted by Rashmi Rubdi <ra...@gmail.com>.
I personally haven't worked with mod_jk , I'm sure there's someone on
this list who could help you with mod_jk config.

A lot of info is available in the docs also:
http://tomcat.apache.org/connectors-doc/index.html

But simply running JSPs doesn't require any connection with Apache Httpd.

-Rashmi

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Getting a project deployed

Posted by John Calsbeek <ne...@gmail.com>.
On 4/18/07, Rashmi Rubdi <ra...@gmail.com> wrote:
> That's it, you can then start Tomcat with startup.sh and access it at
> http://localhost:8080/ by default, and remember to shut it down with
> shutdown.sh and not CtrlC
>
> Then, to see a simple JSP application, create a new folder under
> Tomcat's webapps folder.
> Put a JSP file with any text there. You can then access the JSP at
> http://localhost:8080/SomeFolder/somefile.jsp , in this case
> SomeFolder is known as the application's context.
>
> Anything in the ROOT context appears immediately after the slash here:
> http://localhost:8080/

Ah, you make me happy. It works perfectly standalone. So it appears my
issue is with either Apache or mod_jk, not with Tomcat. Which is odd,
because no error messages have appeared in mod_jk.log. So maybe it's
Apache I'm having troubles with.

I'm doing a 'JkMount /path/to/jmarks/*.jsp ajp13' in my Apache
configuration, as I said, plus an alias to the webapps folder—do I
need another configuration directive somewhere to finish it up?

Is there anything more I can plead from this list or would my problem
be best dealt with elsewhere?

Thanks.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Getting a project deployed

Posted by Rashmi Rubdi <ra...@gmail.com>.
It is very simple to set-up, you just need to install the most recent
compatible JDK (you probably have this already)

 then get the tar.gz file for the version of your choice from here:
http://tomcat.apache.org/

Set the JAVA_HOME the environment variable, it point's to JDK
installation's root folder.

I haven't installed anything on Linux, but on Windows XP I know that
if the zip download is unzipped to a particular directory, tomcat can
be started with startup.bat and stopped with shutdown.bat

In Linux, similarly I think you should be able to do the same with
startup.sh and shutdown.sh

After Tomcat is unzipped to a folder, set the CATALINA_HOME
environment variable to Tomcat installation's root folder.

That's it, you can then start Tomcat with startup.sh and access it at
http://localhost:8080/ by default, and remember to shut it down with
shutdown.sh and not CtrlC

Then, to see a simple JSP application, create a new folder under
Tomcat's webapps folder.
Put a JSP file with any text there. You can then access the JSP at
http://localhost:8080/SomeFolder/somefile.jsp , in this case
SomeFolder is known as the application's context.

Anything in the ROOT context appears immediately after the slash here:
http://localhost:8080/

The above covers the basics then, you can configure a Context XML file
for your app and set other advanced configuration --- most of it is
covered in the configuration docs but ask us if you have questions.

-Rashmi



On 4/18/07, John Calsbeek <ne...@gmail.com> wrote:
> > If I was in this situation, I would first try to run a webapp with a JSP on a
> > standalone Tomcat (independent of any IDEs) and without mod_jk.
> >
> > The simple setup eliminates a lot of confusion :-)
>
> I've never done this before. I haven't the first idea how to go about that. :)
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Getting a project deployed

Posted by John Calsbeek <ne...@gmail.com>.
> If I was in this situation, I would first try to run a webapp with a JSP on a
> standalone Tomcat (independent of any IDEs) and without mod_jk.
>
> The simple setup eliminates a lot of confusion :-)

I've never done this before. I haven't the first idea how to go about that. :)

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Getting a project deployed

Posted by Rashmi Rubdi <ra...@gmail.com>.
On 4/17/07, John Calsbeek <ne...@gmail.com> wrote:
> I'm trying to manually deploy a JSP website that I didn't make on a
> web server that I didn't set up, so I'm kind of in strange territory
> here (first time using Tomcat).

If I was in this situation, I would first try to run a webapp with a JSP on a
standalone Tomcat (independent of any IDEs) and without mod_jk.

The simple setup eliminates a lot of confusion :-)

>
> Does anyone have any suggestions as to what I can do to figure out the
> problem from here? I've seen references to a webapp manager JSP
> application, but I haven't had any success in finding it on this web
> server.
>
> Sorry if this kind of thing comes up a lot—I appreciate any help!
>

-Rashmi

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org