You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Michael Bernagou <bl...@gmail.com> on 2007/12/11 16:53:26 UTC

CustomFilter

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

[V5.0.5] method: onSubmit signature: ()Ljava/lang/Object;) Illegal constant pool index

Posted by Zsolt Salamon <sa...@gmail.com>.
Hello!

I wrote a page object, which contains 2 form componenet.
I use delegate for show only 1 of them.
In the page object's onSubmit method hande events, and decide which  
form is showed next time.

It's works like this:

   Object onSubmit() {
     if( form1.isShow ) {
       switch( form1.getEvent() ) {
         case 1:
         case 2:
           ...
         case n:
       }
     }
   } else {
     switch( form2.getEvent() ) {
       case 1:
       case 2:
         ...
       case n:
     }
return this;
   }

Sometimes it's wokrs perfectly but sometimes not.

If I remove some case node from switch, then usually works.
If I put too many case node, then I keep this error:

An unexpected application exception has occurred.

     * org.apache.tapestry.internal.services.TransformationException
       (class: my/package/web/pages/Intez, method: onSubmit  
signature: ()Ljava/lang/Object;) Illegal constant pool index
at  
org.apache.tapestry.internal.services.ComponentClassTransformerImpl.crea 
teInstantiator(ComponentClassTransformerImpl.java:161)
         at $ComponentClassTransformer_116d3a87b3f.createInstantiator 
($ComponentClassTransformer_116d3a87b3f.java)
         at  
org.apache.tapestry.internal.services.ComponentInstantiatorSourceImpl.fi 
ndInstantiator(ComponentInstantiatorSourceImpl.java:242)
         at $ComponentInstantiatorSource_116d3a87b35.findInstantiator 
($ComponentInstantiatorSource_116d3a87b35.java)
         at  
org.apache.tapestry.internal.services.PageElementFactoryImpl.newRootComp 
onentElement(PageElementFactoryImpl.java:319)
         at $PageElementFactory_116d3a87b5d.newRootComponentElement 
($PageElementFactory_116d3a87b5d.java)
         at  
org.apache.tapestry.internal.services.PageLoaderProcessor.loadRootCompon 
ent(PageLoaderProcessor.java:405)
         at  
org.apache.tapestry.internal.services.PageLoaderProcessor.loadPage 
(PageLoaderProcessor.java:390)
         at  
org.apache.tapestry.internal.services.PageLoaderImpl.loadPage 
(PageLoaderImpl.java:59)
         at $PageLoader_116d3a87b5b.loadPage 
($PageLoader_116d3a87b5b.java)
         at  
org.apache.tapestry.internal.services.PagePoolImpl.checkout 
(PagePoolImpl.java:70)
         at $PagePool_116d3a87b5a.checkout($PagePool_116d3a87b5a.java)
         at  
org.apache.tapestry.internal.services.RequestPageCacheImpl.get 
(RequestPageCacheImpl.java:44)
         at $RequestPageCache_116d3a87b59.get 
($RequestPageCache_116d3a87b59.java)
         at $RequestPageCache_116d3a87b31.get 
($RequestPageCache_116d3a87b31.java)
         at  
org.apache.tapestry.internal.services.PageRenderRequestHandlerImpl.handl 
e(PageRenderRequestHandlerImpl.java:55)
         at $PageRenderRequestHandler_116d3a87b53.handle 
($PageRenderRequestHandler_116d3a87b53.java)
         at  
org.apache.tapestry.internal.services.PageRenderDispatcher.dispatch 
(PageRenderDispatcher.java:72)
         at $Dispatcher_116d3a87b56.dispatch 
($Dispatcher_116d3a87b56.java)
         at $Dispatcher_116d3a87b49.dispatch 
($Dispatcher_116d3a87b49.java)
         at org.apache.tapestry.services.TapestryModule$12.service 
(TapestryModule.java:1066)
         at my.package.web.services.AppModule$2.service 
(AppModule.java:74)
         at $RequestFilter_116d3a87b48.service 
($RequestFilter_116d3a87b48.java)
         at $RequestHandler_116d3a87b4a.service 
($RequestHandler_116d3a87b4a.java)
         at my.package.web.services.AppModule$1.service 
(AppModule.java:36)
         at $RequestFilter_116d3a87b47.service 
($RequestFilter_116d3a87b47.java)
         at $RequestHandler_116d3a87b4a.service 
($RequestHandler_116d3a87b4a.java)
         at  
org.apache.tapestry.internal.services.LocalizationFilter.service 
(LocalizationFilter.java:43)
         at $RequestHandler_116d3a87b4a.service 
($RequestHandler_116d3a87b4a.java)
         at org.apache.tapestry.services.TapestryModule$2.service 
