[jboss-user] [JBoss Portal] - how to develop a JBossPortlet?

natoine do-not-reply at jboss.com
Fri Oct 10 04:45:34 EDT 2008


Hi ,
i'm trying to develop a portlet that extends JBossPortlet.
I want this portlet to print number of users of my portal in konsole.
No problem to compilation and deploy but then, when i try to see my portlet i have the following error :
anonymous wrote : Cause: java.lang.ClassCastException: org.jboss.portlet.JBossRenderRequest cannot be cast to org.jboss.portlet.JBossRenderRequest
  | Message: org.jboss.portlet.JBossRenderRequest cannot be cast to org.jboss.portlet.JBossRenderRequest
  | StackTrace:
  | 
  | java.lang.ClassCastException: org.jboss.portlet.JBossRenderRequest cannot be cast to org.jboss.portlet.JBossRenderRequest
  | 	at org.jboss.portlet.JBossPortlet.render(JBossPortlet.java:390)
  | 	at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.invokeRender(PortletContainerImpl.java:483)
  | 	at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.dispatch(PortletContainerImpl.java:405)
  | 


public class TestPortlet extends JBossPortlet
  | {
  | 	private UserModule userModule;
  | 	
  | 	protected void doView(JBossRenderRequest rRequest, JBossRenderResponse rResponse) throws IOException, PortletException,
  |     PortletSecurityException
  | 	{
  | 		userModule = (UserModule)getPortletContext().getAttribute("UserModule");
  | 	        Set users;
  |                 System.out.println(userModule.getUserCount());
  |                 PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher(rResponse.encodeURL("/WEB-INF/jsp/default.jsp"));
  |                 prd.include(rRequest, rResponse);
  |         }
  | }				
  | 

Here is my list of imports :

import javax.portlet.PortletException;
  | import javax.portlet.PortletRequestDispatcher;
  | import javax.portlet.PortletSecurityException;
  | 
  | 
  | import org.jboss.portal.identity.IdentityException;
  | import org.jboss.portal.identity.UserModule;
  | import org.jboss.portal.identity.User;
  | import org.jboss.portlet.JBossPortlet;
  | import org.jboss.portlet.JBossRenderRequest;
  | import org.jboss.portlet.JBossRenderResponse;
  | import org.jboss.portlet.JBossActionResponse;
  | import org.jboss.portlet.JBossActionRequest;

And i use the following libs :
jboss-portlet-api-lib.jar
portal-identity-lib.jar
portlet-api-1.0.jar

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4181399#4181399

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4181399



More information about the jboss-user mailing list