Hi Folks,

I thought it proper to integrate ConfigurationServlet to my webapp just like 
the tacosdemo does.. just to initialize log4j

web.xml below...

--->HERE IS THE OUTPUT FROM TOMCAT CONSOLE:
java.io.FileNotFoundException: null\WEB-INF\log4j.properties (The system 
cannot
find the path specified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:106)
        at java.io.FileInputStream.<init>(FileInputStream.java:66)

--->HERE IS THE CODE:
public class ConfigurationServlet extends ApplicationServlet implements 
ServletContextListener {

    /** Comment for <code>serialVersionUID</code> */
    private static final long serialVersionUID = 3257005471045858873L;
    /* Logger */
    private static final Logger LOG = 
Logger.getLogger(ConfigurationServlet.class);

    /**
     * @see javax.servlet.GenericServlet#init()
     */
    public void init() {
        try {
            // Use basic logging configuration until Log4j is properly 
configured
            
PropertyConfigurator.configure(getServletContext().getRealPath("/")
                    + "/WEB-INF/log4j.properties");
            super.init();
        } catch (Throwable t) {
            t.printStackTrace();
            LOG.fatal("Error configuring CIMS", t);
        }
    }

    /**
     * @see javax.servlet.Servlet#destroy()
     */
    public void destroy()
    {
        super.destroy();
        org.apache.log4j.LogManager.shutdown();
    }

    /**
     * @see 
javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent)
     */
    public void contextDestroyed(ServletContextEvent arg0)
    {
        org.apache.log4j.LogManager.shutdown();
    }

    /**
     * [EMAIL PROTECTED]
     */
    public void contextInitialized(ServletContextEvent arg0)
    {
    }
}

--->HERE IS 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>
    <display-name>tap.proto-1.0</display-name>

    <filter>
        <filter-name>redirect</filter-name>
        <filter-class>org.apache.tapestry.RedirectFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>redirect</filter-name>
        <url-pattern>/</url-pattern>
    </filter-mapping>

    <servlet>
        <servlet-name>tap.proto-1.0</servlet-name>
        <servlet-class>proto.servlet.ConfigurationServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <!-- SERVLET-MAPPINGS -->
    <servlet-mapping>
        <servlet-name>tap.proto-1.0</servlet-name>
        <url-pattern>/app</url-pattern>
    </servlet-mapping>

    <!-- Boiler Plate HiveMind Services -->
    <servlet-mapping>
        <servlet-name>tap.proto-1.0</servlet-name>
        <url-pattern>*.html</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>tap.proto-1.0</servlet-name>
        <url-pattern>*.direct</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>tap.proto-1.0</servlet-name>
        <url-pattern>*.sdirect</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>tap.proto-1.0</servlet-name>
        <url-pattern>/assets/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>tap.proto-1.0</servlet-name>
        <url-pattern>*.svc</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>tap.proto-1.0</servlet-name>
        <url-pattern>*.ajax</url-pattern>
    </servlet-mapping>


    <session-config>
        <session-timeout >10</session-timeout> <!-- minutes -->
    </session-config>

    <resource-ref>
        <res-ref-name>MySQLDataSource</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>
    <resource-ref>
        <res-ref-name>OracleDataSource</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>

</web-app>

_________________________________________________________________
Try Search Survival Kits: Fix up your home and better handle your cash with 
Live Search! 
http://imagine-windowslive.com/search/kits/default.aspx?kit=improve&locale=en-US&source=hmtagline


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Tacos-devel mailing list
Tacos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tacos-devel

Reply via email to