Here they are :
-------- Context from the server.xml --------
<Context docBase="ROOT" path="/ROOT" reloadable="true"
source="org.eclipse.jst.jee.server:ROOT"/></Host>
---------- Filter---------------
public class ElwinFilterimplements Filter
{
public ElwinFilter()
{
System.out.println("Creating filter.");
readConfig();
}
// For some reasome the filter is constructed twice
private static boolean sInit = false;
//Init all code
private synchronized void readConfig()
{
if(sInit)
{
return;
}
try
{
RemoteDBConnections.getInstance();
}
catch(Exception e)
{
e.printStackTrace();
}
sInit = true;
}
// @Override
public void destroy()
{
}
// @Override
public void doFilter(ServletRequest request,
ServletResponse response,
FilterChain filterChain) throws IOException,
ServletException
{
filterChain.doFilter(request, response);
}
}
@Override
public void init(FilterConfig arg0) throws ServletException
{
System.out.println("init filter");
}
}
-------------- web.xml -----------------
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>ROOT</display-name>
<servlet>
<description>For event logs</description>
<display-name>EventFront</display-name>
<servlet-name>EventFront</servlet-name>
<servlet-class>com.elwin.EventFront</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>EventFront</servlet-name>
<url-pattern>/EventFront</url-pattern>
</servlet-mapping>
<filter>
<filter-name>Elwin Filter</filter-name>
<filter-class>
com.elwin.IMeraFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>Elwin Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
---------------
> From: [EMAIL PROTECTED]> To: [email protected]> Date: Thu, 5 Jun 2008
> 12:23:03 -0500> Subject: RE: Singleton in Tomcat 6.0 not working> > > From:
> ktou Ho [mailto:[EMAIL PROTECTED]> > Subject: RE: Singleton in Tomcat 6.0 not
> working> >> > I tried to change the web app to other name, it works fine> >
> now. (only one instance). Look like it is the "ROOT" cause> > all problem.
> Any one know why the ROOT is being called twice?> > Post the code for your
> filter along with your server.xml and the webapp's web.xml and <Context>.> >
> - Chuck> > > THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE
> PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If
> you received this in error, please contact the sender and delete the e-mail
> and its attachments from all computers.> >
> ---------------------------------------------------------------------> To
> start a new topic, e-mail: [email protected]> To unsubscribe, e-mail:
> [EMAIL PROTECTED]> For additional commands, e-mail: [EMAIL PROTECTED]>
_________________________________________________________________
It’s easy to add contacts from Facebook and other social sites through Windows
Live™ Messenger. Learn how.
https://www.invite2messenger.net/im/?source=TXT_EML_WLH_LearnHow