Sunday, May 11, 2008

Executing anonymous servlet in Tomcat - Jboss

If you want to run anonymous servlet classes in Tomcat or Jboss that have not been defined in a web.xml file, you need to change configure it in web.xml.

Open web.xml and uncomment following lines.

<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>


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

Traditionally, this servlet is mapped to the URL pattern "/servlet/*", but you can map it to other patterns as well.

0 Java Junction comments: