• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem loading a servlet

 
Ranch Hand
Posts: 681
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I run this example from the Apache Jakarta Book I get the following error:
type Status report
message /apress/servlet/chapter2.login
description The requested resource (/apress/servlet/chapter2.login) is not available.
The code compiles ok, I think the problem is how I have set up by XML deployment files:
In the server.xml C:\jakarta-tomcat-5.0.19\conf
under the code:
<Host appBase="webapps" autoDeploy="true" debug="0" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">
I added the following xml code:
<Context debug="0" docbase="apress" path="/apress" reloadable="true"></Context>
In the web.xml in directory C:\jakarta-tomcat-5.0.19\webapps\apress\WEB-INF
I added the following:
<?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/j2ee/dtds/web-app_2_3.dtd" >
<web-app>
<servlet>
<servlet-name>login</servlet-name>
<servlet-class>chapter2.login</servlet-class>
</servlet>
</web-app>
Under C:\jakarta-tomcat-5.0.19\webapps
I added apress which contains my JSP file
under C:\jakarta-tomcat-5.0.19\webapps\apress\WEB-INF\classes\chapter2
I added the login.class.
Not sure what else I can do.
Thanks for any help
PS how do I stop the same jsp being loaded after changes, at the moment all I can do is stop and restart my PC.
 
Tony Evans
Ranch Hand
Posts: 681
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Solved the problem, in the C:\jakarta-tomcat-5.0.19\conf there is a file called web.xml.
There is a block of code:
<!-- The mapping for the invoker servlet -->
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
That was commented out this needs to be uncommented.
Hope this helps someone else took me quite a few hours of surfing to get the answer. So much more than than old fashion C programming then all you had to worry about was compliation errors.
Tony
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Be warned that depending on the invoker servlet for serious work is not advised - see the FAQ on invoker here at the ranch. You can get some very confusing bugs - witness the many discussions here and in the servlets forum on "invoker"
Bill
 
Tony Evans
Ranch Hand
Posts: 681
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks William.
This works
I have commented out
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping> -->
and then to run my loginvalidation
under
<servlet>
<servlet-name>loginvalidation</servlet-name>
<servlet-class>vecconsulting.loginvalidation</servlet-class>
</servlet>
I have addded
<servlet-mapping>
<servlet-name>loginvalidation</servlet-name>
<url-pattern>/servlet/vecconsulting.loginvalidation</url-pattern>
</servlet-mapping>
Hope this is of help to other new starters.
Tony
 
If tomatoes are a fruit, then ketchup must be a jam. Taste this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic