aspose file tools*
The moose likes JSF and the fly likes JSF based Portlet with MyFaces bridge Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF based Portlet with MyFaces bridge" Watch "JSF based Portlet with MyFaces bridge" New topic
Author

JSF based Portlet with MyFaces bridge

Priya Velayoudam
Greenhorn

Joined: Sep 16, 2005
Posts: 3
Hello -

I created a web-app with JSF framework initially and got it successfully running on Tomcat 5.5.9. The jsf related jars used here were - jsf-api.jar and jsf-impl.jar. Later the same application I tried converting into a Portlet by including the portlet.xml and making modification to web.xml. Replaced the above jars with myfaces-1.0.9.jar and myfaces-jsf-api-1.0.9.jar to have the JSf-portlet bridging done. This I then deployed on to JetSpeed 2 and after some trials could get it running successfully.

Now the same war file (with modification in web.xml to remove entry specific to JetSpeed) when deployed on to Weblogic 8 is giving me the following exception -

java.lang.ClassCastException at javax.faces.webapp.UIComponentTag.setupResponseWriter(UIComponentTag.java:641) at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:244) at org.apache.myfaces.taglib.core.ViewTag.doStartTag

My app web.xml looks like this when it is a simple JSF web-app.

<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<servlet>
<servlet-name>FacesServlet</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>FacesServlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>

Web.xml when integrated as a Portlet onto JetSpeed 2
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</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>
<context-param>
<param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.PRETTY_HTML</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
<param-value>true</param-value>
</context-param>
<!-- Extensions Filter -->
<filter>
<filter-name>extensionsFilter</filter-name>
<filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
<init-param>
<param-name>uploadMaxFileSize</param-name>
<param-value>100m</param-value>
<description>Set the size limit for uploaded files.
Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB</description>
</init-param>
<init-param>
<param-name>uploadThresholdSize</param-name>
<param-value>100k</param-value>
<description>Set the threshold size - files
below this limit are stored in memory, files above
this limit are stored on disk.

Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB</description>
</init-param>
</filter>
<!-- Filter Mappings -->
<filter-mapping>
<filter-name>extensionsFilter</filter-name>
<url-pattern>*.jsf</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>extensionsFilter</filter-name>
<url-pattern>/faces/*</url-pattern>
</filter-mapping>
<!-- Listener, that does all the startup work (configuration, init). -->
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
<!-- Faces Servlet -->
<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>JetspeedContainer</servlet-name>
<display-name>Jetspeed Container</display-name>
<description>MVC Servlet for Jetspeed Portlet Applications</description>
<servlet-class>org.apache.jetspeed.container.JetspeedContainerServlet</servlet-class>
<init-param>
<param-name>contextName</param-name>
<param-value>myfacesTxnStat</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<!-- extension mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>JetspeedContainer</servlet-name>
<url-pattern>/container/*</url-pattern>
</servlet-mapping>
<taglib>
<taglib-uri>http://java.sun.com/portlet</taglib-uri>
<taglib-location>/WEB-INF/tld/portlet.tld</taglib-location>
</taglib>

web.xml after the project was imported and auto fitted by Weblogic 8, is only modified to exclude the JetSpeed related entries.


If anyone can hint on what could be problem? Or any link that could give some information anything in line would be great.

If this is not the right forum to raise the issue, please let me know.

many thanks

ps:I'm new to JSF and portlets & currently trying out stunts with these technologies. My test Portal servers are JetSpeed 2 and WebLogic 8.


-Priya-
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Since the application appearntly works in other containers, I'd venture to guess this is more of a Weblogic guru question. As such, I am going to move this to the Weblogic forum so those guys and gals can have a crack at it.


GenRocket - Experts at Building Test Data
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSF based Portlet with MyFaces bridge