You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Kuhn, Harald" <HK...@airplus.com> on 2008/01/28 12:29:06 UTC

[Trinidad] Configuring in trinidad-config.xml with EL-expression

Hi to all, 

in order to have all debug-relevant settings in one place (web.xml) I tried to set <debug-output> via EL.
Unfortunately this doesn't work.

I always get a NPE on the 1 request (login page) to my webapp.
Should this scenario be possible? Or, am I doing something wrong?

Thanks for your help.

Harald

web.xml:
  <context-param>
    <param-name>TRINIDAD_DEBUG_OUTPUT</param-name>
    <param-value>true</param-value>
  </context-param>

trinidad-config.xml:
  <debug-output>#{initParam.TRINIDAD_DEBUG_OUTPUT}</debug-output>

Stack-Trace:
2008-01-28 11:43:16,687   ERROR org.apache.catalina.core.ContainerBase.[Catalina].[xp-lmazf9p.lasg].[/aim].[faces]: Servlet.service() for servlet faces threw exception
java.lang.NullPointerException
	at org.apache.myfaces.trinidad.bean.FacesBeanImpl.getProperty(FacesBeanImpl.java:68)
	at org.apache.myfaces.trinidadinternal.config.ConfigParser.parseConfigFile(ConfigParser.java:138)
	at org.apache.myfaces.trinidadinternal.context.RequestContextFactoryImpl._getBean(RequestContextFactoryImpl.java:71)
	at org.apache.myfaces.trinidadinternal.context.RequestContextFactoryImpl.createContext(RequestContextFactoryImpl.java:56)
	at org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl._attachRequestContext(GlobalConfiguratorImpl.java:422)
	at org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl.beginRequest(GlobalConfiguratorImpl.java:202)
	at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:126)
	at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at com.airplus.aim.webapp.filter.AIMFilter.doFilter(AIMFilter.java:135)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:209)
	at org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:347)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Unknown Source)
2008-01-28 11:43:17,187   INFO  org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl: Apache Trinidad is running with time-stamp checking enabled. This should not be used in a production environment. See the org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION property in WEB-INF/web.xml
2008-01-28 11:43:17,609   ERROR javax.faces.webapp._ErrorPageWriter: An exception occurred
java.lang.NullPointerException
	at org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderingContext.<init>(CoreRenderingContext.java:77)
	at org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit.encodeBegin(CoreRenderKit.java:479)
	at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:166)
	at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
	at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:447)
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
	at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:424)
	at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:271)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
	at org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:209)
	at org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:347)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Unknown Source)

Additional debugging reveilled that FacesContext is null while evaluating the EL-expression.
The NPE occurs at org.apache.myfaces.trinidad.bean.FacesBeanImpl.getProperty(PropertyKey key)
  final public Object getProperty(PropertyKey key)
  {
    Object o = getLocalProperty(key);
    if (o != null)
      return o;

    // Look for a binding if and only if the key supports bindings
    if (key.getSupportsBinding())
    {
      ValueExpression expression = getValueExpression(key);
      if (expression != null)
      {
        FacesContext context = FacesContext.getCurrentInstance(); // context is null here !!!
        return expression.getValue(context.getELContext());
      }
    }

    return null;
  }


Lufthansa AirPlus Servicekarten GmbH · Hans-Böckler-Straße 7 · 63263 Neu-Isenburg · Deutschland · Geschäftsführer: Patrick W. Diemer (Vorsitz), Klaus Busch · Vorsitzender des Aufsichtsrates: Stephan Gemkow · Handelsregister: Amtsgericht Offenbach/Main, HRB 8119  



Re: [Trinidad] Configuring in trinidad-config.xml with EL-expression

Posted by Matthias Wessendorf <ma...@apache.org>.
the security was just a (wild) guess.

I see that the "uploaded-file-processor" is not designed to have EL.
The UPLOADED_FILE_PROCESSOR_KEY field in RequestContextBean class
does that by:

  static public final PropertyKey UPLOADED_FILE_PROCESSOR_KEY =
    TYPE.registerKey("uploaded-file-processor",
                     PropertyKey.CAP_NOT_BOUND);


perhaps we want the PropertyKey.CAP_NOT_BOUND for the debug-output as well.
Or... we fix it :-)

Feel free to change it to what you find correct. I totally trust you ;-)

CU!
Matthias

