QeelwaEtech / omnifaces

Automatically exported from code.google.com/p/omnifaces
0 stars 1 forks source link

java.lang.IllegalStateException: There is no current OmniPartialViewContext instance. #89

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Example: 
https://showcase-omnifaces.rhcloud.com/showcase/components/onloadScript.xhtml
2. Use richfaces's component library and use a4j:commandButton instead of 
h:commandButton with ajax. 

What is the expected output? 
javascript alert.

What do you see instead?
Adding log from jboss 7.0.1 final:
21:30:11,187 ERROR [stderr] (http--127.0.0.1-21080-2) 
java.lang.IllegalStateException: There is no current OmniPartialViewContext 
instance.

21:30:11,188 ERROR [stderr] (http--127.0.0.1-21080-2)   at 
org.omnifaces.context.OmniPartialViewContext.getCurrentInstance(OmniPartialViewC
ontext.java:182)

21:30:11,188 ERROR [stderr] (http--127.0.0.1-21080-2)   at 
org.omnifaces.util.Ajax.oncomplete(Ajax.java:79)

21:30:11,188 ERROR [stderr] (http--127.0.0.1-21080-2)   at 
org.omnifaces.component.script.OnloadScript.processEvent(OnloadScript.java:139)

21:30:11,188 ERROR [stderr] (http--127.0.0.1-21080-2)   at 
javax.faces.event.SystemEvent.processListener(SystemEvent.java:106)

21:30:11,189 ERROR [stderr] (http--127.0.0.1-21080-2)   at 
com.sun.faces.application.ApplicationImpl.processListenersAccountingForAdds(Appl
icationImpl.java:2151)

21:30:11,189 ERROR [stderr] (http--127.0.0.1-21080-2)   at 
com.sun.faces.application.ApplicationImpl.invokeViewListenersFor(ApplicationImpl
.java:1977)

21:30:11,189 ERROR [stderr] (http--127.0.0.1-21080-2)   at 
com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:290)

21:30:11,190 ERROR [stderr] (http--127.0.0.1-21080-2)   at 
com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:245)

21:30:11,190 ERROR [stderr] (http--127.0.0.1-21080-2)   at 
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:108
)

21:30:11,190 ERROR [stderr] (http--127.0.0.1-21080-2)   at 
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)

21:30:11,190 ERROR [stderr] (http--127.0.0.1-21080-2)   at 
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)

No exception in JBoss 7.1.1 Final, but the javascript function is not called 
after ajax. 

What OmniFaces version are you using? 
1.2
What JSF impl/version are you using?

What servletcontainer impl/version are you using? 
JBoss 7.0.1 final and JBoss 7.1.1 final.

If any, what JSF component library impl/version are you using?
Richfaces, 4.2.2.Final

Please provide any additional information below.

Original issue reported on code.google.com by johny.ko...@gmail.com on 5 Nov 2012 at 4:27

GoogleCodeExporter commented 9 years ago
Too bad that this happens on RichFaces. From 
http://wiki.omnifaces.googlecode.com/hg/javadoc/1.2/org/omnifaces/context/OmniPa
rtialViewContext.html#getCurrentInstance():

> Throws: IllegalStateException - When there is no current instance of the 
OmniFaces partial view context. That can happen when the 
OmniPartialViewContextFactory is not properly registered, or when there's 
another PartialViewContext implementation which doesn't properly delegate 
through the wrapped instance.

It seems that RichFaces' partial view context doesn't use 
PartialViewContextWrapper. I will look at it.

Original comment by balusc on 5 Nov 2012 at 7:08

GoogleCodeExporter commented 9 years ago
Fixed: 
http://code.google.com/p/omnifaces/source/detail?r=5f1774e4a3030129940ed4244df44
f26564cf88b

Please give the attached snapshot with the fix a try and let me know.

Original comment by balusc on 6 Nov 2012 at 12:46

Attachments:

GoogleCodeExporter commented 9 years ago
Working. :)

Original comment by johny.ko...@gmail.com on 6 Nov 2012 at 3:42

GoogleCodeExporter commented 9 years ago
Great, thanks for testing and confirming.

Original comment by balusc on 6 Nov 2012 at 12:59