Or you con put them on %tomcat_home%/lib

[]s
Leandro

----- Original Message -----
From: "Kendal L. Montgomery" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, December 19, 2001 10:25 PM
Subject: RE: Imported classes run, but not under Tomcat


> Put your compile class file in
> c:\progra~1\tomcat4\webapps\sqaa\web-inf\classes\classes\test.java.
>
> Since you used classes as your package name you have to put it in the
> classes package.
>
> The WEB-INF\classes directory is a "root" or just the beginning of where
> Tomcat looks for standalone classes (not jarred).
>
> Hope this helps.
>
>
> Kendal L. Montgomery
> ...the comPuter Wizard...
> [EMAIL PROTECTED]
> _-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_
> Click here for Qwest's 5 cent State-to-State flat rate calling plan, plus
> get your own 800 number at no charge!
> http://qwesteferral.com/r.jsp?a=RyYO5xpYanlfVU541Lz2HA$$
> _-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_
>
> -----Original Message-----
> From: Gilmore, Phil [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 19, 2001 6:48 PM
> To: Tomcat User Mailing List (E-mail)
> Subject: Imported classes run, but not under Tomcat
>
> I have a class method that works under a container class,
> but Tomcat returns NoClassDefFound on the imported class method when it's
> called from a servlet (which is nearly identical to the container class)
> inside Tomcat.  I searched the archive before subscribing here, but
> couldn't find any questions on this since Dec 1.
> Sorry if this message is lengthy but here goes...
>
> I have a public class (thelper.java) with class method ssiServe.
> This method reads a file, replaces keys with new values and outputs the
> contents to System.err.  I have a test.java that calls the
> thelper.ssiserve() class method and it works well.
>
> I now call thelper from a simple servlet (getimage.java), derived
> from test.java, changing the thelper class's output object from
> System.err to a the servlet's PrintWriter object.
> When I run it from my browser, I get a two stack traces
> (with http error 500, reported by Tomcat).
>
> The first line of the first (labeled "exception") is:
> javax.servlet.ServletException: Servlet execution threw an exception
>
> The first line of the second (labeled "root cause") is:
> java.lang.NoClassDefFoundError: classes/thelper
>
> So it would seem to me that the thelper class cannot be "seen" by
> tomcat, though it is seen in the JVM otherwise.  I've tried
> everything I know how, though I'm very new to Java and JSP.  I can
> incorporate this class method into the calling class and solve the
> problem, but I wrote it this way because the method will be used by
> quite a few different servlets (>10), and I need it to be centralized
> for obvious reasons.
>
> My J2SE is installed in c:\javakit and my J2EE is in c:\javaee.
>
> classpath =
> c:\;d:\;c:\javakit\src.jar;c:\javakit\lib\tools.jar;
> c:\javaee\lib\j2ee.jar;c:\progra~1\tomcat4\webapps\sqaa\WEB-INF;
>
> java_home =
> c:\javakit
>
> Tomcat 4.0.1 is installed in c:\progra~1\tomcat4.
> Java -version:
>   java version "1.3.1_01"
>   Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
>   Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)
>
>
> This obviously seems like a problem with my classpath or with pack names
and
> class locations, but it makes no sense to me that it would work outside of
> Tomcat.   I deduce that it's a problem with my tomcat configuration (it
> doesn't know to look for it) or there's some cardinal rule that I've
> overlooked.  Any other ideas?  I've been up and down the tomcat and apache
> docs, finding exactly the same information on configuration everywhere on
> the web and in a few books I have (and in the config file comments!).
> They're all the same, and my standalone servlets work, so I'm pretty sure
I
> have those instructions down alright.
>
> Below are my sources and their locations.  If you see any mistakes, bear
in
> mind that I've moved these things from heck to breakfast, always with the
> same result no matter what package, path or name I give this import.  It's
> been in $tomcat_home\webapps\sqaa..classes\,
> $tomcat_home\webapps\sqaa\WEB-INF\libs\, c:\, c:\include, etc.  Always the
> same error, with the NoClassDefFoundError reporting the current class I'm
> trying to import.
>
> (Irrelevant code omitted:)
>
>
> -----------------------------------------------
> c:\progra~1\tomcat4\webapps\sqaa\web-inf\classes\test.java:
> -----------------------------------------------
> //package classes       /* I've tried w/ and w/o package spec,
>                                 though examples don't use one.
>                                 This class works either way. */
> import java.io.*;
> import java.util.*;
> import classes.*;
>
> public class test {
>         public test(){
>         }
>         public static void main(String args[]) {
>             Vector ssi = new Vector();
>             ssi.add("<!--SSI:FILENAME-->=c:/sample.tif");
>             thelper.ssiServe("c:/html/test.html",ssi);
>         }
> }
>
> -----------------------------------------------
> c:\progra~1\tomcat4\webapps\sqaa\web-inf\classes\getimage.java:
> -----------------------------------------------
> //package classes       /* I've tried w and w/o package spec,
>                                 though all examples don't use one. */
> import java.io.*;
> import java.util.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
> import classes.*;
>
> public class getimage extends HttpServlet {
>
>     public void doGet(HttpServletRequest request, HttpServletResponse
> response)
>     throws IOException, ServletException
>     {
>         PrintWriter out = response.getWriter();
>
>         Vector ssi = new Vector();
>         ssi.add("<!--SSI:FILENAME-->=c:/sample.tif");
>         thelper.ssiServe(out,"c:/html/test.html",ssi);
>     }
> }
>
> -----------------------------------------------
> c:\progra~1\tomcat4\webapps\sqaa\web-inf\classes\thelper.java:
> -----------------------------------------------
> package classes;
>
> import java.io.*;
> import java.util.*;
>
> public class thelper {
>
>     public thelper() {
>     }
>     /* When being called by getimage.java, I use this: */
>     public static void ssiServe(PrintWriter aout, String fname, Vector
SSI)
> {
>     }
>
>     /* When being called by test.java, I use this: */
>     public static void ssiServe(/*PrintWriter aout,*/ String fname, Vector
> SSI) {
>     }
> }
>
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>
>
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to