tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: TomCat, taglibs, and servlet mapping
Date Tue, 05 Sep 2000 20:54:53 GMT
See embedded comments below.

"Andrew J. Dick" wrote:

> Hi all,
>   I am trying to get a webapp running on tomcat 3.1 standalone.  I have ripped
> out the templating portion of the
> java petstore that I had running under weblogic 5.1.  I cannot seem to get the
> servlet mapping to trigger to the
> appropriate servlet.  First off, the FAQ describes using servlet classes
> whereas the example I have maps to a
> jsp, so I am not sure if this will make a difference or not.
> However the following are the steps I took:
> 1.) Created a directory under tomcat/webapps called foo.
> 2.) In tomcat/webapp/foo, I created a WEB-INF directory.

I am assuming that you really mean "tomcat/webapps" from here on, not "tomcat/webapp", right?

> 3.) In tomcat/webapp/foo/WEB-INF I placed a web.xml file with the following:
>     <web-app>
>       <display-name>WebTier</display-name>
>       <servlet>
>         <servlet-name>webTierEntryPoint</servlet-name>
>         <display-name>centralJsp</display-name>
>         <jsp-file>Main.jsp</jsp-file>

If you want to use a servlet instead of a JSP page, you should replace <jsp-file> with
a <servlet-class>
element, to tell Tomcat what Servlet class to load.  Something like:


>       </servlet>
>       <servlet-mapping>
>         <servlet-name>webTierEntryPoint</servlet-name>
>         <url-pattern>/control/*</url-pattern>
>       </servlet-mapping>
>         <welcome-file-list>
>         <welcome-file>/index.html</welcome-file>
>       </welcome-file-list>
> </web-app>
> 4.) In tomcat/webapp/foo/WEB-INF I placed a directory tlds with the foo.tld
> file which holds the template definitions.

This is fine, but not required.  You can put TLDs directly in /WEB-INF if you want to, but
you need to
make sure that your references point to the correct places.

> 5.) In tomcat/webapp/foo I placed all the required jsp files and the
> index.html welcome page.
> 6.) In tomcat/conf/server.xml I added the following line:
>       <Context path="/foo" docBase="webapps/foo" debug="1" reloadable="true"
> ></Context>

This is fine, but not necessary unless you want to override the default context configuration
In this case, you set debug="1" which is non default, and that is fine.

> This works for weblogic perfectly, with the appropriate change for step 6, .
> This afternoon I reinstalled the webapp on weblogic,
> made sure it was working, tarred it up and placed it under the appropriate
> directory for tomcat and I get the following error:
> Error: 500
> Location: /foo/control/page1
> Internal Servlet Error:
> java.lang.NullPointerException:
>         at
> org.apache.tomcat.core.ServletWrapper.handleRequest(
>         at

This is most likely because of the missing <servlet-class> entry defined above.

> org.apache.tomcat.core.ContextManager.service(
>         at
> org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(
>         at
>         at
> Any ideas, suggestions or similar experiences anyone?
> Thanks for any advice.
> Andrew

Craig McClanahan

See you at ApacheCon Europe <>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat

View raw message