添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
I just wanted to raise a problem I am having with JSF and view scoped controllers. For some reason, I am getting very often this exception with view scoped controllers. However with the session scoped ones, they works fine!!! even the same bean. This is more like to be a problem with JSF rather than PF I guess, but if anyone here know why this is happening to me or this is only just me. Please, can anyone here shed some light on this??.
I am using PF 3.0M3 and GF 3.1.1
Thanks

Code: Select all

[#|2011-11-07T14:02:51.124+0000|WARNING|glassfish3.1.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=239;_ThreadName=Thread-2;|StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
java.lang.IllegalStateException: PWC3999: Cannot create a session after the response has been committed
	at org.apache.catalina.connector.Request.doGetSession(Request.java:2880)
	at org.apache.catalina.connector.Request.getSession(Request.java:2577)
	at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:920)
	at com.sun.faces.context.ExternalContextImpl.getSession(ExternalContextImpl.java:155)
	at com.sun.faces.renderkit.ServerSideStateHelper.writeState(ServerSideStateHelper.java:175)
	at com.sun.faces.renderkit.ResponseStateManagerImpl.writeState(ResponseStateManagerImpl.java:122)
	at com.sun.faces.application.StateManagerImpl.writeState(StateManagerImpl.java:166)
	at com.sun.faces.application.view.WriteBehindStateWriter.flushToWriter(WriteBehindStateWriter.java:225)
	at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:418)
	at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
	at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
	at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
	at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
	at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
	at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
	at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
	at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
	at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
	at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
	at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
	at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
	at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
	at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
	at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
	at java.lang.Thread.run(Thread.java:662)
			
spauny wrote:For god sake! Read this and tell me the conclusion:
viewtopic.php?f=3&t=16023
There is no information you have provided which is of any help with this problem and nor is the link you have provided at all helpful.
I have noticed this problem with non PF JSF Apps (pure JSF in fact) using View Scoped so this problem is most likely to be a Mojarra problem rather than a PF one.
The "problem" seems to be harmless enough and you may be able to avoid it by either stopping this from being logged (because the Log entries are blocking your log files needlessly) or simply have Session Scoped Bean which you call at least once to establish a Session. Either way I have not found that this Exception causes my App to become broken.
This also happens with Request Scoped beans (where nothing requires a Session Scope) too.
I am using the same GF version as you but no PF or any other JSF Framework.
PF 4.x (Elite versions), PF 5, Pf 5.1, PF 6.0
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now
As I said, the problem is gone simply switching from view to session scoped controller. What it's happening to me is that the page is partially rendered when the exception is thrown. After retrying, reloading the page, etc, eventually the page is fully rendered.
I suspect the problem could be a invocation to a bean from javascript but to be honest, I am not fully sure. This Javascript function calls a google visualization servlet but I don't understand why this problem could be linked to the JSF view/session scoped bean.

Code: Select all