On Jan 31, 2008 12:56 AM, Martin Marinschek <ma...@gmail.com> wrote:
> Oh, well - this fix sounds really simple then.
>
> regards,
>
> Martin
>
>
>
> On Thu, Jan 31, 2008 at 12:38 AM, Andy Schwartz <an...@gmail.com>
> wrote:
>
> >
> > On Jan 30, 2008 5:45 PM, Martin Marinschek <ma...@gmail.com>
> wrote:
> >
> > > However, I do not buy Matthias argument that this is due to security
> reasons
> > > - if some intruder gets access to managed-beans, we are hosed anyways. I
> > > think, from a perspective servicing the user, it would be a good thing
> if
> > > the admin could enable debug-output on the fly for an
> > > application/user-session.
> >
> > Actually, looking at the code which is triggering the early evaluation
> > of the debug-output expression, from the very end of
> > ConfigParser.parseConfigFile():
> >
> >    if (_LOG.isInfo())
> >    {
> >      Object debug = bean.getProperty(RequestContextBean.DEBUG_OUTPUT_KEY);
> >      if (Boolean.TRUE.equals(debug))
> >        _LOG.info("RUNNING_IN_DEBUG_MODE",_CONFIG_FILE);
> >    }
> >
> > Perhaps the answer is to delay logging this message until a bit later
> > in the lifecycle (ie. until after the FacesContext is known to be
> > available).
> >
> > Andy
> >
>
>
>
> --
>
>
>
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
>  Professional Support for Apache MyFaces



-- 
Matthias Wessendorf

further stuff:
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
mail: matzew-at-apache-dot-org

Re: [Trinidad] Configuring in trinidad-config.xml with EL-expression

Posted by Martin Marinschek <ma...@gmail.com>.
Oh, well - this fix sounds really simple then.

regards,

Martin

On Thu, Jan 31, 2008 at 12:38 AM, Andy Schwartz <an...@gmail.com>
wrote:

> On Jan 30, 2008 5:45 PM, Martin Marinschek <ma...@gmail.com>
> wrote:
>
> > However, I do not buy Matthias argument that this is due to security
> reasons
> > - if some intruder gets access to managed-beans, we are hosed anyways. I
> > think, from a perspective servicing the user, it would be a good thing
> if
> > the admin could enable debug-output on the fly for an
> > application/user-session.
>
> Actually, looking at the code which is triggering the early evaluation
> of the debug-output expression, from the very end of
> ConfigParser.parseConfigFile():
>
>    if (_LOG.isInfo())
>    {
>      Object debug = bean.getProperty(RequestContextBean.DEBUG_OUTPUT_KEY);
>      if (Boolean.TRUE.equals(debug))
>        _LOG.info("RUNNING_IN_DEBUG_MODE",_CONFIG_FILE);
>    }
>
> Perhaps the answer is to delay logging this message until a bit later
> in the lifecycle (ie. until after the FacesContext is known to be
> available).
>
> Andy
>



-- 

http://www.irian.at

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

Professional Support for Apache MyFaces

Re: [Trinidad] Configuring in trinidad-config.xml with EL-expression

Posted by Andy Schwartz <an...@gmail.com>.
On Jan 30, 2008 5:45 PM, Martin Marinschek <ma...@gmail.com> wrote:

> However, I do not buy Matthias argument that this is due to security reasons
> - if some intruder gets access to managed-beans, we are hosed anyways. I
> think, from a perspective servicing the user, it would be a good thing if
> the admin could enable debug-output on the fly for an
> application/user-session.

Actually, looking at the code which is triggering the early evaluation
of the debug-output expression, from the very end of
ConfigParser.parseConfigFile():

    if (_LOG.isInfo())
    {
      Object debug = bean.getProperty(RequestContextBean.DEBUG_OUTPUT_KEY);
      if (Boolean.TRUE.equals(debug))
        _LOG.info("RUNNING_IN_DEBUG_MODE",_CONFIG_FILE);
    }

Perhaps the answer is to delay logging this message until a bit later
in the lifecycle (ie. until after the FacesContext is known to be
available).

Andy

Re: [Trinidad] Configuring in trinidad-config.xml with EL-expression

Posted by Martin Marinschek <ma...@gmail.com>.
Hey Andy,
>
>
> I believe you are correct - ie. the doc is not accurate.  Looking at
> RequestContextBean.java, it seems that the following properties cannot
> be EL-bound:
>
...

> I think we should mark this as not-bindable and
> update the doc accordingly.


However, I do not buy Matthias argument that this is due to security reasons
- if some intruder gets access to managed-beans, we are hosed anyways. I
think, from a perspective servicing the user, it would be a good thing if
the admin could enable debug-output on the fly for an
application/user-session.

regards,

Martin

