You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Darren Hall <dh...@utrs.com> on 2006/07/18 22:55:20 UTC

The requested resource is not available

Simple problem (hopefully) and I've been here before, but for some reason I
can't find my way through this error.

Here's the scenario:

I've written a servlet which I'm deploying in Tomcat 5.5 using Apache 2.2 as
the web server. The servlet is a controller for one domain I have on my
server (lets call it the 'abc' domain.) The servlet is bundled into a war
file and deploys into Tomcat with no errors. The servlet-mapping in the
web.xml file defines the following:

<!-- Controller Servlet Configuration -->
<servlet>
<servlet-name>controller</servlet-name>
<servlet-class>com.abc.framework.controller.ControlServlet</servlet-class>
</servlet>

<!-- Controller Servlet Mapping -->
<servlet-mapping>
<servlet-name>controller</servlet-name>
<url-pattern>/abc</url-pattern>
</servlet-mapping>

I've configured my httpd-vhosts.conf file to do a proxy pass through as
follows:

<VirtualHost www.abc.com>
DocumentRoot /work/abc/abc-app/deploy/var/www/htdocs/abc
ServerName www.abc.com
ServerPath /abc
ErrorLog logs/abc/www.abc.com-error_log
CustomLog logs/abc/www.abc.org-access_log common

ProxyRequests Off
ProxyPass / http://localhost:8080/abc
ProxyPassreverse / http://localhost:8080/abc
</VirtualHost>

When I point my browser at http://www.abc.com/, I get a Tomcat error "The
requested resource (/abc) is not available."

This indicates to me that the proxy pass through is working properly in
Apache, but that Tomcat is not handing off the request to my serlvet.
Also I've tried hitting the servlet directly by pointing my browser
to http://localhost:8080/abc and I get the same "The requested resource
(/abc) is not available" error.

What have I done wrong? 
Everything looks good to me...

Thanks for the help.

Darren Hall


---------------------------------------------------------------------
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: simple connection pooling

Posted by Mark Thomas <ma...@apache.org>.
Darren Hall wrote:
> Hi all.
> I'm using Oracle 10g with Tomcat 5.5 and Struts 1.2.9.

When starting a new thread (ie sending a message to the list about a
new topic) please do not reply to an existing message and change the
subject line. To many of the list archiving services and mail clients
used by list subscribers this  makes your new message appear as part
of the old thread. This makes it harder for other users to find
relevant information when searching the lists.

This is known as thread hijacking and is behaviour that is frowned
upon on this list. Frequent offenders will be removed from the list.
It should also be noted that many list subscribers automatically
ignore any messages that hijack another thread.

The correct procedure is to create a new message with a new subject.
This will start a new thread.

Mark
tomcat-user-owner

---------------------------------------------------------------------
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


simple connection pooling

Posted by Darren Hall <dh...@utrs.com>.
Hi all.
I'm using Oracle 10g with Tomcat 5.5 and Struts 1.2.9.
I'd like to set up connection pooling for my application. I've read the
Tomcat "HOW-TO" on setting up a JNDI Datasource for connection pooling, but
one thing confuses me -
In the how-to, it states "Configure the JNDI DataSource in Tomcat by adding
a declaration for your resource to $CATALINA_HOME/conf/server.xml.

Add this in between the </Context> tag of the examples context and the
</Host> tag closing the localhost definition. If there is no such tag, you
can add one as illustrated in the Context and Host configuration
references..."
However, in "The Context Container" documentation referenced in the above
article it states "Please note that for tomcat 5, unlike tomcat 4.x, it is
NOT recommended to place <Context> elements directly in the server.xml file.
Instead, put them in the META-INF/context.xml directory of your WAR file or
the conf directory"
So where do I place this <Context> element containing my resource that
describes the datasource?

Also, if the datasource is set up through Tomcat - is it then visible in
Struts? I'd imagine in would be through the JNDI, but I want to make sure
it's not in some "other context" that struts can't see.

Thanks,

Darren



---------------------------------------------------------------------
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: Setting the classpath for my application

Posted by Martin Gainty <mg...@hotmail.com>.
Darren

Perhaps you have a meta-tag in META-INF suggests re-routing to a different class?
I would also make sure you have reloaded your webapp after re-reploying your classes

M-
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.