(TapestryModule.java:657)
         at $RequestHandler_116d3a87b4a.service 
($RequestHandler_116d3a87b4a.java)
         at  
org.apache.tapestry.internal.services.StaticFilesFilter.service 
(StaticFilesFilter.java:63)
         at $RequestHandler_116d3a87b4a.service 
($RequestHandler_116d3a87b4a.java)
         at  
org.apache.tapestry.internal.services.CheckForUpdatesFilter$2.invoke 
(CheckForUpdatesFilter.java:97)
         at  
org.apache.tapestry.internal.services.CheckForUpdatesFilter$2.invoke 
(CheckForUpdatesFilter.java:88)
         at  
org.apache.tapestry.ioc.internal.util.ConcurrentBarrier.withRead 
(ConcurrentBarrier.java:77)
         at  
org.apache.tapestry.internal.services.CheckForUpdatesFilter.service 
(CheckForUpdatesFilter.java:110)
         at $RequestHandler_116d3a87b4a.service 
($RequestHandler_116d3a87b4a.java)
         at $RequestHandler_116d3a87b41.service 
($RequestHandler_116d3a87b41.java)
         at org.apache.tapestry.services.TapestryModule$11.service 
(TapestryModule.java:1044)
         at $HttpServletRequestHandler_116d3a87b40.service 
($HttpServletRequestHandler_116d3a87b40.java)
         at org.apache.tapestry.TapestryFilter.doFilter 