<script type="text/javascript" src="http://www.google.com/jsapi"></script>
	  	<script type="text/javascript">
		  google.load('visualization', '1', {'packages':['annotatedtimeline']});
		  google.setOnLoadCallback(init);
		  // Send the query to the data source.
		  function init(parid, start, stop, clk) {
			var id = parid;
			var start = start;
			var stop = stop;
			var click = clk;
		    // Specify the data source URL.
		    var query = new google.visualization.Query('http://host:8080/graphicservice'.concat('?id=', id,'&start=', start,'&stop=', stop,'&but=', click));
		    query.send(handleQueryResponse);
		  function handleQueryResponse(response) {
		    if (response.isError()) {
		      alert('Error in query. Try a lower time-range: ' + response.getMessage() + ' ' + response.getDetailedMessage());
		      return;
		    // Draw the visualization.
		    var data = response.getDataTable();
		    var chart = new google.visualization.AnnotatedTimeLine(document.getElementById('chart_div'));
		    chart.draw(data, {displayAnnotations: true});
 		</script>

Code: Select all

<p:commandButton id="bt" value="Plot" onclick="init('${bean.parameterId}', '${bean.selectedStartDate}', '${bean.selectedStopDate}', 'true')"/>
  • ↳   PrimeFaces Theme Designer API
  • ↳   PrimeNG Theme Designer API
  • ↳   PrimeReact Theme Designer API
  • ↳   PrimeVue Theme Designer API
  • UI Kit
  • ↳   Figma
  • Add-Ons
  • ↳   PrimeFlex
  • ↳   PrimeIcons
  • PrimeUI
  • ↳   PrimeUI
  • ↳   Made with Prime
  • ↳   Spanish
  • Premium Layouts and Themes
  • ↳   Freya
  • ↳   Freya - PrimeFaces
  • ↳   Freya - PrimeNG
  • ↳   Freya - PrimeVue
  • ↳   Freya - PrimeReact
  • ↳   Rain
  • ↳   Rain - PrimeFaces
  • ↳   Diamond
  • ↳   Diamond - PrimeFaces
  • ↳   Diamond - PrimeNG
  • ↳   Diamond - PrimeVue
  • ↳   Diamond - PrimeReact
  • ↳   Pandora
  • ↳   Pandora - PrimeFaces
  • ↳   Siberia
  • ↳   Siberia - PrimeFaces
  • ↳   Mirage
  • ↳   Mirage - PrimeFaces
  • ↳   Mirage - PrimeNG
  • ↳   Prestige
  • ↳   Prestige - PrimeFaces
  • ↳   Prestige - PrimeNG
  • ↳   Prestige - PrimeVue
  • ↳   Sapphire
  • ↳   Sapphire - PrimeFaces
  • ↳   Sapphire - PrimeNG
  • ↳   Sapphire - PrimeReact
  • ↳   Sapphire - PrimeVue
  • ↳   Roma
  • ↳   Roma - PrimeFaces
  • ↳   Roma - PrimeNG
  • ↳   Roma - PrimeReact
  • ↳   Roma - PrimeVue
  • ↳   Babylon
  • ↳   Babylon - PrimeFaces
  • ↳   Babylon - PrimeNG
  • ↳   Babylon - PrimeReact
  • ↳   Babylon - PrimeVue
  • ↳   Olympia
  • ↳   Olympia - PrimeFaces
  • ↳   Olympia - PrimeNG
  • ↳   Ecuador
  • ↳   Ecuador - PrimeFaces
  • ↳   Ecuador - PrimeNG
  • ↳   Harmony
  • ↳   Harmony - PrimeFaces
  • ↳   Harmony - PrimeNG
  • ↳   California
  • ↳   California - PrimeFaces
  • ↳   California - PrimeNG
  • ↳   Serenity
  • ↳   Serenity - PrimeFaces
  • ↳   Serenity - PrimeNG
  • ↳   Serenity - PrimeReact
  • ↳   Serenity - PrimeVue
  • ↳   Avalon
  • ↳   Avalon - PrimeFaces
  • ↳   Avalon - PrimeNG
  • ↳   Avalon - PrimeReact
  • ↳   Avalon - PrimeVue
  • ↳   Apollo
  • ↳   Apollo - PrimeFaces
  • ↳   Apollo - PrimeNG
  • ↳   Apollo - PrimeReact
  • ↳   Apollo - PrimeVue
  • ↳   Manhattan
  • ↳   Manhattan - PrimeFaces
  • ↳   Manhattan - PrimeNG
  • ↳   Paradise
  • ↳   Paradise - PrimeFaces
  • ↳   Paradise - PrimeNG
  • ↳   Barcelona
  • ↳   Barcelona - PrimeFaces
  • ↳   Barcelona - PrimeNG
  • ↳   Atlantis
  • ↳   Atlantis - PrimeFaces
  • ↳   Atlantis - PrimeNG
  • ↳   Atlantis - PrimeReact
  • ↳   Atlantis - PrimeVue
  • ↳   Morpheus
  • ↳   Morpheus - PrimeFaces
  • ↳   Morpheus - PrimeNG
  • ↳   Verona
  • ↳   Verona - PrimeFaces
  • ↳   Verona - PrimeNG
  • ↳   Verona - PrimeVue
  • ↳   Poseidon
  • ↳   Poseidon - PrimeFaces
  • ↳   Poseidon - PrimeNG
  • ↳   Poseidon - PrimeVue
  • ↳   Ultima
  • ↳   Ultima - PrimeFaces
  • ↳   Ultima - PrimeNG
  • ↳   Ultima - PrimeReact
  • ↳   Ultima - PrimeVue
  • ↳   Omega
  • ↳   Omega - PrimeFaces
  • ↳   Omega - PrimeNG
  • ↳   Icarus
  • ↳   Legacy
  • ↳   Venture
  • ↳   Olympos
  • ↳   Atlas
  • ↳   Titan
  • ↳   Volt
  • ↳   Adamantium
  • ↳   Rio
  • ↳   Ronin
  • ↳   Spark
  • ↳   Sentinel
  • ↳   Modena
  •