Hi,

Thanks for prompt response. 

MyFaces currently integrates with portlets with a MyFacesGenericPortlet
which contains faces initialization code. I think this replaces some
other listener usually declared in web.xml (don't remember anymore). In
any case, why have is state serialization initialized separately from
the rest of MyFaces init code at all?

I think the listener is not being called because it's declared in a TLD
and myfaces-impl.jar is placed as a common, shared library on the
server, i.e. not attached to a particular web context.

In general, it would be a good idea to place initialization stuff in
classes that are not bound to a particular execution environment (e.g.
have the startup listener, or the portlet init method call a
"MyFacesBootstrap" class or something). It's a small refactoring task,
but it'll avoid that duplication of the init program.

If I place the initialization code in the portlet (copied over and
called handleSerialFactory from the startup listener), it works...

Best,
Bolerio

-----Original Message-----
From: Dennis Byrne [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 12, 2006 4:43 PM
To: MyFaces Discussion
Subject: Re: initialization of state serialization within a portal
environment

Hi Borislav,

I am the author of your problem, but I am not a Portlet developer.
Perhaps I can help you fix this and you can educate me more on portlets?

Why isn't StartupServletContextListener is called?

What happens if you can fire something like this as your application
starts ...

if(servletContext.getInitParameter(StateUtils.INIT_SECRET) != null ||
servletContext.getInitParameter(StateUtils.INIT_SECRET.toLowerCase()) !=
null)
            StateUtils.initSecret(servletContext);

Which version of MyFaces are you using?

If anyone has ideas as to how MyFaces can fix this, be heard here.

Dennis Byrne

>-----Original Message-----
>From: Iordanov, Borislav \(GIC\) [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, September 12, 2006 04:21 PM
>To: [email protected]
>Subject: initialization of state serialization within a portal
environment
>
>Hi,
>
> 
>
>I get this in WebSphere Portal:
>
> 
>
>Caused by: java.lang.NullPointerException: serialFactory
>
>[9/12/06 16:00:33:839 EDT] 5fd004e0 SystemErr     R       at
>org.apache.myfaces.shared_impl.util.StateUtils.getAsByteArray(StateUtil
s
>.java:174)
>
>[9/12/06 16:00:33:839 EDT] 5fd004e0 SystemErr     R       at
>org.apache.myfaces.shared_impl.util.StateUtils.construct(StateUtils.jav
a
>:150)
>
>[9/12/06 16:00:33:839 EDT] 5fd004e0 SystemErr     R       at
>org.apache.myfaces.renderkit.html.HtmlResponseStateManager.writeState(H
t
>mlResponseStateManager.java:73)
>
>[9/12/06 16:00:33:839 EDT] 5fd004e0 SystemErr     R       at
>org.apache.myfaces.application.jsp.JspStateManagerImpl.writeState(JspSt
a
>teManagerImpl.java:430)
>
>[9/12/06 16:00:33:839 EDT] 5fd004e0 SystemErr     R       at
>org.apache.myfaces.taglib.core.ViewTag.doAfterBody(ViewTag.java:145)
>
>[9/12/06 16:00:33:839 EDT] 5fd004e0 SystemErr     R       at
>org.apache.jsp._srselect._jspService(_srselect.java:942)
>
>[9/12/06 16:00:33:839 EDT] 5fd004e0 SystemErr     R       at
>com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.jav
a
>:89)
>
>[9/12/06 16:00:33:839 EDT] 5fd004e0 SystemErr     R       at
>javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>
>[9/12/06 16:00:33:839 EDT] 5fd004e0 SystemErr     R       at
>com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.servic
e
>(JspServlet.java:344)
>
>[9/12/06 16:00:33:839 EDT] 5fd004e0 SystemErr     R       at
>com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServle
t
>.java:683)
>
>[9/12/06 16:00:33:839 EDT] 5fd004e0 SystemErr     R       at
>com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:
7
>81)
>
>[9/12/06 16:00:33:839 EDT] 5fd004e0 SystemErr     R       at
>javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>
> 
>
>It's because the StartupServletContextListener is not called.
>Initialization actually happens in the portlet itself (faces-config.xml
>is parsed there etc.). Any suggestion of how to deal with this issue?
>Just copy & paste the code from StartupServletContext in my portlet?
>What would be a fix within myfaces?
>
> 
>
>Regards,
>
>Bolerio
>
>


Reply via email to