You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Vsevolod (Simon) Ilyushchenko" <si...@cshl.edu> on 2005/08/15 18:33:35 UTC

Webapp suddenly not available

Hi,

I'm a relative Tomcat newbie. I have built an application with ant and 
was using it under Tomcat 5.5.9 for several weeks, and then it suddenly 
broke. All request to JSP pages now display the 404 error (the requested 
resource is not available). I was making only very minor changes to the 
Java code. The HTML pages still work.

There are no errors in catalina.out and localhost.log. I've tried to 
configure log4j logging by placing the log4j.properties file into 
common/classes (and the commons-logging and log4j jars into common/lib, 
but the log file I specified there is not even created.

Finally, I was never able to make my application work with the web.xml 
file generated by ant. It only worked after I delete the file. The file 
is pretty basic, but I attach it in case there is an obvious error there.

I'll be grateful for any suggestions.

Thanks,
Simon
-- 

Simon (Vsevolod ILyushchenko)   simonf@cshl.edu
				http://www.simonf.com

Terrorism is a tactic and so to declare war on terrorism
is equivalent to Roosevelt's declaring war on blitzkrieg.

Zbigniew Brzezinski, U.S. national security advisor, 1977-81

Re: Webapp suddenly not available

Posted by Brian Cook <bc...@printtime.com>.
I would try removing the <<context>>.xml file, if there is one, and 
replace the web.xml with a default one.  Then restart Tomcat.

If you still get the 404 error when calling just JSP pages and there are 
no errors in the catalina.out file then the problem is very likely in 
the syntax of the URL being used.  If this does work then the problem is 
mostlly in the web.xml file.  Possiblly in the <<context>>.xml but not 
liklly.


The <<context>>.xml file can be found in


<<Tomcat Dir>>Tomcat\conf\Catalina\localhost\<<Name of deployment dir>>.xml




<Sample of a defulat web.xml File>



<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
	 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
	 version="2.4">
     <session-config>
         <session-timeout>
             30
         </session-timeout>
     </session-config>
     <welcome-file-list>
	<welcome-file>
             index.jsp
         </welcome-file>
     </welcome-file-list>
</web-app>



</Sample of a defulat web.xml File>


Vsevolod (Simon) Ilyushchenko wrote:
> 
> 
> Brian Cook wrote on 08/16/2005 10:36 AM:
> 
>>
>> WOW that looks like a lot lot of unneeded complication.
>>
>> I do not know if this is absolutely correct for every situation.  But 
>> it is my experience that if you are just doing JSP pages you do not 
>> need the web.xml at all.  It is only needed if you need to call a 
>> servlet, define a resource like JNDI, or set a context value.
>>
>> Is the 404 error from Tomcat or Apache?  Do you get the 404 error when 
>> you try to connect one of the servlets directly?
> 
> 
> Brian,
> 
> The error is from Tomcat - if I go to port 8080, I also see it. My issue 
> is that I can't figure out how to turn debug messages on via log4j - I'm 
> sure I'd see something interesting there.
> 
> Thanks,
> Simon
> 


-- 
Brian Cook
Digital Services Analyst
Print Time Inc.
bcook@printtime.com
913.345.8900


Re: Webapp suddenly not available

Posted by Hassan Schroeder <ha...@webtuitive.com>.
Vsevolod (Simon) Ilyushchenko wrote:

> The error is from Tomcat - if I go to port 8080, I also see it. My issue 
> is that I can't figure out how to turn debug messages on via log4j - I'm 
> sure I'd see something interesting there.

Uh, yeah. Seems like it'd be a good idea to reinstall the orginal
default ROOT directory temporarily and get log4j working properly.

It's really straightforward, but the time to try isn't after your
webapp breaks :-)

Check out Allistair Crossley's <http://www.adcworks.com/blog>

Good luck!
-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Webapp suddenly not available

Posted by "Vsevolod (Simon) Ilyushchenko" <si...@cshl.edu>.

Brian Cook wrote on 08/16/2005 10:36 AM:
> 
> WOW that looks like a lot lot of unneeded complication.
> 
> I do not know if this is absolutely correct for every situation.  But it 
> is my experience that if you are just doing JSP pages you do not need 
> the web.xml at all.  It is only needed if you need to call a servlet, 
> define a resource like JNDI, or set a context value.
> 
> Is the 404 error from Tomcat or Apache?  Do you get the 404 error when 
> you try to connect one of the servlets directly?

Brian,

The error is from Tomcat - if I go to port 8080, I also see it. My issue 
is that I can't figure out how to turn debug messages on via log4j - I'm 
sure I'd see something interesting there.

Thanks,
Simon

-- 

Simon (Vsevolod ILyushchenko)   simonf@cshl.edu
				http://www.simonf.com

Terrorism is a tactic and so to declare war on terrorism
is equivalent to Roosevelt's declaring war on blitzkrieg.

Zbigniew Brzezinski, U.S. national security advisor, 1977-81

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Webapp suddenly not available