(TapestryFilter.java:135)
         at  
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter 
(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter 
(ApplicationFilterChain.java:173)
         at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter 
(ReplyHeaderFilter.java:96)
         at  
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter 
(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter 
(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke 
(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke 
(StandardContextValve.java:178)
         at  
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke 
(SecurityAssociationValve.java:175)
         at org.jboss.web.tomcat.security.JaccContextValve.invoke 
(JaccContextValve.java:74)
         at org.apache.catalina.core.StandardHostValve.invoke 
(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke 
(ErrorReportValve.java:105)
         at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke 
(CachedConnectionValve.java:156)
         at org.apache.catalina.core.StandardEngineValve.invoke 
(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service 
(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process 
(Http11Processor.java:869)
         at org.apache.coyote.http11.Http11BaseProtocol 
$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket 
(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run 
(MasterSlaveWorkerThread.java:112)
         at java.lang.Thread.run(Thread.java:613)
Caused by: java.lang.VerifyError: (class: my/package/web/pages/Intez,  
method: onSubmit signature: ()Ljava/lang/Object;) Illegal constant  
pool index
         at java.lang.Class.getDeclaredConstructors0(Native Method)
         at java.lang.Class.privateGetDeclaredConstructors(Class.java: 
2328)
         at java.lang.Class.getConstructors(Class.java:1446)
         at  
org.apache.tapestry.internal.services.ReflectiveInstantiator.findConstru 
ctor(ReflectiveInstantiator.java:65)
         at  
org.apache.tapestry.internal.services.ReflectiveInstantiator.<init> 
(ReflectiveInstantiator.java:53)
         at  
org.apache.tapestry.internal.services.InternalClassTransformationImpl.cr 
eateInstantiator(InternalClassTransformationImpl.java:1227)
         at  
org.apache.tapestry.internal.services.ComponentClassTransformerImpl.crea 
teInstantiator(ComponentClassTransformerImpl.java:157)
         ... 60 more

Any ideas?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: CustomFilter

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
you can look at following thread: 
http://www.nabble.com/T5-3A--27wrapping-27-hibernate-DAOs-as-services-to13462680.html#a13466570

it will explain roughly how tapestry-hibernate works... quite elegant

per thread a new session object is created and a transaction is
started. when the thread finishes commit is invoked 
(see HibernateSessionManagerImpl and HibernateModule).

g,
kris




"Michael Bernagou" <bl...@gmail.com> 
13.12.2007 14:01
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
"Tapestry users" <us...@tapestry.apache.org>
Kopie

Thema
Re: CustomFilter






Yes exactly. I want to put the management of session lifecycle and
transaction and commit in a filter.
I don't want to use the Tapestry-hibernate right now since I'm new in
Hibernate and want to integrate it by myself first but ok, I'm going to
follow your clue and take a look at the source of RequestFilter ;)

2007/12/13, Kristian Marinkovic <kr...@porsche.co.at>:
>
> hi michael,
>
> are you trying to implement OpenSessionInView by yourself?
> tapestry-hibernate integration does it by default... you can take
> a look at the source to see where you can apply filter the tapestry
> way :) (see RequestFilter interface in Tapestry for example)
>
> g,
> kris
>
>
>
>
> "Michael Bernagou" <bl...@gmail.com>
> 12.12.2007 13:59
> Bitte antworten an
> "Tapestry users" <us...@tapestry.apache.org>
>
>
> An
> "Tapestry users" <us...@tapestry.apache.org>
> Kopie
>
> Thema
> Re: CustomFilter
>
>
>
>
>
>
> In fact, I just noticed when I added the tapestry-core-5.0.6.jar in
> [tomcat]/common/lib I still have an error but NOT on the same class.
> So before it was on :
>
> java.lang.NoClassDefFoundError: org/apache/tapestry/TapestryFilter
>
> After put the tapestry-core jar in the lib of Tomcat :
>
> java.lang.NoClassDefFoundError:
> org/apache/tapestry/ioc/services/SymbolProvider
>
> So I added the tapestry-ioc jar and now I have this one :
>
> java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
>
> I imagine I could put all the lib at the server side, BUT, it's not how 
it
> should work!!
>
> It seems the ClassLoader didn't load all the libs when apply the filter,
> so
> how to force the loading? Why TapestryFilter doesn't have the same 
problem
> than my CustomFilter??
>
> 2007/12/12, Michael Bernagou <bl...@gmail.com>:
> >
> > Hum, any idea?
> >
> > 2007/12/11, Michael Bernagou <bl...@gmail.com>:
> > >
> > > The error is generated by this line offcourse :
> > > private TapestryFilter tapestryFilter = new TapestryFilter();
> > >
> > > Still doesn't know why...
> > >
> > > 2007/12/11, Michael Bernagou < blackwings.ml@gmail.com>:
> > > >
> > > > 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.StandardContextfilterStart
> > > > 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
> > >
> > >
> > >
> > >
> > > --
> > > Michael Bernagou
> > > Java Developper
> >
> >
> >
> >
> > --
> > Michael Bernagou
> > Java Developper
>
>
>
>
> --
> Michael Bernagou
> Java Developper
>
>


-- 
Michael Bernagou
Java Developper


Re: CustomFilter

Posted by Michael Bernagou <bl...@gmail.com>.
Yes exactly. I want to put the management of session lifecycle and
transaction and commit in a filter.
I don't want to use the Tapestry-hibernate right now since I'm new in
Hibernate and want to integrate it by myself first but ok, I'm going to
follow your clue and take a look at the source of RequestFilter ;)

2007/12/13, Kristian Marinkovic <kr...@porsche.co.at>:
>
> hi michael,
>
> are you trying to implement OpenSessionInView by yourself?
> tapestry-hibernate integration does it by default... you can take
> a look at the source to see where you can apply filter the tapestry
> way :) (see RequestFilter interface in Tapestry for example)
>
> g,
> kris
>
>
>
>
> "Michael Bernagou" <bl...@gmail.com>
> 12.12.2007 13:59
> Bitte antworten an
> "Tapestry users" <us...@tapestry.apache.org>
>
>
> An
> "Tapestry users" <us...@tapestry.apache.org>
> Kopie
>
> Thema
> Re: CustomFilter
>
>
>
>
>
>
> In fact, I just noticed when I added the tapestry-core-5.0.6.jar in
> [tomcat]/common/lib I still have an error but NOT on the same class.
> So before it was on :
>
> java.lang.NoClassDefFoundError: org/apache/tapestry/TapestryFilter
>
> After put the tapestry-core jar in the lib of Tomcat :
>
> java.lang.NoClassDefFoundError:
> org/apache/tapestry/ioc/services/SymbolProvider
>
> So I added the tapestry-ioc jar and now I have this one :
>
> java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
>
> I imagine I could put all the lib at the server side, BUT, it's not how it
> should work!!
>
> It seems the ClassLoader didn't load all the libs when apply the filter,
> so
> how to force the loading? Why TapestryFilter doesn't have the same problem
> than my CustomFilter??
>
> 2007/12/12, Michael Bernagou <bl...@gmail.com>:
> >
> > Hum, any idea?
> >
> > 2007/12/11, Michael Bernagou <bl...@gmail.com>:
> > >
> > > The error is generated by this line offcourse :
> > > private TapestryFilter tapestryFilter = new TapestryFilter();
> > >
> > > Still doesn't know why...
> > >
> > > 2007/12/11, Michael Bernagou < blackwings.ml@gmail.com>:
> > > >
> > > > 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.StandardContextfilterStart
> > > > 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
> > >
> > >
> > >
> > >
> > > --
> > > Michael Bernagou
> > > Java Developper
> >
> >
> >
> >
> > --
> > Michael Bernagou
> > Java Developper
>
>
>
>
> --
> Michael Bernagou
> Java Developper
>
>


-- 
Michael Bernagou
Java Developper

Re: CustomFilter

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
hi michael,

are you trying to implement OpenSessionInView by yourself?
tapestry-hibernate integration does it by default... you can take
a look at the source to see where you can apply filter the tapestry
way :) (see RequestFilter interface in Tapestry for example)

g,
kris




"Michael Bernagou" <bl...@gmail.com> 
12.12.2007 13:59
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
"Tapestry users" <us...@tapestry.apache.org>
Kopie

Thema
Re: CustomFilter






In fact, I just noticed when I added the tapestry-core-5.0.6.jar in
[tomcat]/common/lib I still have an error but NOT on the same class.
So before it was on :

java.lang.NoClassDefFoundError: org/apache/tapestry/TapestryFilter

After put the tapestry-core jar in the lib of Tomcat :

java.lang.NoClassDefFoundError:
org/apache/tapestry/ioc/services/SymbolProvider

So I added the tapestry-ioc jar and now I have this one :

java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory

I imagine I could put all the lib at the server side, BUT, it's not how it
should work!!

It seems the ClassLoader didn't load all the libs when apply the filter, 
so
how to force the loading? Why TapestryFilter doesn't have the same problem
than my CustomFilter??

2007/12/12, Michael Bernagou <bl...@gmail.com>:
>
> Hum, any idea?
>
> 2007/12/11, Michael Bernagou <bl...@gmail.com>:
> >
> > The error is generated by this line offcourse :
> > private TapestryFilter tapestryFilter = new TapestryFilter();
> >
> > Still doesn't know why...
> >
> > 2007/12/11, Michael Bernagou < blackwings.ml@gmail.com>:
> > >
> > > 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.StandardContextfilterStart
> > > 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
> >
> >
> >
> >
> > --
> > Michael Bernagou
> > Java Developper
>
>
>
>
> --
> Michael Bernagou
> Java Developper




-- 
Michael Bernagou
Java Developper


Re: CustomFilter

Posted by Michael Bernagou <bl...@gmail.com>.
In fact, I just noticed when I added the tapestry-core-5.0.6.jar in
[tomcat]/common/lib I still have an error but NOT on the same class.
So before it was on :

java.lang.NoClassDefFoundError: org/apache/tapestry/TapestryFilter

After put the tapestry-core jar in the lib of Tomcat :

java.lang.NoClassDefFoundError:
org/apache/tapestry/ioc/services/SymbolProvider

So I added the tapestry-ioc jar and now I have this one :

java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory

I imagine I could put all the lib at the server side, BUT, it's not how it
should work!!

It seems the ClassLoader didn't load all the libs when apply the filter, so
how to force the loading? Why TapestryFilter doesn't have the same problem
than my CustomFilter??

2007/12/12, Michael Bernagou <bl...@gmail.com>:
>
> Hum, any idea?
>
> 2007/12/11, Michael Bernagou <bl...@gmail.com>:
> >
> > The error is generated by this line offcourse :
> > private TapestryFilter tapestryFilter = new TapestryFilter();
> >
> > Still doesn't know why...
> >
> > 2007/12/11, Michael Bernagou < blackwings.ml@gmail.com>:
> > >
> > > 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.StandardContextfilterStart
> > > 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
> >
> >
> >
> >
> > --
> > Michael Bernagou
> > Java Developper
>
>
>
>
> --
> Michael Bernagou
> Java Developper




-- 
Michael Bernagou
Java Developper

Re: CustomFilter

Posted by Michael Bernagou <bl...@gmail.com>.
Hum, any idea?

2007/12/11, Michael Bernagou <bl...@gmail.com>:
>
> The error is generated by this line offcourse :
> private TapestryFilter tapestryFilter = new TapestryFilter();
>
> Still doesn't know why...
>
> 2007/12/11, Michael Bernagou <bl...@gmail.com>:
> >
> > 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.StandardContextfilterStart
> > 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
>
>
>
>
> --
> Michael Bernagou
> Java Developper




-- 
Michael Bernagou
Java Developper

Re: CustomFilter

Posted by Michael Bernagou <bl...@gmail.com>.
The error is generated by this line offcourse :
private TapestryFilter tapestryFilter = new TapestryFilter();

Still doesn't know why...

2007/12/11, Michael Bernagou <bl...@gmail.com>:
>
> 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




-- 
Michael Bernagou
Java Developper

Re: CustomFilter

Posted by Matt Brock <br...@gmail.com>.
What version of Tapestry?
-- 
View this message in context: http://www.nabble.com/CustomFilter-tp14276880p14357185.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org