Discussion:
Tomcat classpath?
David Thielen
2002-06-27 16:21:13 UTC
Permalink
Hi;

Where do I place jar files or where in the tomcat configuration do I tell it of a jar file to use with my jsp?

Also, can I just do .class files in a directory or must it be a jar file? (And if so, how do I set that?)

thanks - dave
Milt Epstein
2002-06-27 16:31:15 UTC
Permalink
Post by David Thielen
Hi;
Where do I place jar files or where in the tomcat configuration do I
tell it of a jar file to use with my jsp?
Also, can I just do .class files in a directory or must it be a jar
file? (And if so, how do I set that?)
If you're talking about context specific stuff, jars go in
...<context>/WEB-INF/lib and classes in
...<context>/WEB-INF/classes (don't forget to include the complete
package hierarchy in the classes subdirectory).

You don't set the classpath for this stuff, it all works automatically.

Milt Epstein
Research Programmer
Systems and Technology Services (STS)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
***@uiuc.edu
David Thielen
2002-06-27 16:52:03 UTC
Permalink
What's the context when I have:

<Context path="/" docBase="c:\Inetpub\wwwroot" debug="0" privileged="true"
/>

I tried ROOT, nothing, "_" - none of them worked.

thanks - dave


----- Original Message -----
From: "Milt Epstein" <***@uiuc.edu>
To: "Tomcat Users List" <tomcat-***@jakarta.apache.org>
Sent: Thursday, June 27, 2002 10:31 AM
Subject: Re: Tomcat classpath?
Post by Milt Epstein
Post by David Thielen
Hi;
Where do I place jar files or where in the tomcat configuration do I
tell it of a jar file to use with my jsp?
Also, can I just do .class files in a directory or must it be a jar
file? (And if so, how do I set that?)
If you're talking about context specific stuff, jars go in
...<context>/WEB-INF/lib and classes in
...<context>/WEB-INF/classes (don't forget to include the complete
package hierarchy in the classes subdirectory).
You don't set the classpath for this stuff, it all works automatically.
Milt Epstein
Research Programmer
Systems and Technology Services (STS)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
--
<mailto:tomcat-user-***@jakarta.apache.org>
Milt Epstein
2002-06-27 17:04:15 UTC
Permalink
Post by David Thielen
<Context path="/" docBase="c:\Inetpub\wwwroot" debug="0" privileged="true"
/>
I tried ROOT, nothing, "_" - none of them worked.
What do you mean when you say you "tried ROOT, ...", where did you try
it? And when you say they didn't work, what do you mean? It didn't
find the servlets/jsps, or it didn't find the classes/jars? What URL
did you try? Anything relevant in the logs?

I'd *think* that the path attribute above is just to tell Tomcat how
to match URLs to resources (e.g. servlets/jsps).

And I'd think that you can have WEB-INF under c:\Inetpub\wwwroot (and
lib and classes under WEB-INF).
Post by David Thielen
----- Original Message -----
Sent: Thursday, June 27, 2002 10:31 AM
Subject: Re: Tomcat classpath?
Post by Milt Epstein
Post by David Thielen
Hi;
Where do I place jar files or where in the tomcat configuration do I
tell it of a jar file to use with my jsp?
Also, can I just do .class files in a directory or must it be a jar
file? (And if so, how do I set that?)
If you're talking about context specific stuff, jars go in
...<context>/WEB-INF/lib and classes in
...<context>/WEB-INF/classes (don't forget to include the complete
package hierarchy in the classes subdirectory).
You don't set the classpath for this stuff, it all works automatically.
Milt Epstein
Research Programmer
Systems and Technology Services (STS)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
***@uiuc.edu
David Thielen
2002-06-27 17:17:04 UTC
Permalink
I tried CATALINA_HOME\webapps\ROOT\WEB-INF\classes\net\windward\*.class (my
package is net.windward)
I tried CATALINA_HOME\webapps\WEB-INF\classes\net\windward\*.class
I tried CATALINA_HOME\webapps\_\WEB-INF\classes\net\windward\*.class

I also added:
<Context path="/apps" docBase="apps" debug="0" privileged="true" />

And then created
CATALINA_HOME\webapps\apps\*.jsp
and
CATALINA_HOME\webapps\apps\WEB-INF\classes\net\windward\*.class

In all these cases I can get ot the .jsp file but the jsp file cannot find
the java .class files.

I am doing no web.xml file because I have no servlets or anything else like
that. Just jsp files and classes for them to access.

????? - thanks - dave


