tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sheldon Wosnick" <>
Subject Re: dumb question regarding servlets in packages running in tomcat.
Date Tue, 01 Aug 2000 15:51:23 GMT
Could the case be a problem in your package on Windows 98 -- that is, the 
package begins with COM not com? Would you get the same results in a 
directory created on 98 called "\com" and a package use a package name of 
"com.ntllc.servlet" because every step you describe seems correct and 
reasonable to me.

Can see why you'd be frustrated.

- Sheldon Wosnick

>From: "Boniakowski,Jeb" <>
>To: "''" <>
>Subject: dumb question regarding servlets in packages running in tomcat.
>Date: Tue, 1 Aug 2000 12:41:45 -0400
>Hi, this is a dumb question that's been frustrating me for embarassingly
>long.  If anyone knows of a more appropriate place for dumb questions
>(besides /dev/null, wiseguys) or has a pointer to the right docs to look in
>for this info, I will gladly accept those in lieu of direct help, though I
>must add that I've read all the FAQs, docs, and refs on the apache page and
>in the archives.
>I'm running tomcat standalone on a win98 box (gimme a break, it's at work).
>My problem is that when I try to use any servlets that are in packages, I
>get this error:
>java.lang.NoClassDefFoundError: COM/nntllc/servlet/TDLogin (wrong name:
>	at java.lang.ClassLoader.defineClass0(Native Method)
>	at java.lang.ClassLoader.defineClass(
>	at java.lang.ClassLoader.defineClass(
>And so on, up the call stack.
>Now, if I take that TDLogin.class file, and put it in WEB-INF/classes,
>comment out the package line, and change the entry in my web.xml file
>accordingly, I'm fine.  It works.
>Here is the package line:
>package COM.nntllc.servlet;
>Here is the relevant piece of the web.xml file (all that's snipped is the
>DTD ref and the <?xml...> bit):
>     <servlet>
>         <servlet-name>
>             TDLogin
>         </servlet-name>
>         <servlet-class>
>             COM.nntllc.servlet.TDLogin
>         </servlet-class>
>     </servlet>
>     <servlet-mapping>
>         <servlet-name>
>             TDLogin
>         </servlet-name>
>         <url-pattern>
>             /TDLogin
>         </url-pattern>
>     </servlet-mapping>
>And here is the directory listing for the dir in question:
>$ls webapps/nnt/WEB-INF/classes/COM/nntllc/servlet/
>Now, I know that tomcat is finding the class via the url:
>because if I rm the class file, I get a 404 error from that url.  So in 
>way, it seems to me that tomcat is saying "doot doo doo here's a request 
>something called /nnt/servlet/TDLogin, lemme check my server.xml for a
>context for that...yup, there it is, webapps/nnt doot doo doo now I need a
>web.xml so I know what the hell that is...okay, there it is, right in
>WEB-INF like it's supposed to be...well, it says here that TDLogin is a
>servlet, and I'm supposed to take all requests for /nnt/servlet/TDLogin and
>send them to that servlet, where does web.xml say that is?  Oh yeah, right
>here in WEB-INF/classes/COM/nntllc/servlet/TDLogin.class.  I can find that
>okay.  open it up, check the package, seems fin@#$@#$@$@#$where's my
>I don't really understand what would cause a NoClassDefFoundError in any
>case.  According to my "Java Programming Language, Second Edition" by 
>and Gosling (god bless him), that occurs when a class can not be found when
>it is needed.  But it is finding the class, at least to some extent, cause
>it breaks more when I rm the class.  So my guess is there's some kind of
>package/namespace/(?classpath?) issue at work here.  It finds the file,
>opens it, expecting to find some definition for the class.  I have this in
>the file:
>public class TDLogin extends HttpServlet {
>What more does it want from me?  Perhaps interestingly, it does the same
>thing if I leave TDLogin.class in COM/nntllc/servlet whether or not I have
>the package line at the top.
>I'd think it was a package-y issue, but I know it's finding the file (from
>above-mentioned 404 error) and if it was reading the file and not liking 
>package stuff, wouldn't it say something like "TDLogin should be in a file
>I realize this is probably the most annoying type of question possible and
>you probably get it all the time and the message is long, but I've been
>working on this since yesterday at like 4pm, and I'm really frustrated and
>dumb feeling now.  Any advice, even scornful advice, would be appreciated.
>PS - sorry my last message was in HTML.  I'm using outlook.  I'll avoid it
>in the future

Get Your Private, Free E-mail from MSN Hotmail at

View raw message