Re: java.lang.IllegalStateException: Must be called before the start element is closed (attribute 'id')

2015-11-20 Thread l.pe...@senat.fr

On 19/11/2015 11:01, l.pe...@senat.fr wrote:

On 18/11/2015 17:53, l.pe...@senat.fr wrote:

On 17/11/2015 13:11, l.pe...@senat.fr wrote:

On 17/11/2015 01:21, Howard W. Smith, Jr. wrote:
On Mon, Nov 16, 2015 at 2:59 PM, l.pe...@senat.fr 
 wrote:


  java.lang.IllegalStateException: Must be called before the start 
element

is closed (attribute 'id')
 at
org.apache.myfaces.shared.renderkit.html.HtmlResponseWriterImpl.writeAttribute(HtmlResponseWriterImpl.java:816) 




Searched google and found the following:

http://myfaces.apache.org/shared11/myfaces-shared-core/xref/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.html#318 



Maybe, you can start there. Seems as though you id="..." on one of 
your

components may need to be fixed.

Thanks for the suggestion, but it is alas not that simple.


I think I found what causes the bug...

I mentioned that I use :

PrimeFaces 5.3.1
MyFaces 2.2.8
OpenWebBeans 1.6.2


I forgot to mention that I also use :

omnifaces 1.10


I also noticed that the bug happens when :
* an ajax request is triggered
* the session is expired (for some reason I have yet to found, but it 
is another problem)


The access to the ajax requested page is controlled by the container 
with a  declaration in the webapp web.xml file.


In that case

OmniPartialViewContext.java#startDocument performs a redirect
https://github.com/omnifaces/omnifaces/blob/master/src/main/java/org/omnifaces/context/OmniPartialViewContext.java#L275 



and so, an opened document with an active element is *not* the 
current sate.


When returning from this function, up to
org.apache.myfaces.context.servlet.PartialViewContextImpl.processPartialRendering#471 



there is just after, line 473 :

writer.writeAttribute("id", 
viewRoot.getContainerClientId(_facesContext),"id");


IMHO, MyFaces is right to expect to have an opened document at this 
point... So I will see with BalusC if we can imagine a patch to 
omnifaces.

The newer 1.1x version, the 1.11, is not different on this point.

For the record and people who might follow this thread...
I posted a question on this topic on stackoverflow : 
http://stackoverflow.com/questions/33786117/bug-with-omnifaces-1-10-when-omnipartialviewcontextstartdocument-performs-trans
This is fixed in omnifaces 2.2-SNAPSHOT and will be available in 
omnifaces 1.12.


https://github.com/omnifaces/omnifaces/issues/183#issuecomment-158347582

Ludovic



|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: java.lang.IllegalStateException: Must be called before the start element is closed (attribute 'id')

2015-11-19 Thread l.pe...@senat.fr

On 18/11/2015 17:53, l.pe...@senat.fr wrote:

On 17/11/2015 13:11, l.pe...@senat.fr wrote:

On 17/11/2015 01:21, Howard W. Smith, Jr. wrote:
On Mon, Nov 16, 2015 at 2:59 PM, l.pe...@senat.fr  
wrote:


  java.lang.IllegalStateException: Must be called before the start 
element

is closed (attribute 'id')
 at
org.apache.myfaces.shared.renderkit.html.HtmlResponseWriterImpl.writeAttribute(HtmlResponseWriterImpl.java:816) 




Searched google and found the following:

http://myfaces.apache.org/shared11/myfaces-shared-core/xref/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.html#318 



Maybe, you can start there. Seems as though you id="..." on one of your
components may need to be fixed.

Thanks for the suggestion, but it is alas not that simple.


I think I found what causes the bug...

I mentioned that I use :

PrimeFaces 5.3.1
MyFaces 2.2.8
OpenWebBeans 1.6.2


I forgot to mention that I also use :

omnifaces 1.10


I also noticed that the bug happens when :
* an ajax request is triggered
* the session is expired (for some reason I have yet to found, but it 
is another problem)


The access to the ajax requested page is controlled by the container 
with a  declaration in the webapp web.xml file.


In that case

OmniPartialViewContext.java#startDocument performs a redirect
https://github.com/omnifaces/omnifaces/blob/master/src/main/java/org/omnifaces/context/OmniPartialViewContext.java#L275 



