Is your webapp deployed in a .war file?  What application server are you
using?

On 10/27/06, andyhot <[EMAIL PROTECTED]> wrote:

Dear ken, please do not cross-post.
I just got this email 3 times...

And i can't even find what the question is...
Cause it's sure that your getServletContext().getRealPath("/") indeed
returns null.
Looks like a servlet context issue (configuration perhaps) to me...



Ken nashua wrote:
> 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>
>
> _________________________________________________________________
> Use your PC to make calls at very low rates
> https://voiceoam.pcs.v2s.live.com/partnerredirect.aspx
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
Andreas Andreou - [EMAIL PROTECTED] - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / J2EE Consulting


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to