Re: [Trinidad] Configuring in trinidad-config.xml with EL-expression

Posted by Andy Schwartz <an...@gmail.com>.
Hey Matthias -

On Jan 30, 2008 3:13 PM, Matthias Wessendorf <ma...@apache.org> wrote:
> perhaps the doc is just wrong :-)

I believe you are correct - ie. the doc is not accurate.  Looking at
RequestContextBean.java, it seems that the following properties cannot
be EL-bound:

- process-scope-lifetime
- client-validation-disabled
- uploaded-file-processor

ConfigParser.endElement() already logs a warning if any non-bindable
properties are bound.

Also note that our configuration parsing code already takes steps to
cope with the fact that the FacesContext may not yet be initialized
(see use of LazyValueExpression/LazyValueBinding).  Since the
debug-output property needs to be evaluated very early
(pre-FacesContext), I think we should mark this as not-bindable and
update the doc accordingly.

Andy

Re: [Trinidad] Configuring in trinidad-config.xml with EL-expression

Posted by Matthias Wessendorf <ma...@apache.org>.
perhaps the doc is just wrong :-)

*each* sounds not correct, but I can be wrong.

The upload-processor is a guy that (IMO) you should
specify in static plain text.

-Matthias

On Jan 30, 2008 9:06 PM, Martin Marinschek <ma...@gmail.com> wrote:
> Hi Matthias,
>
> did you see Harald's quote from the Trinidad docs? I'm including it here again:
>
> <quote>
> Apache Trinidad is configured with an trinidad-config.xml file. If you
> need an trinidad-config.xml file then it must be placed in the WEB-INF
> directory of your web application.
> This file has a very simple XML structure that relies on the JSF
> expression language (EL) for flexibility.
> **** Each configurable property can be defined either inline with a
> static, constant value, or with a JSF EL expression **** that is
> re-evaluated on each request.
> </quote>
>
> regards,
>
> Martin
>



-- 
Matthias Wessendorf

further stuff:
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
mail: matzew-at-apache-dot-org

Re: [Trinidad] Configuring in trinidad-config.xml with EL-expression

Posted by Martin Marinschek <ma...@gmail.com>.
Hi Matthias,

did you see Harald's quote from the Trinidad docs? I'm including it here again:

<quote>
Apache Trinidad is configured with an trinidad-config.xml file. If you
need an trinidad-config.xml file then it must be placed in the WEB-INF
directory of your web application.
This file has a very simple XML structure that relies on the JSF
expression language (EL) for flexibility.
**** Each configurable property can be defined either inline with a
static, constant value, or with a JSF EL expression **** that is
re-evaluated on each request.
</quote>

regards,

Martin

Re: [Trinidad] Configuring in trinidad-config.xml with EL-expression

Posted by Matthias Wessendorf <ma...@apache.org>.
Hi,

On Jan 30, 2008 11:57 AM, Martin Marinschek <ma...@gmail.com> wrote:
> Hi Harald,
>
> well, the FacesContext is only created in the FacesServlet, and
> obviously, in the filter, you are before this creation.
>
> It might be possible to patch the Trinidad-Filter to create a
> FacesContext and release it to properly evaluate these properties.

I don't think, that this is a good idea.


I think the debug-output is designed to be used static, instead of EL
(I can be wrong, but searching a little bit with google, I found only
"examples" that use it static. (due to security?))

At the same time in the code, the GlobalConfiguratorImpl also check if
there is a custom "UploadProcessor", which is usually defined static
(full qualified class-name).
Since providing the class name via EL doesn't make sense (to me), I
now think (I can be wrong), that debug-output is only settable via
static plain text, instead of EL.

