voyent
icefaces example project - Effects backing bean produces cast exception  XML
Forum Index -> JBoss Seam Integration
Author Message
jmoya

Joined: 12/Oct/2011 00:48:11
Messages: 1
Offline


Hi everyone, I've added a backing bean for a Shrink effect on the 'icefaces' example project on the jboss seam download package, but everytime i trigger the effect using action="#{effect.triggerEffect}" a cast exception occurs. I suspect I have a conflict in my libraries but I'm not really sure.

Code:
ERROR [D2DFaceletViewHandler] Problem in renderResponse: java.lang.IllegalArgumentException: Cannot convert Effect.Shrink(id,{direction:'center'}); of type class com.icesoft.faces.context.effects.Shrink to class com.icesoft.faces.context.effects.Effect
 javax.faces.FacesException: java.lang.IllegalArgumentException: Cannot convert Effect.Shrink(id,{direction:'center'}); of type class com.icesoft.faces.context.effects.Shrink to class com.icesoft.faces.context.effects.Effect
 	at javax.faces.component.UIComponentBase$AttributesMap.get(UIComponentBase.java:1593)
 	at com.icesoft.faces.context.effects.JavascriptContext.fireEffect(JavascriptContext.java:330)


Here is my build.xml

Code:
 <?xml version="1.0"?>
 
 <project name="Icefaces Booking" default="deploy" basedir="." xmlns:artifact="urn:maven-artifact-ant">
 
 	<!-- Naming -->
 	<property name="Name" value="Seam on JBoss ICEfaces Booking Example" />
 	<property name="example.name" value="seam-icefaces" />
 
 	<!-- Overrides -->
 	<property name="seam.ui.lib" value="yes" />
 	<property name="seam.debug.lib" value="yes" />
 
 	<!-- Add icefaces -->
 
 	<property name="example.tmp.lib.dir" value="${basedir}/lib" />
 	<property name="clean.extra" value="${example.tmp.lib.dir}"/>
 
 	<!-- Datasource -->
 	<property name="example.ds" value="seam-icefaces-ds.xml" />
 	
 	<target name="copyextradependencies">
 		<artifact:dependencies filesetId="icefaces.fileset" versionsId="icefaces.versions">
 			<dependency groupId="org.icefaces" artifactId="icefaces" version="1.8.2">
 				<exclusion groupId="javax.el" artifactId="el-api" />
 			</dependency>
 			<dependency groupId="org.icefaces" artifactId="icefaces-comps" version="1.8.2">
 				<exclusion groupId="javax.el" artifactId="el-api" />
 			</dependency>
 			<dependency groupId="org.icefaces" artifactId="icefaces-facelets" version="1.8.2">
 				<exclusion groupId="javax.el" artifactId="el-api" />
 			</dependency>
 			
 		</artifact:dependencies>
 		<copy todir="${example.tmp.lib.dir}">
 			<fileset refid="icefaces.fileset" />
 			<mapper classpathref="maven-ant-tasks.classpath" classname="org.apache.maven.artifact.ant.VersionMapper" from="${icefaces.versions}" to="flatten" />
 		</copy>
 	</target>
 	
 	<copy todir="../../lib">
 		<fileset dir="${example.tmp.lib.dir}">
 			<include name="icefaces.jar" />
 			<include name="icefaces-comps.jar" />
 			<include name="icefaces-facelets.jar" />
 		</fileset>
 	</copy>
 
 	<import file="../build.xml" />
 	
 	<copy todir="${jar.dir}">
 		<fileset dir="${example.tmp.lib.dir}">
 			<include name="icefaces.jar" />
 			<include name="icefaces-comps.jar" />
 			<include name="icefaces-facelets.jar" />
 		</fileset>
 	</copy>
 	
 	<fileset id="war.lib.extras" dir="${example.tmp.lib.dir}">
 		<include name="*.jar" />
 		<exclude name="servlet-api.jar"/>
 	</fileset>
 </project>
 