Posted by Brian Cook <bc...@printtime.com>.
WOW that looks like a lot lot of unneeded complication.

I do not know if this is absolutely correct for every situation.  But it 
is my experience that if you are just doing JSP pages you do not need 
the web.xml at all.  It is only needed if you need to call a servlet, 
define a resource like JNDI, or set a context value.

Is the 404 error from Tomcat or Apache?  Do you get the 404 error when 
you try to connect one of the servlets directly?



Vsevolod (Simon) Ilyushchenko wrote:
> Hi,
> 
> I'm a relative Tomcat newbie. I have built an application with ant and 
> was using it under Tomcat 5.5.9 for several weeks, and then it suddenly 
> broke. All request to JSP pages now display the 404 error (the requested 
> resource is not available). I was making only very minor changes to the 
> Java code. The HTML pages still work.
> 
> There are no errors in catalina.out and localhost.log. I've tried to 
> configure log4j logging by placing the log4j.properties file into 
> common/classes (and the commons-logging and log4j jars into common/lib, 
> but the log file I specified there is not even created.
> 
> Finally, I was never able to make my application work with the web.xml 
> file generated by ant. It only worked after I delete the file. The file 
> is pretty basic, but I attach it in case there is an obvious error there.
> 
> I'll be grateful for any suggestions.
> 
> Thanks,
> Simon
> 
> 
> ------------------------------------------------------------------------
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> 
> <!DOCTYPE web-app 
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
> 
> <web-app>
> 
> 
>     <!-- General description of your web application -->
> 
>     <display-name>My Web Application</display-name>
>     <description>
>       This is version X.X of an application to perform
>       a wild and wonderful task, based on servlets and
>       JSP pages.  It was written by Dave Developer
>       (dave@mycompany.com), who should be contacted for
>       more information.
>     </description>
> 
> 
>     <!-- Context initialization parameters that define shared
>          String constants used within your application, which
>          can be customized by the system administrator who is
>          installing your application.  The values actually
>          assigned to these parameters can be retrieved in a
>          servlet or JSP page by calling:
> 
>              String value =
>                getServletContext().getInitParameter("name");
> 
>          where "name" matches the <param-name> element of
>          one of these initialization parameters.
> 
>          You can define any number of context initialization
>          parameters, including zero.
>     -->
> 
>     <context-param>
>       <param-name>webmaster</param-name>
>       <param-value>myaddress@mycompany.com</param-value>
>       <description>
>         The EMAIL address of the administrator to whom questions
>         and comments about this application should be addressed.
>       </description>
>     </context-param>
> 
> 
>     <!-- Servlet definitions for the servlets that make up
>          your web application, including initialization
>          parameters.  With Tomcat, you can also send requests
>          to servlets not listed here with a request like this:
> 
>            http://localhost:8080/{context-path}/servlet/{classname}
> 
>          but this usage is not guaranteed to be portable.  It also
>          makes relative references to images and other resources
>          required by your servlet more complicated, so defining
>          all of your servlets (and defining a mapping to them with
>          a servlet-mapping element) is recommended.
> 
>          Servlet initialization parameters can be retrieved in a
>          servlet or JSP page by calling:
> 
>              String value =
>                getServletConfig().getInitParameter("name");
> 
>          where "name" matches the <param-name> element of
>          one of these initialization parameters.
> 
>          You can define any number of servlets, including zero.
>     -->
> 
>     <servlet>
>       <servlet-name>controller</servlet-name>
>       <description>
>         This servlet plays the "controller" role in the MVC architecture
>         used in this application.  It is generally mapped to the ".do"
>         filename extension with a servlet-mapping element, and all form
>         submits in the app will be submitted to a request URI like
>         "saveCustomer.do", which will therefore be mapped to this servlet.
> 
>         The initialization parameter namess for this servlet are the
>         "servlet path" that will be received by this servlet (after the
>         filename extension is removed).  The corresponding value is the
>         name of the action class that will be used to process this request.
>       </description>
>       <servlet-class>com.mycompany.mypackage.ControllerServlet</servlet-class>
>       <init-param>
>         <param-name>listOrders</param-name>
>         <param-value>com.mycompany.myactions.ListOrdersAction</param-value>
>       </init-param>
>       <init-param>
>         <param-name>saveCustomer</param-name>
>         <param-value>com.mycompany.myactions.SaveCustomerAction</param-value>
>       </init-param>
>       <!-- Load this servlet at server startup time -->
>       <load-on-startup>5</load-on-startup>
>     </servlet>
> 
>     <servlet>
>       <servlet-name>graph</servlet-name>
>       <description>
>         This servlet produces GIF images that are dynamically generated
>         graphs, based on the input parameters included on the request.
>         It is generally mapped to a specific request URI like "/graph".
>       </description>
>     </servlet>
> 
> 
>     <!-- Define mappings that are used by the servlet container to
>          translate a particular request URI (context-relative) to a
>          particular servlet.  The examples below correspond to the
>          servlet descriptions above.  Thus, a request URI like:
> 
>            http://localhost:8080/{contextpath}/graph
> 
>          will be mapped to the "graph" servlet, while a request like:
> 
>            http://localhost:8080/{contextpath}/saveCustomer.do
> 
>          will be mapped to the "controller" servlet.
> 
>          You may define any number of servlet mappings, including zero.
>          It is also legal to define more than one mapping for the same
>          servlet, if you wish to.
>     -->
> 
>     <!-- JSPC servlet mappings start -->
> 
>     <servlet>
>         <servlet-name>org.apache.jsp.error_jsp</servlet-name>
>         <servlet-class>org.apache.jsp.error_jsp</servlet-class>
>     </servlet>
> 
> ...More servlets here...
> 
>     <servlet-mapping>
>         <servlet-name>org.apache.jsp.error_jsp</servlet-name>
>         <url-pattern>/error.jsp</url-pattern>
>     </servlet-mapping>
> 
> ...More servlet-mappings here...
> 
> <!-- JSPC servlet mappings end -->
> 
>     <servlet-mapping>
>       <servlet-name>controller</servlet-name>
>       <url-pattern>*.do</url-pattern>
>     </servlet-mapping>
> 
>     <servlet-mapping>
>       <servlet-name>graph</servlet-name>
>       <url-pattern>/graph</url-pattern>
>     </servlet-mapping>
> 
> 
>     <!-- Define the default session timeout for your application,
>          in minutes.  From a servlet or JSP page, you can modify
>          the timeout for a particular session dynamically by using
>          HttpSession.getMaxInactiveInterval(). -->
> 
>     <session-config>
>       <session-timeout>30</session-timeout>    <!-- 30 minutes -->
>     </session-config>
> 
> 
> </web-app>
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


-- 
Brian Cook
Digital Services Analyst
Print Time Inc.
bcook@printtime.com
913.345.8900


Re: Webapp suddenly not available

Posted by "Vsevolod (Simon) Ilyushchenko" <si...@cshl.edu>.
> Hmm... what _do_ you require in this file, if not the controller entry ?

Those JSPs entries. :)