> Maybe the Trinidad-Filter could also be prompted to create the
> RequestContext later on in the lifecycle.
>
> regards,
>
> Martin
>
>
> On 1/28/08, Kuhn, Harald <HK...@airplus.com> wrote:
> > Hi to all,
> >
> > in order to have all debug-relevant settings in one place (web.xml) I tried
> > to set <debug-output> via EL.
> > Unfortunately this doesn't work.
> >
> > I always get a NPE on the 1 request (login page) to my webapp.
> > Should this scenario be possible? Or, am I doing something wrong?
> >
> > Thanks for your help.
> >
> > Harald
> >
> > web.xml:
> >   <context-param>
> >     <param-name>TRINIDAD_DEBUG_OUTPUT</param-name>
> >     <param-value>true</param-value>
> >   </context-param>
> >
> > trinidad-config.xml:
> >   <debug-output>#{initParam.TRINIDAD_DEBUG_OUTPUT}</debug-output>
> >
> > Stack-Trace:
> > 2008-01-28 11:43:16,687   ERROR
> > org.apache.catalina.core.ContainerBase.[Catalina].[xp-lmazf9p.lasg].[/aim].[faces]:
> > Servlet.service() for servlet faces threw exception
> > java.lang.NullPointerException
> >       at
> > org.apache.myfaces.trinidad.bean.FacesBeanImpl.getProperty(FacesBeanImpl.java:68)
> >       at
> > org.apache.myfaces.trinidadinternal.config.ConfigParser.parseConfigFile(ConfigParser.java:138)
> >       at
> > org.apache.myfaces.trinidadinternal.context.RequestContextFactoryImpl._getBean(RequestContextFactoryImpl.java:71)
> >       at
> > org.apache.myfaces.trinidadinternal.context.RequestContextFactoryImpl.createContext(RequestContextFactoryImpl.java:56)
> >       at
> > org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl._attachRequestContext(GlobalConfiguratorImpl.java:422)
> >       at
> > org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl.beginRequest(GlobalConfiguratorImpl.java:202)
> >       at
> > org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:126)
> >       at
> > org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
> >       at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> >       at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> >       at com.airplus.aim.webapp.filter.AIMFilter.doFilter(AIMFilter.java:135)
> >       at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> >       at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> >       at
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
> >       at
> > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
> >       at
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> >       at
> > org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:209)
> >       at
> > org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:347)
> >       at
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> >       at
> > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
> >       at
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> >       at
> > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
> >       at
> > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
> >       at
> > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
> >       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> >       at java.lang.Thread.run(Unknown Source)
> > 2008-01-28 11:43:17,187   INFO
> > org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl: Apache
> > Trinidad is running with time-stamp checking enabled. This should not be
> > used in a production environment. See the
> > org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION property in
> > WEB-INF/web.xml
> > 2008-01-28 11:43:17,609   ERROR javax.faces.webapp._ErrorPageWriter: An
> > exception occurred
> > java.lang.NullPointerException
> >       at
> > org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderingContext.<init>(CoreRenderingContext.java:77)
> >       at
> > org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit.encodeBegin(CoreRenderKit.java:479)
> >       at
> > org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:166)
> >       at
> > org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
> >       at
> > org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
> >       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
> >       at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> >       at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> >       at
> > org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
> >       at
> > org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:447)
> >       at
> > org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
> >       at
> > org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
> >       at
> > org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:424)
> >       at
> > org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:271)
> >       at
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
> >       at
> > org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:209)
> >       at
> > org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:347)
> >       at
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> >       at
> > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
> >       at
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> >       at
> > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
> >       at
> > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
> >       at
> > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
> >       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> >       at java.lang.Thread.run(Unknown Source)
> >
> > Additional debugging reveilled that FacesContext is null while evaluating
> > the EL-expression.
> > The NPE occurs at
> > org.apache.myfaces.trinidad.bean.FacesBeanImpl.getProperty(PropertyKey key)
> >   final public Object getProperty(PropertyKey key)
> >   {
> >     Object o = getLocalProperty(key);
> >     if (o != null)
> >       return o;
> >
> >     // Look for a binding if and only if the key supports bindings
> >     if (key.getSupportsBinding())
> >     {
> >       ValueExpression expression = getValueExpression(key);
> >       if (expression != null)
> >       {
> >         FacesContext context = FacesContext.getCurrentInstance(); // context
> > is null here !!!
> >         return expression.getValue(context.getELContext());
> >       }
> >     }
> >
> >     return null;
> >   }
> >
> >
> > Lufthansa AirPlus Servicekarten GmbH · Hans-Böckler-Straße 7 · 63263
> > Neu-Isenburg · Deutschland · Geschäftsführer: Patrick W. Diemer (Vorsitz),
> > Klaus Busch · Vorsitzender des Aufsichtsrates: Stephan Gemkow ·
> > Handelsregister: Amtsgericht Offenbach/Main, HRB 8119
> >
> >
> >
>
>
> --
>
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>



-- 
Matthias Wessendorf

further stuff:
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
mail: matzew-at-apache-dot-org

Re: [Trinidad] Configuring in trinidad-config.xml with EL-expression

Posted by Martin Marinschek <ma...@gmail.com>.
Hi Harald,

well, the FacesContext is only created in the FacesServlet, and
obviously, in the filter, you are before this creation.

It might be possible to patch the Trinidad-Filter to create a
FacesContext and release it to properly evaluate these properties.
Maybe the Trinidad-Filter could also be prompted to create the
RequestContext later on in the lifecycle.