web.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
 <web-app version="2.5"
     xmlns="http://java.sun.com/xml/ns/javaee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
   
     <!-- Seam (using Icefaces) generated project-->
     
     <!-- listeners required for this application --> 
    <listener>
       <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
    </listener>
     
    <listener>
       <listener-class>com.icesoft.faces.util.event.servlet.ContextEventRepeater</listener-class>
    </listener>
      
  <!-- filters -->
     <servlet>
         <servlet-name>Seam Resource Servlet</servlet-name>
         <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
     </servlet>
     
     <servlet-mapping>
         <servlet-name>Seam Resource Servlet</servlet-name>
         <url-pattern>/seam/resource/*</url-pattern>
     </servlet-mapping>
     
     <filter>
         <filter-name>Seam Filter</filter-name>
         <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
     </filter>
 
     <filter-mapping>
         <filter-name>Seam Filter</filter-name>
         <url-pattern>/*</url-pattern>
     </filter-mapping>
     
     <!-- JSF -->
      
    
    <!-- Facelets development mode (disable in production) -->
    <context-param>
       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
       <param-value>server</param-value>
    </context-param>
     
    <context-param>
       <param-name>facelets.DEVELOPMENT</param-name>
       <param-value>true</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>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>false</param-value>
     </context-param>
 
     <context-param> 
         <param-name>com.icesoft.faces.doJSFStateManagement</param-name>
 	    <param-value>true</param-value>
     </context-param> 
 
     <context-param>
         <param-name>com.icesoft.faces.standardRequestScope</param-name>
         <param-value>true</param-value>
     </context-param>
    
    <context-param>
         <param-name>com.icesoft.faces.concurrentDOMViews</param-name>
         <param-value>true</param-value>
     </context-param>
 
    	<!--  this is only for JBoss AS 6 - it contains JSF RI 2.0.2 which has a bug 
 		Remove this if you have upgraded to 2.0.3	-->   
     <context-param>
       <param-name>org.jboss.jbossfaces.JSF_CONFIG_NAME</param-name>
       <param-value>Mojarra-1.2</param-value>
    </context-param>
        
   <!-- servlets -->
    <servlet>
         <servlet-name>Faces Servlet</servlet-name>
         <servlet-class>javax.faces.webapp.FacesServlet</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>
         <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 mappings -->
    <servlet-mapping>
         <servlet-name>Persistent Faces Servlet</servlet-name>
         <url-pattern>*.seam</url-pattern>
      </servlet-mapping>
 
      <servlet-mapping>
         <servlet-name>Persistent Faces Servlet</servlet-name>
         <url-pattern>/xmlhttp/*</url-pattern>
     </servlet-mapping>
     
     <!-- Blocking Servlet Mapping -->
     <servlet-mapping>
         <servlet-name>Blocking Servlet</servlet-name>
         <url-pattern>/block/*</url-pattern>
     </servlet-mapping>
              
     <session-config>
         <session-timeout>10</session-timeout> 
     </session-config>    
 
 
 </web-app>


faces-config.xml

Code:
<?xml version='1.0' encoding='UTF-8'?>
 <!DOCTYPE faces-config PUBLIC
           "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
           "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
 
 <faces-config>
 
 
    <application>
    <message-bundle>messages</message-bundle>
       <view-handler>com.icesoft.faces.facelets.D2DSeamFaceletViewHandler</view-handler>
    </application>
    
    <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>shrinkEffect</managed-bean-name>
 
 	        <managed-bean-class>org.jboss.seam.example.booking.ShrinkEffect</managed-bean-class>
 
 	        <managed-bean-scope>application</managed-bean-scope>
 
 	    </managed-bean>
   
 </faces-config>
 


ShrinkEffect.java
Code:
package org.jboss.seam.example.booking;
 
 import com.icesoft.faces.context.effects.Effect;
 import com.icesoft.faces.context.effects.Shrink;
 
 public class ShrinkEffect {
 
     private Effect panelEffect;
 
     public ShrinkEffect() {
     }
 
     public Effect getPanelEffect() {
         return panelEffect;
     }
 
     public void setPanelEffect(Effect panelEffect) {
         this.panelEffect = panelEffect;
     }
     public String fireEffect(){
         panelEffect = new Shrink();
         return null;
     }
 
 }
judy.guglielmin

Joined: 20/Feb/2007 00:00:00
Messages: 1396
Offline


You didn't post your xhtml page that had reference to your ShrinkEffect bean (?).

Since the exception references trying to "convert" the value, it appears that you may be trying to bind an effect to a value of an input component (which would then try to apply converstion to it)....just a guess though as you didn't post your xhtml markup.

Also, you may not want the shrink effect to be application scope, so may wnat to look at the implementation of effect in seam-comp-showcase rather than the booking example.
 
Forum Index -> JBoss Seam Integration
Go to:   
Powered by JForum 2.1.7ice © JForum Team