Here are some more details: -

I like to use context listener class to save datasource information. I have
implemented a ServletContextListener named AppListener.

Following is the code for Web.xml: -

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";
    version="2.5"> 
    
    <context-param>
        <param-name>dataSourceJndiName</param-name>
        <param-value>java:/comp/env/jdbc/myDataSource</param-value>
    </context-param>
    <context-param>
        <param-name>dbType</param-name>
        <param-value>mysql</param-value>
    </context-param>
    
    

    <filter>
        <filter-name>struts2</filter-name>
       
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    
    <listener>
        <listener-class>
            QDSweb.AppListener
        </listener-class>
    </listener>
    
    <!-- Restrict direct access to JSPs. 
         For the security constraint to work, the auth-constraint
         and login-config elements must be present -->
    <security-constraint>
        <web-resource-collection>
            <web-resource-name>JSPs</web-resource-name>
            <url-pattern>/jsp/*</url-pattern>
        </web-resource-collection>
        <auth-constraint/>
    </security-constraint>

    <login-config>
        <auth-method>BASIC</auth-method>
    </login-config>
</web-app> 

Application compiles successfully, but gives runtime error that "Resource
not found". When I remove <listener> tag from my web.xml, it runs smootly.
But I would like to use ServletContextListener Class.
I have seen same problem reported in some other forums but didn't find the
solution. In one forum I found out that this problem has to do with some
mapping files and fix it with build.xml. 
Any help would be appreciated.  


anaeem wrote:
> 
> When I insert "<Listener>" tag to my web descriptor file, application
> gives 404 error
> "Resource not Found". When I remove listener tag it works fine. Please
> advice some solution.
> 

-- 
View this message in context: 
http://www.nabble.com/Adding-%3CLinstener%3E%22-tag-in-web.xml-results-in-Resource-not-found-error-on-browser-tp18614799p18615142.html
Sent from the Struts - User mailing list archive at Nabble.com.


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

Reply via email to