regards,

Martin

On 1/28/08, Kuhn, Harald <HK...@airplus.com> wrote:
> Hi to all,
>
> in order to have all debug-relevant settings in one place (web.xml) I tried
> to set <debug-output> via EL.
> Unfortunately this doesn't work.
>
> I always get a NPE on the 1 request (login page) to my webapp.
> Should this scenario be possible? Or, am I doing something wrong?
>
> Thanks for your help.
>
> Harald
>
> web.xml:
>   <context-param>
>     <param-name>TRINIDAD_DEBUG_OUTPUT</param-name>
>     <param-value>true</param-value>
>   </context-param>
>
> trinidad-config.xml:
>   <debug-output>#{initParam.TRINIDAD_DEBUG_OUTPUT}</debug-output>
>
> Stack-Trace:
> 2008-01-28 11:43:16,687   ERROR
> org.apache.catalina.core.ContainerBase.[Catalina].[xp-lmazf9p.lasg].[/aim].[faces]:
> Servlet.service() for servlet faces threw exception
> java.lang.NullPointerException
> 	at
> org.apache.myfaces.trinidad.bean.FacesBeanImpl.getProperty(FacesBeanImpl.java:68)
> 	at
> org.apache.myfaces.trinidadinternal.config.ConfigParser.parseConfigFile(ConfigParser.java:138)
> 	at
> org.apache.myfaces.trinidadinternal.context.RequestContextFactoryImpl._getBean(RequestContextFactoryImpl.java:71)
> 	at
> org.apache.myfaces.trinidadinternal.context.RequestContextFactoryImpl.createContext(RequestContextFactoryImpl.java:56)
> 	at
> org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl._attachRequestContext(GlobalConfiguratorImpl.java:422)
> 	at
> org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl.beginRequest(GlobalConfiguratorImpl.java:202)
> 	at
> org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:126)
> 	at
> org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at com.airplus.aim.webapp.filter.AIMFilter.doFilter(AIMFilter.java:135)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
> 	at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
> 	at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> 	at
> org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:209)
> 	at
> org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:347)
> 	at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> 	at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
> 	at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> 	at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
> 	at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
> 	at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
> 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> 	at java.lang.Thread.run(Unknown Source)
> 2008-01-28 11:43:17,187   INFO
> org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl: Apache
> Trinidad is running with time-stamp checking enabled. This should not be
> used in a production environment. See the
> org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION property in
> WEB-INF/web.xml
> 2008-01-28 11:43:17,609   ERROR javax.faces.webapp._ErrorPageWriter: An
> exception occurred
> java.lang.NullPointerException
> 	at
> org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderingContext.<init>(CoreRenderingContext.java:77)
> 	at
> org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit.encodeBegin(CoreRenderKit.java:479)
> 	at
> org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:166)
> 	at
> org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
> 	at
> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
> 	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at
> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
> 	at
> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:447)
> 	at
> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
> 	at
> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
> 	at
> org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:424)
> 	at
> org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:271)
> 	at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
> 	at
> org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:209)
> 	at
> org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:347)
> 	at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> 	at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
> 	at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> 	at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
> 	at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
> 	at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
> 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> 	at java.lang.Thread.run(Unknown Source)
>
> Additional debugging reveilled that FacesContext is null while evaluating
> the EL-expression.
> The NPE occurs at
> org.apache.myfaces.trinidad.bean.FacesBeanImpl.getProperty(PropertyKey key)
>   final public Object getProperty(PropertyKey key)
>   {
>     Object o = getLocalProperty(key);
>     if (o != null)
>       return o;
>
>     // Look for a binding if and only if the key supports bindings
>     if (key.getSupportsBinding())
>     {
>       ValueExpression expression = getValueExpression(key);
>       if (expression != null)
>       {
>         FacesContext context = FacesContext.getCurrentInstance(); // context
> is null here !!!
>         return expression.getValue(context.getELContext());
>       }
>     }
>
>     return null;
>   }
>
>
> Lufthansa AirPlus Servicekarten GmbH · Hans-Böckler-Straße 7 · 63263
> Neu-Isenburg · Deutschland · Geschäftsführer: Patrick W. Diemer (Vorsitz),
> Klaus Busch · Vorsitzender des Aufsichtsrates: Stephan Gemkow ·
> Handelsregister: Amtsgericht Offenbach/Main, HRB 8119
>
>
>


-- 

http://www.irian.at

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

Professional Support for Apache MyFaces