You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by ilene m <ey...@yahoo.com> on 2008/02/08 05:35:51 UTC

Fwd: can't get servlets to run

--- ilene m <ey...@yahoo.com> wrote:

> Date: Thu, 7 Feb 2008 19:50:18 -0800 (PST)
> From: ilene m <ey...@yahoo.com>
> Subject: can't get servlets to run
> To: users@tomcat.apache.org
> 
> Hi,
> 
> I cannot get servlets to run outside of the servlet
> examples link off of the main page.
> I'm getting the ole 404 The requested resource -
> servlet - is not available.
> 
> I have tried the 6.0.14 zip file and a
> "preconfigured
> 6.0.10 version of of the coreservlets.com site.
> 
> i've tried loading 6.0.14 twice.  Everything else
> runs
> but the servlets.  In the first iteration of 6.0.14
> i
> had html, jsp, php, php accessing mysql running
> happily.  Thought it might have been something i did
> to make php happy so i took a clean version but it
> didn't help.
> 
> When i loaded 6.0.14 i tried to run servlets by
> using
> the invoker servlet.  Uncommented the invoker
> servlet
> and it's mapping in web.xml and added
> privileged="true" to context.xml and threw a
> HelloWorld.class file into
> webapps\Root\WEB-INF\classes dir accessing via
> http:\\localhost:8080\servlet\HelloWorld.
> 
> I also tried my own app dir and a context fragment
> file.  
> Tried putting the context fragment file in 
> tomcat\conf\Catalina\localhost\myApp.xml,
> tomcat\conf\Catalina\localhost\myApp\myApp.xml and 
> tomcat\webapps\myApp\META-INF\context.xml.
> Tried changing up the docbase.
> 
> Tried raising the logging level to see if anything
> useful would pop out.  NADA
> 
> Wondering if I'm missing an environment var.
> 
> Any help would be GREATLY appreciated.
> 
> Thanks for your time.
> 
> 
> 
> 
> 
>      
>
____________________________________________________________________________________
> Never miss a thing.  Make Yahoo your home page. 
> http://www.yahoo.com/r/hs
> 



      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping

---------------------------------------------------------------------
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: Fwd: can't get servlets to run

Posted by David Smith <dn...@cornell.edu>.
Ahh... tomcat/servlet spec 101 questions.

Here's the scoop:

1. Don't enable the invoker servlet unless you have an unbelievably 
excellent reason for it.  If you are just starting to learn servlet 
technology, you are better off learning best practices up front.  Mess 
with the invoker after you have a firm grounding in the technology and 
understand the ramifications of using it.  To my knowledge, only the 
really old books and articles ever even mention the invoker servlet much 
less advocate enabling it.  That may be your clue to stop reading it and 
get something newer.

2. Your servlet class needs to be in a package.  That means you have 
'package com.mycomany.myproject ;' at the top of your java source code 
and you place the class itself in 
WEB-INF/classes/com/mycompany/myproject of your webapp.  It can also be 
jarred and the .jar file placed in WEB-INF/lib but since you are 
learning, this isn't necessary.

3. Write a web.xml file with a proper servlet mapping in it.  There are 
a lot of resources out on the web describing this including the most 
excellent servlet specification which should become your best buddy.  I 
believe David Brown posted a link to it.  If you are relying on a book, 
make sure it covers at minimum servlet spec 2.4, preferably servlet spec 
2.5 and tomcat 6 since that's what you are working with. 

4. The second two places you put the context fragment work -- just use 
only one or the other to avoid confusion.  Also given where you are 
storing your webapp, the docbase and path attributes are really not 
necessary.  The docBase will be picked up automagically and the path 
will be named after the context fragment file in conf/Catalina/localhost 
or your webapp's docBase.

5. If you are still having trouble, the relevant parts of your setup 
will go miles towards helping solve your problems.  In most cases, that 
amounts to your context xml fragment, web.xml file and folder layout of 
your webapp.

--David