----- Original Message ----- From: "Darren Hall" <dh...@utrs.com>
To: "'Tomcat Users List'" <us...@tomcat.apache.org>
Sent: Monday, July 24, 2006 3:06 PM
Subject: RE: Setting the classpath for my application


I wanted to confirm that jar files in the WEB-INF/lib  directory were
included in the classpath for my application. In reading through the online
documentation for Tomcat I found the following:

"WebappX - A class loader is created for each web application that is
deployed in a single Tomcat 5 instance. All unpacked classes and resources
in the /WEB-INF/classes directory of your web application archive, plus
classes and resources in JAR files under the /WEB-INF/lib directory of your
web application archive, are made visible to the containing web application,
but to no others."

I am doing exactly this. My jar file (foo.jar) is in the
webapps/abc/WEB-INF/lib directory for my 'abc' application. However, in the
Catalina log file, when Tomcat starts, I get a "ClassNotFound -
com.abc.framework.ControlServlet" error. Why can my servlet not be found if
it resides in the jar under the WEB-INF/lib directory???

Any help would be appreciated.

Thanks,

Darren



-----Original Message-----
From: Darren Hall [mailto:dhall@utrs.com] 
Sent: Monday, July 24, 2006 1:59 PM
To: 'Tomcat Users List'
Subject: Setting the classpath for my application

Is the fact that I'm receiving a ClassNotFound error from Tomcat's
ClassLoader for a class that I've created indicative of a bad classpath?
Are jar files stored in WEB-INF/lib automatically included in Tomcat's
classpath for my application?

If so, how do I set the classpath for my application in Tomcat?

Thanks,

Darren

-----Original Message-----
From: Darren Hall [mailto:dhall@utrs.com] 
Sent: Monday, July 24, 2006 11:19 AM
To: 'Tomcat Users List'
Subject: ClassNotFound - Is WEB-INF/lib in my app's classpath?

Ok, I've deployed my application in Tomcat 5.5 on Solaris using the war
deploy feature in the manager.

The application (lets call it 'foo') shows up in the manager as '/foo', so I
know that it deploys. When I look in catalina.log, I see a ClassNotFound
exception, alerting me that the ClassLoader wasn't able to find my
ControllerServlet class. Here is the error from Catalina.log:

2006-07-24 09:38:46,987 DEBUG
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] -
Sending application start events

2006-07-24 09:38:46,987 DEBUG
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] -
Starting filters

2006-07-24 09:38:47,002 INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] -
Marking servlet controller as unavailable

2006-07-24 09:38:47,002 ERROR
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] - Error
loading WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@1c92535
 com.abc.framework.controller.ControlServlet
java.lang.ClassNotFoundException:
com.abc.framework.controller.ControlServlet

My ControlServlet class is located in this jar file
webapps/foo/WEB-INF/lib/abc.jar in the package
com.abc.framework.controller;.

Are the jar files in WEB-INF/lib included in my application's classpath by
default? Do I need to make a classpath change somewhere? Is the fact that
WEB-INF/lib not show up in the repositories listing above meaningful?

Why can't Tomcat's classloader find my ControlServlet class?

Thanks,

Darren


---------------------------------------------------------------------
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



---------------------------------------------------------------------
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: Setting the classpath for my application

Posted by Suresh babu <su...@gmail.com>.
I agree with chris

On 7/25/06, Christopher Schultz <ch...@christopherschultz.net> wrote:
>
> Darren,
>
> > My jar file (foo.jar) is in the
> > webapps/abc/WEB-INF/lib directory for my 'abc' application. However, in
> the
> > Catalina log file, when Tomcat starts, I get a "ClassNotFound -
> > com.abc.framework.ControlServlet" error. Why can my servlet not be found
> if
> > it resides in the jar under the WEB-INF/lib directory???
>
> Can you confirm with "jar tvf webapps/abd/WEB-INF/lib/abc.jar" that your
> class is actually in there with the path
> "com/abc/framework/ControlServlet.class"?
>
> Another thing you could try is this:
>
> $ javap -classpath webapps/abc/WEB-INF/lib/abc.jar  \
>                   com.abc.framework.ControlServlet
>
> This should print out the API of your class. If it does not, then either
> the JAR is broken or the package and class names are incorrect.
>
> -chris
>
>
>
>
>