> Does the sample web application work ? 

Yes, it does.

> Try installing Tomcat again, and then running this web app. Maybe you've messed
> with some config files by mistake.

I definitely have not touched any config files for tomcat - it's 
probably something in my application.

Thanks,
Simon
-- 

Simon (Vsevolod ILyushchenko)   simonf@cshl.edu
				http://www.simonf.com

Terrorism is a tactic and so to declare war on terrorism
is equivalent to Roosevelt's declaring war on blitzkrieg.

Zbigniew Brzezinski, U.S. national security advisor, 1977-81

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Webapp suddenly not available

Posted by Sriram N <sr...@yahoo.com>.

--- "Vsevolod (Simon) Ilyushchenko" <si...@cshl.edu> wrote:

> Sriram,
> 
> I've taken them out, as well as the controller entry (which was a sample 
> line that I don't need). No good.
> 

Hmm... what _do_ you require in this file, if not the controller entry ?

Does the sample web application work ? 

Try installing Tomcat again, and then running this web app. Maybe you've messed
with some config files by mistake.

> Thanks,
> Simon
> 
-- Sriram


		
__________________________________ 
Yahoo! Mail for Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone. 
http://mobile.yahoo.com/learn/mail 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Webapp suddenly not available

Posted by "Vsevolod (Simon) Ilyushchenko" <si...@cshl.edu>.
Sriram,

I've taken them out, as well as the controller entry (which was a sample 
line that I don't need). No good.

Thanks,
Simon

Sriram N wrote on 08/15/2005 12:39 PM:
> 
> --- "Vsevolod (Simon) Ilyushchenko" <si...@cshl.edu> wrote:
> 
> [snip]
> 
>>I'll be grateful for any suggestions.
>>
> 
> 
> Why all the JSPC entries in this web.xml ? Remove them as the Tomcat defaults
> should be just OK.
> 
> The controller entry and the .do mapping seem to be OK.
>  
> 
>>Thanks,
>>Simon
>>-- 
> 
> 
> -- Sriram
> 
> 
> 
> 		
> ____________________________________________________
> Start your day with Yahoo! - make it your home page 
> http://www.yahoo.com/r/hs 
>  
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

-- 

Simon (Vsevolod ILyushchenko)   simonf@cshl.edu
				http://www.simonf.com

Terrorism is a tactic and so to declare war on terrorism
is equivalent to Roosevelt's declaring war on blitzkrieg.

Zbigniew Brzezinski, U.S. national security advisor, 1977-81

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Webapp suddenly not available

Posted by Sriram N <sr...@yahoo.com>.

--- "Vsevolod (Simon) Ilyushchenko" <si...@cshl.edu> wrote:

[snip]
> 
> I'll be grateful for any suggestions.
> 

Why all the JSPC entries in this web.xml ? Remove them as the Tomcat defaults
should be just OK.

The controller entry and the .do mapping seem to be OK.
 
> Thanks,
> Simon
> -- 

-- Sriram



		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org