----- Original Message -----
From: "Milt Epstein" <***@uiuc.edu>
To: "Tomcat Users List" <tomcat-***@jakarta.apache.org>
Sent: Thursday, June 27, 2002 11:04 AM
Subject: Re: Tomcat classpath?
Post by Milt Epstein
Post by David Thielen
<Context path="/" docBase="c:\Inetpub\wwwroot" debug="0"
privileged="true"
Post by Milt Epstein
Post by David Thielen
/>
I tried ROOT, nothing, "_" - none of them worked.
What do you mean when you say you "tried ROOT, ...", where did you try
it? And when you say they didn't work, what do you mean? It didn't
find the servlets/jsps, or it didn't find the classes/jars? What URL
did you try? Anything relevant in the logs?
I'd *think* that the path attribute above is just to tell Tomcat how
to match URLs to resources (e.g. servlets/jsps).
And I'd think that you can have WEB-INF under c:\Inetpub\wwwroot (and
lib and classes under WEB-INF).
Post by David Thielen
----- Original Message -----
Sent: Thursday, June 27, 2002 10:31 AM
Subject: Re: Tomcat classpath?
Post by Milt Epstein
Post by David Thielen
Hi;
Where do I place jar files or where in the tomcat configuration do I
tell it of a jar file to use with my jsp?
Also, can I just do .class files in a directory or must it be a jar
file? (And if so, how do I set that?)
If you're talking about context specific stuff, jars go in
...<context>/WEB-INF/lib and classes in
...<context>/WEB-INF/classes (don't forget to include the complete
package hierarchy in the classes subdirectory).
You don't set the classpath for this stuff, it all works
automatically.
Post by Milt Epstein
Milt Epstein
Research Programmer
Systems and Technology Services (STS)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
--
<mailto:tomcat-user-***@jakarta.apache.org>
Milt Epstein
2002-06-27 17:37:17 UTC
Permalink
Post by David Thielen
I tried CATALINA_HOME\webapps\ROOT\WEB-INF\classes\net\windward\*.class (my
package is net.windward)
I tried CATALINA_HOME\webapps\WEB-INF\classes\net\windward\*.class
I tried CATALINA_HOME\webapps\_\WEB-INF\classes\net\windward\*.class
Did you try using the Context you have in the previous message, i.e.

<Context path="/" docBase="c:\Inetpub\wwwroot" debug="0"
privileged="true"/>

*and*

putting all the WEB-INF stuff below c:\Inetpub\wwwroot?

Also, I wonder if the above context path should be "", that's what
Tomcat 4.0.X has in the server.xml it comes with to point to ROOT.
Post by David Thielen
<Context path="/apps" docBase="apps" debug="0" privileged="true" />
And then created
CATALINA_HOME\webapps\apps\*.jsp
and
CATALINA_HOME\webapps\apps\WEB-INF\classes\net\windward\*.class
I don't see anything wrong with this, it looks like it should work.
This all makes me wonder if something else is wrong. How is the jsp
looking for the class file? For example, is it using the full package
name?
Post by David Thielen
In all these cases I can get ot the .jsp file but the jsp file
cannot find the java .class files.
I am doing no web.xml file because I have no servlets or anything
else like that. Just jsp files and classes for them to access.
I think that should be OK, and if it's finding the servlets/jsps OK,
that should indicate it's OK.
Post by David Thielen
----- Original Message -----
Sent: Thursday, June 27, 2002 11:04 AM
Subject: Re: Tomcat classpath?
Post by Milt Epstein
Post by David Thielen
<Context path="/" docBase="c:\Inetpub\wwwroot" debug="0"
privileged="true"/>
I tried ROOT, nothing, "_" - none of them worked.
What do you mean when you say you "tried ROOT, ...", where did you try
it? And when you say they didn't work, what do you mean? It didn't
find the servlets/jsps, or it didn't find the classes/jars? What URL
did you try? Anything relevant in the logs?
I'd *think* that the path attribute above is just to tell Tomcat how
to match URLs to resources (e.g. servlets/jsps).
And I'd think that you can have WEB-INF under c:\Inetpub\wwwroot (and
lib and classes under WEB-INF).
Post by David Thielen
----- Original Message -----
Sent: Thursday, June 27, 2002 10:31 AM
Subject: Re: Tomcat classpath?
Post by Milt Epstein
Post by David Thielen
Hi;
Where do I place jar files or where in the tomcat configuration do I
tell it of a jar file to use with my jsp?
Also, can I just do .class files in a directory or must it be a jar
file? (And if so, how do I set that?)
If you're talking about context specific stuff, jars go in
...<context>/WEB-INF/lib and classes in
...<context>/WEB-INF/classes (don't forget to include the complete
package hierarchy in the classes subdirectory).
You don't set the classpath for this stuff, it all works
automatically.
Milt Epstein
Research Programmer
Systems and Technology Services (STS)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
***@uiuc.edu
David Thielen
2002-06-27 18:38:52 UTC
Permalink
I'm sticking with this example as it "should" work.