-- 
Suresh Babu,
Software Engineer,
Computer Associates-India

Re: Setting the classpath for my application

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Darren,

> My jar file (foo.jar) is in the
> webapps/abc/WEB-INF/lib directory for my 'abc' application. However, in the
> Catalina log file, when Tomcat starts, I get a "ClassNotFound -
> com.abc.framework.ControlServlet" error. Why can my servlet not be found if
> it resides in the jar under the WEB-INF/lib directory???

Can you confirm with "jar tvf webapps/abd/WEB-INF/lib/abc.jar" that your
class is actually in there with the path
"com/abc/framework/ControlServlet.class"?

Another thing you could try is this:

$ javap -classpath webapps/abc/WEB-INF/lib/abc.jar  \
                   com.abc.framework.ControlServlet

This should print out the API of your class. If it does not, then either
the JAR is broken or the package and class names are incorrect.

-chris



Re: Setting the classpath for my application

Posted by David Smith <dn...@cornell.edu>.
Ok..... Confirmed.  Per the servlet spec, all jars in the WEB-INF/lib 
folder are included in the webapp's classloader.

Now, here are some questions that might help narrow down what's happening:

1. Is the jar a valid jar file?  Does it's internal folder structure 
mirror the package structure?
2. Are there any permission problems that might prevent tomcat from 
reading the jar file?
3. After placing this jar file in WEB-INF/lib, did you restart the 
webapp from the manager or tomcat itself?
4. Is there any indication in the logs that tomcat is having an issue 
loading your 'foo.jar' file?
5. Is foo.jar really in WEB-INF/lib or did you do some symlink/shortcut 
scheme that tomcat might not follow?

--David


Darren Hall wrote:

>I wanted to confirm that jar files in the WEB-INF/lib  directory were
>included in the classpath for my application. In reading through the online
>documentation for Tomcat I found the following:
>
>"WebappX - A class loader is created for each web application that is
>deployed in a single Tomcat 5 instance. All unpacked classes and resources
>in the /WEB-INF/classes directory of your web application archive, plus
>classes and resources in JAR files under the /WEB-INF/lib directory of your
>web application archive, are made visible to the containing web application,
>but to no others."
>
>I am doing exactly this. My jar file (foo.jar) is in the
>webapps/abc/WEB-INF/lib directory for my 'abc' application. However, in the
>Catalina log file, when Tomcat starts, I get a "ClassNotFound -
>com.abc.framework.ControlServlet" error. Why can my servlet not be found if
>it resides in the jar under the WEB-INF/lib directory???
>
>Any help would be appreciated.
>
>Thanks,
>
>Darren
>
>
>
>-----Original Message-----
>From: Darren Hall [mailto:dhall@utrs.com] 
>Sent: Monday, July 24, 2006 1:59 PM
>To: 'Tomcat Users List'
>Subject: Setting the classpath for my application
>
>Is the fact that I'm receiving a ClassNotFound error from Tomcat's
>ClassLoader for a class that I've created indicative of a bad classpath?
>Are jar files stored in WEB-INF/lib automatically included in Tomcat's
>classpath for my application?
>
>If so, how do I set the classpath for my application in Tomcat?
>
>Thanks,
>
>Darren
>
>-----Original Message-----
>From: Darren Hall [mailto:dhall@utrs.com] 
>Sent: Monday, July 24, 2006 11:19 AM
>To: 'Tomcat Users List'
>Subject: ClassNotFound - Is WEB-INF/lib in my app's classpath?
>
>Ok, I've deployed my application in Tomcat 5.5 on Solaris using the war
>deploy feature in the manager.
>
>The application (lets call it 'foo') shows up in the manager as '/foo', so I
>know that it deploys. When I look in catalina.log, I see a ClassNotFound
>exception, alerting me that the ClassLoader wasn't able to find my
>ControllerServlet class. Here is the error from Catalina.log:
>
>2006-07-24 09:38:46,987 DEBUG
>org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] -
>Sending application start events
>
>2006-07-24 09:38:46,987 DEBUG
>org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] -
>Starting filters
>
>2006-07-24 09:38:47,002 INFO
>org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] -
>Marking servlet controller as unavailable
>
>2006-07-24 09:38:47,002 ERROR
>org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] - Error
>loading WebappClassLoader
>  delegate: false
>  repositories:
>    /WEB-INF/classes/
>----------> Parent Classloader:
>org.apache.catalina.loader.StandardClassLoader@1c92535
> com.abc.framework.controller.ControlServlet
>java.lang.ClassNotFoundException:
>com.abc.framework.controller.ControlServlet
>
>My ControlServlet class is located in this jar file
>webapps/foo/WEB-INF/lib/abc.jar in the package
>com.abc.framework.controller;.
>
>Are the jar files in WEB-INF/lib included in my application's classpath by
>default? Do I need to make a classpath change somewhere? Is the fact that
>WEB-INF/lib not show up in the repositories listing above meaningful?
>
>Why can't Tomcat's classloader find my ControlServlet class?
>
>Thanks,
>
>Darren
>
>
>---------------------------------------------------------------------
>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
>
>
>
>---------------------------------------------------------------------
>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: Setting the classpath for my application

