tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boniakowski,Jeb" <>
Subject RE: dumb question regarding servlets in packages running in tomca t.
Date Tue, 01 Aug 2000 21:32:24 GMT
I think that fixed it!  Thanks.

I still don't really understand why, though, and this is why I'm posting
again.  Maybe if anyone that works on tomcat is reading this, they could
chime in, or just someone who knows more than I do.

I went through everything, did a lot of tests, made a whole new "hello
world" webapp (though in a package) and it all worked fine when I created it
with "" as my package.  So I went through the real stuff and
changed everything from "COM.nntllc.*" to "com.nntllc.*".  I don't know if I
inadvertently moved something else or something, but it works now.  The
behavior before was not totally deterministic.  I'd get different errors
from different computers and ways of submitting.  However, now it works
under all circumstances.

Why does this matter?  I have upcase in the classnames.  Does it only amtter
with dirs?

Let's say win98 consistently handles case in a case-insensitive, though
case-preserving manner.  Why would this happen?  COM=com in that mode.  If
it's case sensitive, than it should still work fine.  I was always calling
it "COM".  No inconsistencies.  

I was, however, using cygwin.  Does this diddle the case anywhere?

Somewhere in the chain of all my stuff, the case must have been diddled and
sensitively compared to other case.

Can anyone elaborate on what was going on here so I (maybe we) don't get
into some sort of voodoo "never use uppercase letters on windows" sort of
mood?  I hate that.

In case you haven't guessed, this is my first real windows project.  Arg.
You have to reboot a lot.  I guess that's good for my hands.


> -----Original Message-----
> From: Sheldon Wosnick []
> Sent: Tuesday, August 01, 2000 3:51 PM
> To:
> Subject: Re: dumb question regarding servlets in packages running in
> tomcat.
> 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" <>
> >Reply-To:
> >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:
> >TDLogin)
> >	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):
> >
> ><web-app>
> >     <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>
> >
> ></web-app>
> >
> >And here is the directory listing for the dir in question:
> >$ls webapps/nnt/WEB-INF/classes/COM/nntllc/servlet/
> >TDLogin.class
> >
> >Now, I know that tomcat is finding the class via the url:
> >http://localhost:8080/nnt/servlet/TDLogin
> >
> >because if I rm the class file, I get a 404 error from that 
> url.  So in 
> >some
> >way, it seems to me that tomcat is saying "doot doo doo 
> here's a request 
> >for
> >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
> >classdef?"
> >
> >I don't really understand what would cause a 
> NoClassDefFoundError in any
> >case.  According to my "Java Programming Language, Second 
> Edition" by 
> >Arnold
> >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 
> >the
> >package stuff, wouldn't it say something like "TDLogin 
> should be in a file
> >/COM..."?
> >
> >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.
> >
> >jeb.
> >
> >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