| Author |
Message |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 02/01/2007 21:07:33
|
PatrickMadden
Joined: 21/12/2006 00:00:00
Messages: 9
Offline
|
Hi,
I've been working in a vacuum for a few weeks trying to get a Ice 1.5.1 and Seam 1.1.0 GA app working correctly.
I have big plans but I'm probably doing something a bit out of the ordinary in that I'm using Adobe/Macromedia shockwave format (FlashObject). First I tried with tabs but I've since moved on to panel stack. I have some radio buttons that the user can choose to switch out the visible panel. I'll have three panels (two will be standard, while the other is using flash). Things are working but when I switch to the flash (movie.swf) panel I have to do a "REFRESH" on the browser for the panel to render. I've searched the forums and saw something related to OnDemandRenderer and the TimeZone example. I went ahead and searched through the example (web.xml, faces-config.xml and TimeZoneBean.java).
However, now when I click on the radio button to switch the panel that contains the flash movie, I get the following error:
Code:
21:42:26,468 ERROR [PhaseListenerManager] Exception in PhaseListener RENDER_RESPONSE(6) beforePhase.
java.lang.IllegalStateException: No active application scope
at org.jboss.seam.core.Init.instance(Init.java:75)
at org.jboss.seam.jsf.TransactionalSeamPhaseListener.handleTransactionsBeforePhase(TransactionalSeamPhaseListene
r.java:25)
at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:43)
at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersBefore(PhaseListenerManager.java:70)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:373)
at com.icesoft.faces.webapp.xmlhttp.PersistentFacesState.render(PersistentFacesState.java:180)
at com.icesoft.faces.async.render.RunnableRender.run(RunnableRender.java:89)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
21:42:26,468 ERROR [D2DFaceletViewHandler] Problem in renderResponse: No Factories configured for this Application. This
happens if the faces-initialization does not work at all - make sure that you properly include all configuration settin
gs necessary for a basic faces application and that all the necessary libs are included. Also check the logging output o
f your web application and your container for any exceptions!
If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do
not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
A typical config looks like this;
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization
does not work at all - make sure that you properly include all configuration settings necessary for a basic faces applic
ation and that all the necessary libs are included. Also check the logging output of your web application and your conta
iner for any exceptions!
If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do
not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
A typical config looks like this;
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:90)
at javax.faces.component.UIComponentBase.getRenderer(UIComponentBase.java:742)
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:509)
at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:528)
at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:535)
at com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:273)
at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:149)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
at com.icesoft.faces.webapp.xmlhttp.PersistentFacesState.render(PersistentFacesState.java:180)
at com.icesoft.faces.async.render.RunnableRender.run(RunnableRender.java:89)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
I'm not sure if this is a seam issue, ice issue or my own which is most likely the case. Just looking for some pointers if possible.
Here is my faces-config.xml
Code:
<faces-config xmlns="http://java.sun.com/JSF/Configuration">
<managed-bean>
<managed-bean-name>highlight</managed-bean-name>
<managed-bean-class>com.icesoft.faces.context.effects.Highlight</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>renderManager</managed-bean-name>
<managed-bean-class>
com.icesoft.faces.async.render.RenderManager
</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>searchResults</managed-bean-name>
<managed-bean-class>com.clooster.web.ejb.session.SearchResultsBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>renderManager</property-name>
<value>#{renderManager}</value>
</managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>appContext</managed-bean-name>
<managed-bean-class>com.clooster.web.util.AppContextBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>flashMenu</managed-bean-name>
<managed-bean-class>com.clooster.web.ejb.session.FlashSearchMenuBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<application>
<message-bundle>messages</message-bundle>
<!-- view-handler>com.sun.facelets.FaceletViewHandler</view-handler -->
<view-handler>com.icesoft.faces.facelets.D2DSeamFaceletViewHandler</view-handler>
</application>
<!-- Seam transaction management -->
<lifecycle>
<phase-listener>org.jboss.seam.jsf.TransactionalSeamPhaseListener</phase-listener>
</lifecycle>
<!-- No Seam transaction management
<lifecycle>
<phase-listener>org.jboss.seam.jsf.SeamPhaseListener</phase-listener>
</lifecycle>
-->
<!-- Custom Email Validators (pvm) -->
<validator>
<validator-id>clooster.EmailValidator</validator-id>
<validator-class>com.clooster.web.validate.EmailValidator</validator-class>
</validator>
<!-- Custom ZipCode Validators (pvm) -->
<validator>
<validator-id>clooster.ZipCodeValidator</validator-id>
<validator-class>com.clooster.web.validate.ZipCodeValidator</validator-class>
</validator>
<!-- Custom Password Validators (pvm) -->
<validator>
<validator-id>clooster.PasswordValidator</validator-id>
<validator-class>com.clooster.web.validate.PasswordValidator</validator-class>
</validator>
</faces-config>
and here is my web.xml
Code:
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd">
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/navigation.xml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.application.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<!-- Seam -->
<listener>
<listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
</listener>
<!-- Propagate conversations across redirects -->
<!--
<filter>
<filter-name>Seam Redirect Filter</filter-name>
<filter-class>org.jboss.seam.servlet.SeamRedirectFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Seam Redirect Filter</filter-name>
<url-pattern>*.seam</url-pattern>
</filter-mapping>
-->
<!-- propogate seam context to servlets (pvm) addition -->
<filter>
<filter-name>Seam Servlet Filter</filter-name>
<filter-class>org.jboss.seam.servlet.SeamServletFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Seam Servlet Filter</filter-name>
<url-pattern>/servlet/*</url-pattern>
</filter-mapping>
<!-- end seam context to servlets -->
<filter>
<filter-name>Seam Exception Filter</filter-name>
<filter-class>org.jboss.seam.servlet.SeamExceptionFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Seam Exception Filter</filter-name>
<url-pattern>*.seam</url-pattern>
</filter-mapping>
<!-- End Seam -->
<!-- JSF -->
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>com.icesoft.faces.actionURLSuffix</param-name>
<param-value>.seam</param-value>
</context-param>
<context-param>
<param-name>com.icesoft.faces.synchronousUpdate</param-name>
<param-value>true</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Faces Servlet Mapping -->
<!--
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.seam</url-pattern>
</servlet-mapping>
-->
<servlet>
<servlet-name>Blocking Servlet</servlet-name>
<servlet-class>com.icesoft.faces.webapp.xmlhttp.BlockingServlet</servlet-class>
<load-on-startup> 1 </load-on-startup>
</servlet>
<servlet>
<servlet-name>Persistent Faces Servlet</servlet-name>
<servlet-class>com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>/xmlhttp/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>/xmlhttp/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>*.iface</url-pattern>
</servlet-mapping>
<!-- Blocking Servlet Mapping -->
<servlet-mapping>
<servlet-name>Blocking Servlet</servlet-name>
<url-pattern>/block/*</url-pattern>
</servlet-mapping>
<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>*.seam</url-pattern>
</servlet-mapping>
<!-- MyFaces -->
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
<!-- End MyFaces -->
<!-- Clooster -->
<listener>
<listener-class>com.clooster.web.context.CloosterWebsiteContextListener</listener-class>
</listener>
<listener>
<listener-class>com.clooster.web.context.SearchSessionListener</listener-class>
</listener>
<servlet>
<servlet-name>VerifyUser</servlet-name>
<servlet-class>
com.clooster.web.servlet.VerifyUser
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>VerifyUser</servlet-name>
<url-pattern>/servlet/VerifyUser</url-pattern>
</servlet-mapping>
<!-- End Clooster -->
<!-- JSF RI -->
<!--
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener
-->
<!-- Web Services -->
<servlet>
<servlet-name>FlashService</servlet-name>
<servlet-class>com.clooster.web.services.EJB3RemoteFlashServiceBean</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>FlashService</servlet-name>
<url-pattern>/services/FlashService</url-pattern>
</servlet-mapping>
</web-app>
Here is my backing bean:
Code:
package com.clooster.web.ejb.session;
import javax.faces.event.ValueChangeEvent;
import com.icesoft.faces.async.render.OnDemandRenderer;
import com.icesoft.faces.async.render.RenderManager;
import com.icesoft.faces.async.render.Renderable;
import com.icesoft.faces.webapp.xmlhttp.PersistentFacesState;
import com.icesoft.faces.webapp.xmlhttp.RenderingException;
public class SearchResultsBean implements Renderable
{
// currently selected panel
private String selectedPanel = "classic";
/**
* The state associated with the current user that can be used for
* server-initiated render calls.
*/
private PersistentFacesState state;
private OnDemandRenderer demandRenderer;
private RenderManager renderManager;
private String DemandRendererKey = Long.toString(System.currentTimeMillis());
public SearchResultsBean()
{
init();
}
private void init()
{
state = PersistentFacesState.getInstance();
}
/**
* The panel stack is controlled by a group of radio buttons and their state
* changes call this method to register the newly selected panel.
*
* @param event new value of event contains the new selected panel name.
*/
public void selectedPanelChanged(ValueChangeEvent event)
{
System.out.println("Entering selectedPanelChanged with event " + event);
this.selectedPanel = event.getNewValue().toString();
if (this.selectedPanel.equals("diagram"))
{
if (this.demandRenderer != null)
{
this.demandRenderer.requestRender();
}
}
}
/**
* Sets the selected panel name to the specified panel name.
*
* @param selectedPanel panel name to be set as selected.
*/
public void setSelectedPanel(String selectedPanel)
{
System.out.println("Entering setSelectedPanel with panel " + selectedPanel);
this.selectedPanel = selectedPanel;
}
/**
* Gets the selected panel name.
*
* @return currently selected panel.
*/
public String getSelectedPanel()
{
System.out.println("Entering getSelectedPanel with panel " + selectedPanel);
return selectedPanel;
}
public PersistentFacesState getState()
{
return this.state;
}
public void renderingException(RenderingException e)
{
if (this.demandRenderer != null)
{
this.demandRenderer.remove(this);
this.demandRenderer = null;
}
}
public void setRenderManager(RenderManager renderManager)
{
this.renderManager = renderManager;
this.demandRenderer = renderManager.getOnDemandRenderer(DemandRendererKey);
this.demandRenderer.add(this);
}
/**
* Gets RenderManager
*
* @return RenderManager null
*/
public RenderManager getRenderManager()
{
return this.renderManager;
}
}
If anyone has gotten this far I greatly appreciate any help that is provided!!!
Thanks,
PVM
|
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 03/01/2007 11:49:07
|
philip.breau

