You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Hamed Iravanchi <ir...@gmail.com> on 2011/06/25 15:22:14 UTC

PostConstruct annotation not working on Tomcat 7

Hi,

I was trying to port my application to Tomcat 7, where I found that
@PostConstruct annotations fail to work silently.
The annotated beans are recognized alright (@ManagedBean works). But
postConstruct methods are not invoked at all.

I've tried it on the latest Tomcat 7 x64 version (7.0.16), and I've changed
my web.xml file to servlet spec 3.0.
MyFaces core version: tried both 2.0.5 and 2.0.7.


Is this a bug, or there's some configuration that I'm missing?!

-Hamed

Re: PostConstruct annotation not working on Tomcat 7

Posted by Gerhard Petracek <ge...@gmail.com>.
short addition:

matt was talking about:
mvn archetype:generate -DarchetypeCatalog=http://myfaces.apache.org

regards,
gerhard

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces


2011/6/25 Matt Benson <gu...@gmail.com>

> On Sat, Jun 25, 2011 at 9:58 AM, Leonardo Uribe <lu...@gmail.com> wrote:
> > Hi
> >
> > Tomcat 7 should work without problem. It has been already tested on the
> > past.
> >
> > The first thing you can do is try add this web config param:
> >
> >  <context-param>
> >
> >
> <param-name>org.apache.myfaces.config.annotation.LifecycleProvider</param-name>
> >
> >
> <param-value>org.apache.myfaces.config.annotation.Tomcat7AnnotationLifecycleProvider</param-value>
> >  </context-param>
> >
> > That force tomcat 7 lifecycle provider to be used. If that does not work
> > please create an issue and attach an example of your configuration, so we
> > can reproduce the problem and check if it is a bug or not.
>
> Or, better yet, use one of the maven-archetypes provided by myfaces to
> generate the demonstration project yourself!  :)
>
> Matt
>
> >
> > regards,
> >
> > Leonardo Uribe
> >
> > 2011/6/25 Hamed Iravanchi <ir...@gmail.com>
> >
> >> Hi,
> >>
> >> I was trying to port my application to Tomcat 7, where I found that
> >> @PostConstruct annotations fail to work silently.
> >> The annotated beans are recognized alright (@ManagedBean works). But
> >> postConstruct methods are not invoked at all.
> >>
> >> I've tried it on the latest Tomcat 7 x64 version (7.0.16), and I've
> changed
> >> my web.xml file to servlet spec 3.0.
> >> MyFaces core version: tried both 2.0.5 and 2.0.7.
> >>
> >>
> >> Is this a bug, or there's some configuration that I'm missing?!
> >>
> >> -Hamed
> >>
> >
>

Re: PostConstruct annotation not working on Tomcat 7

Posted by Matt Benson <gu...@gmail.com>.
On Sat, Jun 25, 2011 at 9:58 AM, Leonardo Uribe <lu...@gmail.com> wrote:
> Hi
>
> Tomcat 7 should work without problem. It has been already tested on the
> past.
>
> The first thing you can do is try add this web config param:
>
>  <context-param>
>
> <param-name>org.apache.myfaces.config.annotation.LifecycleProvider</param-name>
>
> <param-value>org.apache.myfaces.config.annotation.Tomcat7AnnotationLifecycleProvider</param-value>
>  </context-param>
>
> That force tomcat 7 lifecycle provider to be used. If that does not work
> please create an issue and attach an example of your configuration, so we
> can reproduce the problem and check if it is a bug or not.

Or, better yet, use one of the maven-archetypes provided by myfaces to
generate the demonstration project yourself!  :)

Matt

>
> regards,
>
> Leonardo Uribe
>
> 2011/6/25 Hamed Iravanchi <ir...@gmail.com>
>
>> Hi,
>>
>> I was trying to port my application to Tomcat 7, where I found that
>> @PostConstruct annotations fail to work silently.
>> The annotated beans are recognized alright (@ManagedBean works). But
>> postConstruct methods are not invoked at all.
>>
>> I've tried it on the latest Tomcat 7 x64 version (7.0.16), and I've changed
>> my web.xml file to servlet spec 3.0.
>> MyFaces core version: tried both 2.0.5 and 2.0.7.
>>
>>
>> Is this a bug, or there's some configuration that I'm missing?!
>>
>> -Hamed
>>
>

Re: PostConstruct annotation not working on Tomcat 7

Posted by Leonardo Uribe <lu...@gmail.com>.
Hi

Tomcat 7 should work without problem. It has been already tested on the
past.

The first thing you can do is try add this web config param:

  <context-param>

<param-name>org.apache.myfaces.config.annotation.LifecycleProvider</param-name>

<param-value>org.apache.myfaces.config.annotation.Tomcat7AnnotationLifecycleProvider</param-value>
  </context-param>

That force tomcat 7 lifecycle provider to be used. If that does not work
please create an issue and attach an example of your configuration, so we
can reproduce the problem and check if it is a bug or not.

regards,

Leonardo Uribe

2011/6/25 Hamed Iravanchi <ir...@gmail.com>

> Hi,
>
> I was trying to port my application to Tomcat 7, where I found that
> @PostConstruct annotations fail to work silently.
> The annotated beans are recognized alright (@ManagedBean works). But
> postConstruct methods are not invoked at all.
>
> I've tried it on the latest Tomcat 7 x64 version (7.0.16), and I've changed
> my web.xml file to servlet spec 3.0.
> MyFaces core version: tried both 2.0.5 and 2.0.7.
>
>
> Is this a bug, or there's some configuration that I'm missing?!
>
> -Hamed
>