Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

load-on-startup not working with filters  RSS feed

 
karen obrien
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I've just added a filter to my web.xml (see below). However, even though Tomcat starts up fine, the servlet called to load of startup is never called. I've tried moving the filter to the bottom of the file, but the DTD doesn't allow this.
Any ideas?? (I'm using Tomcat 4.0.6)

Thanks!!!

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!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>

<filter>
<filter-name>FileUploadFilter</filter-name>
<filter-class>aiu.extra.filterservlet.FileUploadFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>FileUploadFilter</filter-name>
<url-pattern>/vl/EXTRA/Documents/Documents/UploadWorkingDocument*</url-pattern>
</filter-mapping>


<servlet>
<servlet-name>AdministrativeServlet</servlet-name>
<servlet-class>aiu.core.component.AdministrativeServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet>
<servlet-name>SwitchingServlet</servlet-name>
<servlet-class>aiu.core.switchingservlet.SwitchingServlet</servlet-class>
</servlet>


<servlet>
<servlet-name>ComponentControl</servlet-name>
<servlet-class>aiu.core.component.ComponentControl</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>SwitchingServlet</servlet-name>
<url-pattern>/SwitchingServlet/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>SwitchingServlet</servlet-name>
<url-pattern>/vl/*</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

If that is not a typo - that use of * is not correct. You should use /* or .*
.../UploadWorkingDocument/*</url-pattern>
See the servlet API
Bill
[ November 20, 2004: Message edited by: William Brogden ]
 
karen obrien
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi William,
Thanks for the reply. Unfortunately, the <load-on-startup> tag is not working. Classes loaded by the Administrative servlet are not getting loaded...could there be something wrong with the filter servlet?
Thanks!
Karen
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!