and so, an opened document with an active element is *not* the current 
sate.


When returning from this function, up to
org.apache.myfaces.context.servlet.PartialViewContextImpl.processPartialRendering#471 



there is just after, line 473 :

writer.writeAttribute("id", 
viewRoot.getContainerClientId(_facesContext),"id");


IMHO, MyFaces is right to expect to have an opened document at this 
point... So I will see with BalusC if we can imagine a patch to 
omnifaces.

The newer 1.1x version, the 1.11, is not different on this point.

For the record and people who might follow this thread...
I posted a question on this topic on stackoverflow : 
http://stackoverflow.com/questions/33786117/bug-with-omnifaces-1-10-when-omnipartialviewcontextstartdocument-performs-trans


Regards,

Ludovic

|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: java.lang.IllegalStateException: Must be called before the start element is closed (attribute 'id')

2015-11-18 Thread l.pe...@senat.fr

On 17/11/2015 13:11, l.pe...@senat.fr wrote:

On 17/11/2015 01:21, Howard W. Smith, Jr. wrote:
On Mon, Nov 16, 2015 at 2:59 PM, l.pe...@senat.fr  
wrote:


  java.lang.IllegalStateException: Must be called before the start 
element

is closed (attribute 'id')
 at
org.apache.myfaces.shared.renderkit.html.HtmlResponseWriterImpl.writeAttribute(HtmlResponseWriterImpl.java:816) 




Searched google and found the following:

http://myfaces.apache.org/shared11/myfaces-shared-core/xref/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.html#318 



Maybe, you can start there. Seems as though you id="..." on one of your
components may need to be fixed.

Thanks for the suggestion, but it is alas not that simple.


I think I found what causes the bug...

I mentioned that I use :

PrimeFaces 5.3.1
MyFaces 2.2.8
OpenWebBeans 1.6.2


I forgot to mention that I also use :

omnifaces 1.10


I also noticed that the bug happens when :
* an ajax request is triggered
* the session is expired (for some reason I have yet to found, but it is 
another problem)


The access to the ajax requested page is controlled by the container 
with a  declaration in the webapp web.xml file.


In that case

OmniPartialViewContext.java#startDocument performs a redirect
https://github.com/omnifaces/omnifaces/blob/master/src/main/java/org/omnifaces/context/OmniPartialViewContext.java#L275

and so, an opened document with an active element is *not* the current sate.

When returning from this function, up to
org.apache.myfaces.context.servlet.PartialViewContextImpl.processPartialRendering#471

there is just after, line 473 :

writer.writeAttribute("id", 
viewRoot.getContainerClientId(_facesContext),"id");


IMHO, MyFaces is right to expect to have an opened document at this 
point... So I will see with BalusC if we can imagine a patch to omnifaces.

The newer 1.1x version, the 1.11, is not different on this point.

Thanks,

Ludovic

|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



Re: java.lang.IllegalStateException: Must be called before the start element is closed (attribute 'id')

2015-11-17 Thread l.pe...@senat.fr

On 17/11/2015 01:21, Howard W. Smith, Jr. wrote:

On Mon, Nov 16, 2015 at 2:59 PM, l.pe...@senat.fr  wrote:


  java.lang.IllegalStateException: Must be called before the start element
is closed (attribute 'id')
 at
org.apache.myfaces.shared.renderkit.html.HtmlResponseWriterImpl.writeAttribute(HtmlResponseWriterImpl.java:816)


Searched google and found the following:

http://myfaces.apache.org/shared11/myfaces-shared-core/xref/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.html#318

Maybe, you can start there. Seems as though you id="..." on one of your
components may need to be fixed.

Thanks for the suggestion, but it is alas not that simple.

As far as I understand...
In response to an AJAX request, 
PartialViewContextImpl#processPartialRendering is called.


Lines 468 and following is :

String currentEncoding = writer.getCharacterEncoding();
writer.writePreamble("(currentEncoding == null ? "UTF-8" : currentEncoding) 
+"\"?>");

writer.startDocument();

writer.writeAttribute("id", 
viewRoot.getContainerClientId(_facesContext),"id");


The exception is triggered when the attribute is set. An element is 
opened (and, as far as I understand, not closed) by writer.startDocument();