ilene m wrote:
> --- ilene m <ey...@yahoo.com> wrote:
>
>   
>> Date: Thu, 7 Feb 2008 19:50:18 -0800 (PST)
>> From: ilene m <ey...@yahoo.com>
>> Subject: can't get servlets to run
>> To: users@tomcat.apache.org
>>
>> Hi,
>>
>> I cannot get servlets to run outside of the servlet
>> examples link off of the main page.
>> I'm getting the ole 404 The requested resource -
>> servlet - is not available.
>>
>> I have tried the 6.0.14 zip file and a
>> "preconfigured
>> 6.0.10 version of of the coreservlets.com site.
>>
>> i've tried loading 6.0.14 twice.  Everything else
>> runs
>> but the servlets.  In the first iteration of 6.0.14
>> i
>> had html, jsp, php, php accessing mysql running
>> happily.  Thought it might have been something i did
>> to make php happy so i took a clean version but it
>> didn't help.
>>
>> When i loaded 6.0.14 i tried to run servlets by
>> using
>> the invoker servlet.  Uncommented the invoker
>> servlet
>> and it's mapping in web.xml and added
>> privileged="true" to context.xml and threw a
>> HelloWorld.class file into
>> webapps\Root\WEB-INF\classes dir accessing via
>> http:\\localhost:8080\servlet\HelloWorld.
>>
>> I also tried my own app dir and a context fragment
>> file.  
>> Tried putting the context fragment file in 
>> tomcat\conf\Catalina\localhost\myApp.xml,
>> tomcat\conf\Catalina\localhost\myApp\myApp.xml and 
>> tomcat\webapps\myApp\META-INF\context.xml.
>> Tried changing up the docbase.
>>
>> Tried raising the logging level to see if anything
>> useful would pop out.  NADA
>>
>> Wondering if I'm missing an environment var.
>>
>> Any help would be GREATLY appreciated.
>>
>> Thanks for your time.
>>
>>
>>
>>
>>
>>      
>>
>>     
> ____________________________________________________________________________________
>   
>> Never miss a thing.  Make Yahoo your home page. 
>> http://www.yahoo.com/r/hs
>>
>>     
>
>
>
>       ____________________________________________________________________________________
> Looking for last minute shopping deals?  
> Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
>
> ---------------------------------------------------------------------
> 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: Fwd: can't get servlets to run

Posted by David Brown <da...@davidwbrown.name>.
Hello ilene, in fear of retribution I must give you the standard:

http://jcp.org/aboutJava/communityprocess/mrel/jsr154/index2.html

Moreover, you might want to learn and understand the web application deployment file system hierarchy as it exists under the Tomcat installation. The TC file system is fairly much the same regardless of platform. This being said I would like to point out that in the future to get expert guru Tomcat help you might want to clarify your issues in a bulleted or tabulated form. This should included log file snippets from say: server.log. Java Exceptions are very informative combined with other pieces of information. Itemize or information stepwise such that busy people can follow easier. You know what you are doing but they don't. Send email that is painfully obvious that you have done your homework and somebody will help. HTH.


ilene m wrote ..
> 
> --- ilene m <ey...@yahoo.com> wrote:
> 
> > Date: Thu, 7 Feb 2008 19:50:18 -0800 (PST)
> > From: ilene m <ey...@yahoo.com>
> > Subject: can't get servlets to run
> > To: users@tomcat.apache.org
> > 
> > Hi,
> > 
> > I cannot get servlets to run outside of the servlet
> > examples link off of the main page.
> > I'm getting the ole 404 The requested resource -
> > servlet - is not available.
> > 
> > I have tried the 6.0.14 zip file and a
> > "preconfigured
> > 6.0.10 version of of the coreservlets.com site.
> > 
> > i've tried loading 6.0.14 twice.  Everything else
> > runs
> > but the servlets.  In the first iteration of 6.0.14
> > i
> > had html, jsp, php, php accessing mysql running
> > happily.  Thought it might have been something i did
> > to make php happy so i took a clean version but it
> > didn't help.
> > 
> > When i loaded 6.0.14 i tried to run servlets by
> > using
> > the invoker servlet.  Uncommented the invoker
> > servlet
> > and it's mapping in web.xml and added
> > privileged="true" to context.xml and threw a
> > HelloWorld.class file into
> > webapps\Root\WEB-INF\classes dir accessing via
> > http:\\localhost:8080\servlet\HelloWorld.
> > 
> > I also tried my own app dir and a context fragment
> > file.  
> > Tried putting the context fragment file in 
> > tomcat\conf\Catalina\localhost\myApp.xml,
> > tomcat\conf\Catalina\localhost\myApp\myApp.xml and 
> > tomcat\webapps\myApp\META-INF\context.xml.
> > Tried changing up the docbase.
> > 
> > Tried raising the logging level to see if anything
> > useful would pop out.  NADA
> > 
> > Wondering if I'm missing an environment var.
> > 
> > Any help would be GREATLY appreciated.
> > 
> > Thanks for your time.
> > 
> > 
> > 
> > 
> > 
> >      
> >
> ____________________________________________________________________________________
> > Never miss a thing.  Make Yahoo your home page. 
> > http://www.yahoo.com/r/hs
> > 
> 
> 
> 
>       ____________________________________________________________________________________
> Looking for last minute shopping deals?  
> Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
> 
> ---------------------------------------------------------------------
> 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