Joined: 08/05/2006 00:00:00
Messages: 2691
Offline
|
Hi PVM,
You shouldn't need to do AJAX Push to get this to work, so I think using the RenderManager might be leading you down the wrong path. I would try using iframes within the tabs to show the flash content. Could you post some of your JSF page?
Thanks,
Philip
|
. |
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 03/01/2007 12:13:28
|
PatrickMadden
Joined: 21/12/2006 00:00:00
Messages: 9
Offline
|
Hi Philip,
I appreciate your response. I've never dealt with iframes before. Just an FYI, in my log in backing bean, I add three java script files as follows:
Code:
JavascriptContext.includeLib("javascript/cloosterflash.js", facesContext);
JavascriptContext.includeLib("javascript/swfobject.js", facesContext);
JavascriptContext.includeLib("javascript/javascriptflashgateway.js", facesContext);
My panel stack is mainly ripped from your demo code just to test the flash and ability to go back and forth among panels.
Code:
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ice="http://www.icesoft.com/icefaces/component"
template="layout/loggedin-template.xhtml">
<ui:define name="body">
<div>
<br/>
<ice:form id="searchResultsForm" partialSubmit="true">
<ice:panelGrid styleClass="contentLayoutGridStyle" columns="1" border="0">
<ice:panelGroup styleClass="formBorderHighlight">
<ice:outputText value="Choose Your Poison" />
<!-- Panel stack selection controls -->
<ice:selectOneRadio
value="#{searchResults.selectedPanel}"
styleClass="selectOneMenu"
valueChangeListener="#{searchResults.selectedPanelChanged}"
partialSubmit="true">
<f:selectItem itemValue="classic"
itemLabel="Classic"/>
<f:selectItem itemValue="diagram"
itemLabel="Diagram"/>
<f:selectItem itemValue="grid"
itemLabel="Tabular"/>
</ice:selectOneRadio>
</ice:panelGroup>
<ice:panelGroup>
<ice:panelStack id="searchResultPanelStack" selectedPanel="#{searchResults.selectedPanel}">
<!-- Classic Panel -->
<ice:panelGroup id="classic">
<ice:outputText value="Show Classic" />
<br/>
</ice:panelGroup>
<!-- Diagram Panel -->
<ice:panelGroup id="diagram">
<head>
<script type="text/javascript">
//<![CDATA[
var flashProxy = new FlashProxy(#{search.flashProxyId}, "swf/JavaScriptFlashGateway.swf");
var so = new FlashObject("swf/GraphCanvas.swf", "GraphCanvas", "1000", "700", "8", "#ffffff");
so.addVariable("appContextURL", "#{search.externalApplicationRoot}");
so.addVariable("graphURL", "#{search.graphXMLDataURL}");
so.addVariable("scrollPaneContentURL", "#{search.scrollPaneContentURL}");
so.addVariable("lcId", "#{search.flashProxyId}");
so.addVariable("sessionID", "#{search.sessionId}");
so.addVariable("treeNavControlVisible", "#{search.treeNavigationControlVisible}");
so.addVariable("overviewControlVisible", "#{search.overviewVisible}");
so.write("searchResultsForm:diagram");
//]]>
</script>
</head>
<br/>
</ice:panelGroup>
<!-- Grid Panel -->
<ice:panelGroup id="grid">
<ice:outputText value="Show Grid" />
<br/>
</ice:panelGroup>
</ice:panelStack>
</ice:panelGroup>
</ice:panelGrid>
</ice:form>
</div>
</ui:define>
</ui:composition>
I would greatly appreciate your help as I'm stuck and if I can't get this to work will have to move back to seam standalone - really don't want to do that. I'm sure its my error.
Thanks again,
PVM
|
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 03/01/2007 12:35:19
|
philip.breau

Joined: 08/05/2006 00:00:00
Messages: 2691
Offline
|
I would try the iframe like so:
Code:
...
<!-- Diagram Panel -->
<ice:panelGroup id="diagram">
<iframe src="./swf/showFlash.html"></iframe>
</ice:panelGroup>
then place this in a normal html file ./swf/showFlash.html
Code:
<html>
<head>
<script type="text/javascript">
var flashProxy = new FlashProxy(#{search.flashProxyId}, "swf/JavaScriptFlashGateway.swf");
...
</script>
</head>
<body>
</body>
</html>
Thanks,
Philip
|
. |
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 03/01/2007 20:11:41
|
PatrickMadden
Joined: 21/12/2006 00:00:00
Messages: 9
Offline
|
Thanks Phillip, that did the trick. However, I had to jump through a few more hoops to get it to fully work. I brute force it now by generating the html file on the server for a given session and state information.
For those of you who are interested I'll post my code here.
Code:
<!-- Diagram Panel -->
<ice:panelGroup id="diagram">
<iframe src="#{search.flashHtmlDataFileName}" width="1200" height="700" marginwidth="10" marginheight="10">
</iframe>
<br/>
</ice:panelGroup>
When I make the backing bean called referenced by:
#{search.flashHtmlDataFileName}
I actually generate a HTML file in a htmldata directory. This is because when I did it the exact way you specified none of my variables were expanded. I tried putting them into the iframe with a .XHTML file and it worked but then I was sort of back to square one and the connection to the server was broken.
Long story short, I'm up and running and now I can fully switch panels without losing control over the page and without having to hit the refresh button.
Just for completeness I'll post my generated html page if anyone else is trying to use flash with icefaces and tabs or stacking panels.
Code:
<html>
<head>
<script type="text/javascript" src="../javascript/swfobject.js"></script>
<script type="text/javascript" src="../javascript/javascriptflashgateway.js"></script>
<script type="text/javascript" src="../javascript/cloosterflash.js"></script>
</head>
<body>
<div id="flashcontent">
<strong>You must update your Flash Player</strong>
</div>
<script type="text/javascript">
var flashProxy = new FlashProxy("1167875895859","../swf/JavaScriptFlashGateway.swf");
var so = new FlashObject("../swf/GraphCanvas.swf","GraphCanvas","1200","800","8","#ffffff");
so.addVariable("appContextURL","http://beast:8080/Clooster/");
so.addVariable("graphURL","http://beast:8080/Clooster/flashdata/clooster1019.xml");
so.addVariable("scrollPaneContentURL","http://beast:8080/Clooster/swf/ScrollPaneContent.swf");
so.addVariable("lcId","1167875895859");
so.addVariable("sessionID","E7D194DBCDBF39AD048CA0B9746C3487");
so.addVariable("treeNavControlVisible","true");
so.addVariable("overviewControlVisible","true");
so.write("flashcontent");
</script>
</body>
</html>
|
|
|
 |
|
|
|
|