Posted by Darren Hall <dh...@utrs.com>.
*sigh*

Apologies to the group. There is no need to respond to my posts.
I knew it had to be something easy that I was overlooking.

The problem was caused by the fact that my build.xml was not including my
compiled code in the jar file I was creating, so my jar was essentially
empty, and thus the controller servet was not deployed with the war file.

Darren


-----Original Message-----
From: Darren Hall [mailto:dhall@utrs.com] 
Sent: Monday, July 24, 2006 3:07 PM
To: 'Tomcat Users List'
Subject: RE: Setting the classpath for my application

I wanted to confirm that jar files in the WEB-INF/lib  directory were
included in the classpath for my application. In reading through the online
documentation for Tomcat I found the following:

"WebappX - A class loader is created for each web application that is
deployed in a single Tomcat 5 instance. All unpacked classes and resources
in the /WEB-INF/classes directory of your web application archive, plus
classes and resources in JAR files under the /WEB-INF/lib directory of your
web application archive, are made visible to the containing web application,
but to no others."

I am doing exactly this. My jar file (foo.jar) is in the
webapps/abc/WEB-INF/lib directory for my 'abc' application. However, in the
Catalina log file, when Tomcat starts, I get a "ClassNotFound -
com.abc.framework.ControlServlet" error. Why can my servlet not be found if
it resides in the jar under the WEB-INF/lib directory???

Any help would be appreciated.

Thanks,

Darren



-----Original Message-----
From: Darren Hall [mailto:dhall@utrs.com] 
Sent: Monday, July 24, 2006 1:59 PM
To: 'Tomcat Users List'
Subject: Setting the classpath for my application

Is the fact that I'm receiving a ClassNotFound error from Tomcat's
ClassLoader for a class that I've created indicative of a bad classpath?
Are jar files stored in WEB-INF/lib automatically included in Tomcat's
classpath for my application?

If so, how do I set the classpath for my application in Tomcat?

Thanks,

Darren

-----Original Message-----
From: Darren Hall [mailto:dhall@utrs.com] 
Sent: Monday, July 24, 2006 11:19 AM
To: 'Tomcat Users List'
Subject: ClassNotFound - Is WEB-INF/lib in my app's classpath?

Ok, I've deployed my application in Tomcat 5.5 on Solaris using the war
deploy feature in the manager.

The application (lets call it 'foo') shows up in the manager as '/foo', so I
know that it deploys. When I look in catalina.log, I see a ClassNotFound
exception, alerting me that the ClassLoader wasn't able to find my
ControllerServlet class. Here is the error from Catalina.log:

2006-07-24 09:38:46,987 DEBUG
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] -
Sending application start events

2006-07-24 09:38:46,987 DEBUG
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] -
Starting filters

2006-07-24 09:38:47,002 INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] -
Marking servlet controller as unavailable

2006-07-24 09:38:47,002 ERROR
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] - Error
loading WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@1c92535
 com.abc.framework.controller.ControlServlet
java.lang.ClassNotFoundException:
com.abc.framework.controller.ControlServlet

My ControlServlet class is located in this jar file
webapps/foo/WEB-INF/lib/abc.jar in the package
com.abc.framework.controller;.