If ones goes up in the stack, and take a look at 
org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1891) 
https://myfaces.apache.org/core22/myfaces-impl/xref/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.html#1891 
, one can read
lots of comments which makes me think that things are not simple and 
that there might be side effects in some complex cases.



I see that I forgot to indicate the versions I am using...

PrimeFaces 5.3.1
MyFaces 2.2.8
OpenWebBeans 1.6.2

All this running on Tomcat 8.0.22 (in dev) or 8.0.28 (in prod).

Ludovic

|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



java.lang.IllegalStateException: Must be called before the start element is closed (attribute 'id')

2015-11-16 Thread l.pe...@senat.fr

Dear all,

I randomly get the following exception in one of my apps :

16-Nov-2015 16:36:35.980 SEVERE [http-apr-8444-exec-10] 
org.omnifaces.exceptionhandler.FullAjaxExceptionHandler.logException 
FullAjaxExceptionHandler: An exception occurred during rendering JSF 
ajax response. Error page '/error.xhtml' will be shown.
 java.lang.IllegalStateException: Must be called before the start 
element is closed (attribute 'id')
at 
org.apache.myfaces.shared.renderkit.html.HtmlResponseWriterImpl.writeAttribute(HtmlResponseWriterImpl.java:816)
at 
javax.faces.context.ResponseWriterWrapper.writeAttribute(ResponseWriterWrapper.java:109)
at 
org.apache.myfaces.context.PartialResponseWriterImpl.writeAttribute(PartialResponseWriterImpl.java:407)
at 
javax.faces.context.ResponseWriterWrapper.writeAttribute(ResponseWriterWrapper.java:109)
at 
javax.faces.context.ResponseWriterWrapper.writeAttribute(ResponseWriterWrapper.java:109)
at 
org.apache.myfaces.context.servlet.PartialViewContextImpl.processPartialRendering(PartialViewContextImpl.java:473)
at 
org.apache.myfaces.context.servlet.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:415)
at 
org.primefaces.context.PrimePartialViewContext.processPartial(PrimePartialViewContext.java:60)
at 
javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:85)
at 
javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:516)
at 
javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:541)
at 
org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1891)
at 
org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:313)
at 
javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:58)
at 
javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:58)
at 
javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:58)
at 
javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:58)
at 
javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:58)
at 
org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:116)
at 
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:267)
at 
org.apache.deltaspike.jsf.impl.listener.request.DeltaSpikeLifecycleWrapper.render(DeltaSpikeLifecycleWrapper.java:111)
at 
javax.faces.lifecycle.LifecycleWrapper.render(LifecycleWrapper.java:31)
at 
org.apache.deltaspike.jsf.impl.listener.request.JsfClientWindowAwareLifecycleWrapper.render(JsfClientWindowAwareLifecycleWrapper.java:160)
at 
org.apache.deltaspike.jsf.impl.listener.request.DeltaSpikeLifecycleWrapper.render(DeltaSpikeLifecycleWrapper.java:111)
at 
javax.faces.lifecycle.LifecycleWrapper.render(LifecycleWrapper.java:31)
at 
org.apache.deltaspike.jsf.impl.listener.request.JsfClientWindowAwareLifecycleWrapper.render(JsfClientWindowAwareLifecycleWrapper.java:160)

at javax.faces.webapp.FacesServlet.service(FacesServlet.java:200)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:720)
at 
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:466)
at 
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391)
at 
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)
at 
org.apache.catalina.authenticator.FormAuthenticator.forwardToLoginPage(FormAuthenticator.java:384)
at 
org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:229)
at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:577)
at 
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at 

Re: java.lang.IllegalStateException: Must be called before the start element is closed (attribute 'id')

2015-11-16 Thread Howard W. Smith, Jr.
On Mon, Nov 16, 2015 at 2:59 PM, l.pe...@senat.fr  wrote:

>  java.lang.IllegalStateException: Must be called before the start element
> is closed (attribute 'id')
> at
> org.apache.myfaces.shared.renderkit.html.HtmlResponseWriterImpl.writeAttribute(HtmlResponseWriterImpl.java:816)
>

Searched google and found the following:

http://myfaces.apache.org/shared11/myfaces-shared-core/xref/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.html#318

Maybe, you can start there. Seems as though you id="..." on one of your
components may need to be fixed.