The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

jchan0712 (4) [Avatar] Offline
#1
Dear friends,

Can anyone tell me why the following error message displays while I try to run the HelloWorldServlet in chapter 1.

The requested resource (/chapter01/servlet/HelloWorldServlet.) is not available.

I have followed the steps in Appendix A to setup Tomcat, and deploy the servlet accordingly.

Many thanks for your help .... smilie

Joe
stabilpa (6) [Avatar] Offline
#2
Re: Can't Run the HelloWorldServlet in chapter 1
It sounds like a Tomcat configuration issue. Without seeing your server.xml, your logs, or any of your directory/file permissions, I personally would find it difficult render a more specific diagnosis. I've been having a lot of problems with setting up Tomcat with an Apache proxy lately, so I fully understand your frustration.

If you're just trying to work through the examples for the exam, and don't give a rat's ass about administering your container, you can always get a free Tomcat account at http://www.myjavaserver.com . It's a lot less frustrating, and frees you up to do more programming and less system administration.
jchan0712 (4) [Avatar] Offline
#3
Re: Can't Run the HelloWorldServlet in chapter 1
Actually, not only servlet, but also simple html page can not display through browser. Browser return the same error message. Can anyone expert help me ?

Thanks a lot.

Joe
DCAM (1) [Avatar] Offline
#4
Re: Can't Run the HelloWorldServlet in chapter 1
Did you see that the invoker servlet must be enabled ? There has been an addition to the Appendix A errata as follows.....

Many examples throughout the book require the "invoker servlet" to be enabled. Since Tomcat version 4.1.12, this invoker servlet has been disabled by default. Accordingly, Section A.3.3 should be added, as follows:

Enable The Invoker Servlet

Many examples in this book require the 'invoker' servlet to be enabled. Open the file CATALINA_HOMEconfweb.xml, and uncomment the following entries.:

<!-- -->
<servlet>
<servlet-name>invoker</servlet-name>
<servlet-class>
org.apache.catalina.servlets.InvokerServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<!-- -->


And
<!-- The mapping for the invoker servlet -->
<!-- -->
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
<!-- -->

You will need to restart Tomcat in order for these changes to take effect.
CatchSandeepVaid (23) [Avatar] Offline
#5
Re: Can't Run the HelloWorldServlet in chapter 1
<servlet-mapping> section in web.xml is missing. If you make your web.xml as :

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" >
xmlnssmiliesi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/webapp_2_4.xsd" version="2.4">
<servlet>
<servlet-name>HelloWorldServlet</servlet-name>
<servlet-class>HelloWorldServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>HelloWorldServlet</servlet-name>
<url-pattern>/HelloWorldServlet</url-pattern>

</servlet-mapping>
</web-app>

then it will work.

I am wondering that how it is even not present in actual book?
MacHershell (1) [Avatar] Offline
#6
Re: Can't Run the HelloWorldServlet in chapter 1
Can someone clarify this point? We have 2 possible solutions... I have used the previous solution presented in this forum... of altering CATALINA_HOMEweb.xml and un-commenting the Invoker Servlet....

That worked for me.

Is the 2nd solution an alternative? I would like to move past Chapter 1. I understand that there may be more than 1 solution. But, in the interest of preparing for the exam, we should understand whether these are mutually exclusive solutions...

This is my first experience with Manning resources... and if the first chapter is an indication... it will be my last.