Are the jar files in WEB-INF/lib included in my application's classpath by
default? Do I need to make a classpath change somewhere? Is the fact that
WEB-INF/lib not show up in the repositories listing above meaningful?

Why can't Tomcat's classloader find my ControlServlet class?

Thanks,

Darren


---------------------------------------------------------------------
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



---------------------------------------------------------------------
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: Setting the classpath for my application

Posted by Darren Hall <dh...@utrs.com>.
I wanted to confirm that jar files in the WEB-INF/lib  directory were
included in the classpath for my application. In reading through the online
documentation for Tomcat I found the following:

"WebappX - A class loader is created for each web application that is
deployed in a single Tomcat 5 instance. All unpacked classes and resources
in the /WEB-INF/classes directory of your web application archive, plus
classes and resources in JAR files under the /WEB-INF/lib directory of your
web application archive, are made visible to the containing web application,
but to no others."

I am doing exactly this. My jar file (foo.jar) is in the
webapps/abc/WEB-INF/lib directory for my 'abc' application. However, in the
Catalina log file, when Tomcat starts, I get a "ClassNotFound -
com.abc.framework.ControlServlet" error. Why can my servlet not be found if
it resides in the jar under the WEB-INF/lib directory???

Any help would be appreciated.

Thanks,

Darren



-----Original Message-----
From: Darren Hall [mailto:dhall@utrs.com] 
Sent: Monday, July 24, 2006 1:59 PM
To: 'Tomcat Users List'
Subject: Setting the classpath for my application

Is the fact that I'm receiving a ClassNotFound error from Tomcat's
ClassLoader for a class that I've created indicative of a bad classpath?
Are jar files stored in WEB-INF/lib automatically included in Tomcat's
classpath for my application?

If so, how do I set the classpath for my application in Tomcat?

Thanks,

Darren

-----Original Message-----
From: Darren Hall [mailto:dhall@utrs.com] 
Sent: Monday, July 24, 2006 11:19 AM
To: 'Tomcat Users List'
Subject: ClassNotFound - Is WEB-INF/lib in my app's classpath?

Ok, I've deployed my application in Tomcat 5.5 on Solaris using the war
deploy feature in the manager.

The application (lets call it 'foo') shows up in the manager as '/foo', so I
know that it deploys. When I look in catalina.log, I see a ClassNotFound
exception, alerting me that the ClassLoader wasn't able to find my
ControllerServlet class. Here is the error from Catalina.log:

2006-07-24 09:38:46,987 DEBUG
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] -
Sending application start events

2006-07-24 09:38:46,987 DEBUG
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] -
Starting filters

2006-07-24 09:38:47,002 INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] -
Marking servlet controller as unavailable

2006-07-24 09:38:47,002 ERROR
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] - Error
loading WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@1c92535
 com.abc.framework.controller.ControlServlet
java.lang.ClassNotFoundException:
com.abc.framework.controller.ControlServlet

My ControlServlet class is located in this jar file
webapps/foo/WEB-INF/lib/abc.jar in the package
com.abc.framework.controller;.

Are the jar files in WEB-INF/lib included in my application's classpath by
default? Do I need to make a classpath change somewhere? Is the fact that
WEB-INF/lib not show up in the repositories listing above meaningful?

Why can't Tomcat's classloader find my ControlServlet class?

Thanks,

Darren


---------------------------------------------------------------------
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



---------------------------------------------------------------------
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


Setting the classpath for my application

Posted by Darren Hall <dh...@utrs.com>.
Is the fact that I'm receiving a ClassNotFound error from Tomcat's
ClassLoader for a class that I've created indicative of a bad classpath?
Are jar files stored in WEB-INF/lib automatically included in Tomcat's
classpath for my application?

If so, how do I set the classpath for my application in Tomcat?

Thanks,

Darren

-----Original Message-----
From: Darren Hall [mailto:dhall@utrs.com] 
Sent: Monday, July 24, 2006 11:19 AM
To: 'Tomcat Users List'
Subject: ClassNotFound - Is WEB-INF/lib in my app's classpath?

Ok, I've deployed my application in Tomcat 5.5 on Solaris using the war
deploy feature in the manager.

The application (lets call it 'foo') shows up in the manager as '/foo', so I
know that it deploys. When I look in catalina.log, I see a ClassNotFound
exception, alerting me that the ClassLoader wasn't able to find my
ControllerServlet class. Here is the error from Catalina.log:

2006-07-24 09:38:46,987 DEBUG
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] -
Sending application start events

2006-07-24 09:38:46,987 DEBUG
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] -
Starting filters

2006-07-24 09:38:47,002 INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] -
Marking servlet controller as unavailable

2006-07-24 09:38:47,002 ERROR
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] - Error
loading WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@1c92535
 com.abc.framework.controller.ControlServlet
java.lang.ClassNotFoundException:
com.abc.framework.controller.ControlServlet

My ControlServlet class is located in this jar file
webapps/foo/WEB-INF/lib/abc.jar in the package
com.abc.framework.controller;.

Are the jar files in WEB-INF/lib included in my application's classpath by
default? Do I need to make a classpath change somewhere? Is the fact that
WEB-INF/lib not show up in the repositories listing above meaningful?

Why can't Tomcat's classloader find my ControlServlet class?

Thanks,

Darren


---------------------------------------------------------------------
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


ClassNotFound - Is WEB-INF/lib in my app's classpath?

Posted by Darren Hall <dh...@utrs.com>.
Ok, I've deployed my application in Tomcat 5.5 on Solaris using the war
deploy feature in the manager.

The application (lets call it 'foo') shows up in the manager as '/foo', so I
know that it deploys. When I look in catalina.log, I see a ClassNotFound
exception, alerting me that the ClassLoader wasn't able to find my
ControllerServlet class. Here is the error from Catalina.log:

2006-07-24 09:38:46,987 DEBUG
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] -
Sending application start events
2006-07-24 09:38:46,987 DEBUG
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] -
Starting filters
2006-07-24 09:38:47,002 INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] -
Marking servlet controller as unavailable
2006-07-24 09:38:47,002 ERROR
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] - Error
loading WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@1c92535
 com.abc.framework.controller.ControlServlet
java.lang.ClassNotFoundException:
com.abc.framework.controller.ControlServlet

My ControlServlet class is located in this jar file
webapps/foo/WEB-INF/lib/abc.jar in the package
com.abc.framework.controller;.

Are the jar files in WEB-INF/lib included in my application's classpath by
default? Do I need to make a classpath change somewhere? Is the fact that
WEB-INF/lib not show up in the repositories listing above meaningful?

Why can't Tomcat's classloader find my ControlServlet class?

Thanks,

Darren


---------------------------------------------------------------------
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: The requested resource is not available

Posted by Hassan Schroeder <ha...@gmail.com>.
On 7/19/06, Darren Hall <dh...@utrs.com> wrote:

> When I attempt to go to the above URL I get the error "The requested
> resource (/abc/abc) is not available."

I would simplify -- comment out your servlet in web.xml, put a proper
welcome file (e.g. index.jsp) in the context -- and  make sure that
there aren't other errors keeping your context from starting.

Then add back your servlet's url-mapping and watch your logs :-)

-- 
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: The requested resource is not available

Posted by Martin Gainty <mg...@hotmail.com>.
WebApp/MappedClassName..

so if you are referencing WebApp 'Foo' 
and inside web.xml your <servlet-mapping>
has the entry
                                       <servlet-name>/servlet/Bar</servlet-name>
the correct url would be
http://Server:PortName/Foo/servlet/Bar

Make sense??
Martin --
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.



----- Original Message ----- 
From: "Darren Hall" <dh...@utrs.com>
To: "'Tomcat Users List'" <us...@tomcat.apache.org>
Sent: Wednesday, July 19, 2006 1:57 PM
Subject: RE: The requested resource is not available


Here's something else I tried.
I thought that perhaps my mapping was set incorrectly such that when I tried
to go to http://localhost:8080/abc/abc the request was being picked up by my
servlet, but this does not seem to be the case.

When I attempt to go to the above URL I get the error "The requested
resource (/abc/abc) is not available."

What am I doing wrong here? I remember being able to configure Tomcat before
so that a give URL pattern would map to a corresponding servlet, but for
some reason, I'm unable to get it to work now.

Any help would be greatly appreciated.

Thanks,

Darren


-----Original Message-----
From: Darren Hall [mailto:dhall@utrs.com] 
Sent: Wednesday, July 19, 2006 9:03 AM
To: 'Tomcat Users List'
Cc: hassan.schroeder@gmail.com
Subject: RE: The requested resource is not available

Thanks for the response Hassan.

> But if the above url-pattern is in a Context with path '/abc', then you're
> telling it to give everything that looks like 
> 'http://localhost:8080/abc/abc'
> to your control servlet, which probably isn't what you want...  :-)

No, you are exactly right. This is *not* what I want. I want the servlet to
get everything from 'http://localhost:8080/abc'. Would you mind explaining
where I went wrong?

> The Context configuration would be helpful, though.

As for Context, I don't have any context information in my web.xml file (I
don't believe... at least I have no <Context> element present in the file).
What I posted before was nearly the entire web.xml. I can post the whole
file if you'd like.

Thanks,

Darren


---------------------------------------------------------------------
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: The requested resource is not available

Posted by Darren Hall <dh...@utrs.com>.
Here's something else I tried.
I thought that perhaps my mapping was set incorrectly such that when I tried
to go to http://localhost:8080/abc/abc the request was being picked up by my
servlet, but this does not seem to be the case.

When I attempt to go to the above URL I get the error "The requested
resource (/abc/abc) is not available."

What am I doing wrong here? I remember being able to configure Tomcat before
so that a give URL pattern would map to a corresponding servlet, but for
some reason, I'm unable to get it to work now.

Any help would be greatly appreciated.

Thanks,

Darren


-----Original Message-----
From: Darren Hall [mailto:dhall@utrs.com] 
Sent: Wednesday, July 19, 2006 9:03 AM
To: 'Tomcat Users List'
Cc: hassan.schroeder@gmail.com
Subject: RE: The requested resource is not available

Thanks for the response Hassan.

> But if the above url-pattern is in a Context with path '/abc', then you're
> telling it to give everything that looks like 
> 'http://localhost:8080/abc/abc'
> to your control servlet, which probably isn't what you want...  :-)

No, you are exactly right. This is *not* what I want. I want the servlet to
get everything from 'http://localhost:8080/abc'. Would you mind explaining
where I went wrong?

> The Context configuration would be helpful, though.

As for Context, I don't have any context information in my web.xml file (I
don't believe... at least I have no <Context> element present in the file).
What I posted before was nearly the entire web.xml. I can post the whole
file if you'd like.

Thanks,

Darren


---------------------------------------------------------------------
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: The requested resource is not available

Posted by Darren Hall <dh...@utrs.com>.
Thanks for the response Hassan.

> But if the above url-pattern is in a Context with path '/abc', then you're
> telling it to give everything that looks like 
> 'http://localhost:8080/abc/abc'
> to your control servlet, which probably isn't what you want...  :-)

No, you are exactly right. This is *not* what I want. I want the servlet to
get everything from 'http://localhost:8080/abc'. Would you mind explaining
where I went wrong?

> The Context configuration would be helpful, though.

As for Context, I don't have any context information in my web.xml file (I
don't believe... at least I have no <Context> element present in the file).
What I posted before was nearly the entire web.xml. I can post the whole
file if you'd like.

Thanks,

Darren


---------------------------------------------------------------------
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: The requested resource is not available

Posted by Hassan Schroeder <ha...@gmail.com>.
On 7/18/06, Darren Hall <dh...@utrs.com> wrote:

> <!-- Controller Servlet Configuration -->
> <servlet>
> <servlet-name>controller</servlet-name>
> <servlet-class>com.abc.framework.controller.ControlServlet</servlet-class>
> </servlet>
>
> <!-- Controller Servlet Mapping -->
> <servlet-mapping>
> <servlet-name>controller</servlet-name>
> <url-pattern>/abc</url-pattern>
> </servlet-mapping>

> Also I've tried hitting the servlet directly by pointing my browser
> to http://localhost:8080/abc and I get the same "The requested resource
> (/abc) is not available" error.

Since it doesn't work with Tomcat standalone, you Apache conf stuff
is irrelevant. The Context configuration would be helpful, though.

But if the above url-pattern is in a Context with path '/abc', then you're
telling it to give everything that looks like 'http://localhost:8080/abc/abc'
to your control servlet, which probably isn't what you want...  :-)

Or there's something else broken in your Context, and that should be
indicated in your logs at startup.

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