Hi,

I tried to creat emy own filter, a Hibernate filter in fact, like that :

[code]
// here the imports... compilation ok
public class HibernateFilter implements Filter {
    private TapestryFilter tapestryFilter = new TapestryFilter();

    private static Log log = LogFactory.getLog(HibernateFilter.class);

    public void init(FilterConfig filterConfig) throws ServletException {
        log.info("Servlet filter init, now opening/closing a Session for
each request.");
        tapestryFilter.init(filterConfig);
    }

    public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {

        try {
            HibernateUtil.beginTransaction();
            chain.doFilter(request, response);
            HibernateUtil.commitTransaction();

        } catch (RuntimeException e) {
            HibernateUtil.rollbackTransaction();
            throw e;
        } catch (Exception e) {
            HibernateUtil.rollbackTransaction();
            throw new ServletException(e);
        } finally {
            HibernateUtil.closeSession();
        }

        tapestryFilter.doFilter(request, response, chain);
    }

    public void destroy() {
        tapestryFilter.destroy();
    }
}
[/code]

then I adapt my web.xml like that :

[code]
<filter>
        <filter-name>app</filter-name>
        <filter-class>org.hibernate.util.HibernateFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>app</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
[/code]

But I get that ERROR at runtime :

[code]
11-Dec-2007 16:48:12 org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter app
java.lang.NoClassDefFoundError: org/apache/tapestry/TapestryFilter
[/code]

TapestryFilter is not loaded by the ClassLoader. Why and how can I do that?
I tried to test by put the tapestry-core.jar directly in [tomcat5.5]/common/lib
without success.

Any idea?

Thanks!

-- 
Michael Bernagou
Java Developper

Reply via email to