tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Newbie question
Date Mon, 24 Aug 2009 15:53:28 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Malladi,

On 8/24/2009 10:36 AM, Malladi, Sasikanth wrote:
> I'm using "Core Servlets" by Marty Hall as a guide.

Which edition? It may be out of date.

> I've created a servlet, HelloServlet. Well, it just says "hello".

Can you post the code?

> I've compiled it and put the class file into .../install_dir/webapps/ROOT/WEB-INF/classes/.
> I've enabled the invoker servlet by uncommenting it in .../install_dir/conf/web.xml.

This is fine for testing purposes, but you really should not use the
invoker servlet. Instead, it's easy to enable your servlet in your own
webapp's web.xml:

<servlet>
  <servlet-name>Hello</servlet-name>
  <servlet-class>HelloServlet</servlet-class>
</servlet>

<servlet-mapping>
  <servlet-name>Hello</servlet-name>
  <url-pattern>/HelloServlet</url-pattern>
</servlet-mapping>

> I've enabled the servlet reloading in .../install_dir/conf/context.xml.

You should probably not be modifying CATALINA_HOME/conf/context.xml.
Instead, create a file in webapps/ROOT/META-INF/context.xml and put your
configuration there. Remember not to set the "docBase" or "path"
attributes in your <Context> element.

> However, I can't see the servlet in http://myhost:8008/servlet/HelloServlet.
> 
> What am I missing?

I suspect you have a package/class name mismatch with your .class file
and the URL you're using to access the servlet. Disable the invoker
servlet, write a proper web.xml file, and post your code. That will help
a lot.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkqSt3gACgkQ9CaO5/Lv0PAKEACgqqCK2g+WQoJuEgtHpmwhzvUb
S94AoLvUqwmqs7U7B0fFdbtmkeOVIbXK
=x+CO
-----END PGP SIGNATURE-----

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


Mime
View raw message