The url I put in is localhost/apps.10.jsp.

Here is a dir (screen dump) of the file:
Directory of C:\Program Files\Apache Tomcat 4.0\webapps\apps

02/16/2002 03:50p 727 10.jsp

So the file is there.

The error I get is:
C:\Program Files\Apache Tomcat
4.0\work\Standalone\localhost\apps\$10$jsp.java:3: Class net.windward.Cart
not found in import.
import net.windward.Cart;
^
1 error, 1 warning

Here is the dir (screen dump) of the file Cart.class
Directory of C:\Program Files\Apache Tomcat
4.0\webapps\apps\WEB-INF\classes\ne
t\windward

12/29/2001 01:11p 18,392 Cart.class
12/29/2001 01:10p 24,099 Cart.java

So any idea why it can't find it? I looked in the log files but couldn't
find any that listed a directory it was looking in.

thanks - dave

----- Original Message -----
...
Post by Milt Epstein
Post by David Thielen
<Context path="/apps" docBase="apps" debug="0" privileged="true" />
And then created
CATALINA_HOME\webapps\apps\*.jsp
and
CATALINA_HOME\webapps\apps\WEB-INF\classes\net\windward\*.class
I don't see anything wrong with this, it looks like it should work.
This all makes me wonder if something else is wrong. How is the jsp
looking for the class file? For example, is it using the full package
name?
Post by David Thielen
In all these cases I can get ot the .jsp file but the jsp file
cannot find the java .class files.
I am doing no web.xml file because I have no servlets or anything
else like that. Just jsp files and classes for them to access.
I think that should be OK, and if it's finding the servlets/jsps OK,
that should indicate it's OK.
Milt Epstein
2002-06-27 19:23:25 UTC
Permalink
Post by David Thielen
I'm sticking with this example as it "should" work.
The url I put in is localhost/apps.10.jsp.
I assume you mean localhost/apps/10.jsp.
Post by David Thielen
Directory of C:\Program Files\Apache Tomcat 4.0\webapps\apps
02/16/2002 03:50p 727 10.jsp
So the file is there.
C:\Program Files\Apache Tomcat
4.0\work\Standalone\localhost\apps\$10$jsp.java:3: Class net.windward.Cart
not found in import.
import net.windward.Cart;
^
1 error, 1 warning
FWIW, this is an error that has to do with compiling the JSP, not
executing it. I'm not sure whether how Tomcat finds the class when
compiling is any different from how it finds it for executing. I'd
think it wouldn't be, but I'm not sure.

Not sure I have any other suggestions to look into at this point. It
looks like everything is in the right place. Maybe it's the usual
missing something obvious problem.
Post by David Thielen
Here is the dir (screen dump) of the file Cart.class
Directory of C:\Program Files\Apache Tomcat
4.0\webapps\apps\WEB-INF\classes\ne
t\windward
12/29/2001 01:11p 18,392 Cart.class
12/29/2001 01:10p 24,099 Cart.java
So any idea why it can't find it? I looked in the log files but couldn't
find any that listed a directory it was looking in.
thanks - dave
----- Original Message -----
...
Post by Milt Epstein
Post by David Thielen
<Context path="/apps" docBase="apps" debug="0" privileged="true" />
And then created
CATALINA_HOME\webapps\apps\*.jsp
and
CATALINA_HOME\webapps\apps\WEB-INF\classes\net\windward\*.class
I don't see anything wrong with this, it looks like it should work.
This all makes me wonder if something else is wrong. How is the jsp
looking for the class file? For example, is it using the full package
name?
Post by David Thielen
In all these cases I can get ot the .jsp file but the jsp file
cannot find the java .class files.
I am doing no web.xml file because I have no servlets or anything
else like that. Just jsp files and classes for them to access.
I think that should be OK, and if it's finding the servlets/jsps OK,
that should indicate it's OK.
--
Milt Epstein
Research Programmer
Systems and Technology Services (STS)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
***@uiuc.edu

Loading...