[jboss-user] [JBoss Portal] - Re: Need IPC Sample

ganeshraja do-not-reply at jboss.com
Wed Jul 4 14:59:44 EDT 2007


I am getting error for the following code refered from reference document.

PortletA.java

package sample;
  | 
  | import java.io.IOException;
  | import java.io.PrintWriter;
  | 
  | import javax.portlet.GenericPortlet;
  | import javax.portlet.PortletException;
  | import javax.portlet.PortletSecurityException;
  | import javax.portlet.RenderRequest;
  | import javax.portlet.RenderResponse;
  | 
  | 
  | public class PortletA extends GenericPortlet
  | {
  |    protected void doView(RenderRequest request, RenderResponse response)
  |       throws PortletException, PortletSecurityException, IOException
  |    {
  |       response.setContentType("text/html");
  |       PrintWriter writer = response.getWriter();
  |       writer.println("<form action=\"" + response.createActionURL() + "\" method=\"post\">");
  |       writer.println("<select name=\"color\">");
  |       writer.println("<option>blue</option>");
  |       writer.println("<option>red</option>");
  |       writer.println("<option>black</option>");
  |       writer.println("</select>");
  |       writer.println("<input type=\"submit\"/>");
  |       writer.println("</form>");
  |       writer.close();
  |    }
  | }

PortletB.java


  | package sample;
  | 
  | import java.io.IOException;
  | import java.io.PrintWriter;
  | 
  | import javax.portlet.ActionRequest;
  | import javax.portlet.ActionResponse;
  | import javax.portlet.GenericPortlet;
  | import javax.portlet.PortletException;
  | import javax.portlet.PortletSecurityException;
  | import javax.portlet.RenderRequest;
  | import javax.portlet.RenderResponse;
  | 
  | import org.jboss.portlet.PortalNode;
  | import org.jboss.portlet.event.node.PortalNodeEvent;
  | import org.jboss.portlet.event.node.PortalNodeEventBubbler;
  | import org.jboss.portlet.event.node.PortalNodeEventListener;
  | import org.jboss.portlet.event.node.WindowActionEvent;
  | 
  | public class PortletB extends GenericPortlet
  | {
  | 
  |    public void processAction(ActionRequest request, ActionResponse response)
  |               throws PortletException, PortletSecurityException, IOException
  |    {
  |       String color = request.getParameter("color");
  |       if (color != null)
  |       {
  |          response.setRenderParameter("color", color);
  |       }
  |    }
  | 
  |    protected void doView(RenderRequest request, RenderResponse response)
  |           throws PortletException, PortletSecurityException, IOException
  |    {
  |       String color = request.getParameter("color");
  |       response.setContentType("text/html");
  |       PrintWriter writer = response.getWriter();
  |       writer.println("<div" +
  |          (color == null ? "" : " style=\"color:" + color + ";\"") +
  |          ">some text in color</div>");
  |       writer.close();
  |    }
  |    
  |    // Inner listener 
  |    public static class Listener implements PortalNodeEventListener
  |    {
  |       public PortalNodeEvent onEvent(PortalNodeEventBubbler bubbler, PortalNodeEvent event)
  |       {
  |          PortalNode node = event.getNode();
  |          // Get node name
  |          String nodeName = node.getName();
  |          // See if we need to create a new event or not
  |          WindowActionEvent newEvent = null;
  |          if (nodeName.equals("PortletAWindow") && event instanceof WindowActionEvent)
  |          {
  |             // Find window B
  |             WindowActionEvent wae = (WindowActionEvent)event;
  |             PortalNode windowB = node.resolve("../PortletBWindow");
  |             if (windowB != null)
  |             {
  |                // We can redirect
  |                newEvent = new WindowActionEvent(windowB);
  |                newEvent.setParameters(wae.getParameters());
  |                // Redirect to the new event
  |                return newEvent;
  |             }
  |          }
  |          // Otherwise bubble up
  |          return bubbler.dispatch(event);
  |       }
  |    }
  |       
  | }

Portlet.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  | <portlet-app version="1.0" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
  | 
  |    <portlet>
  |       <portlet-name>IPCPortletA</portlet-name>
  |       <portlet-class>sample.PortletA</portlet-class>
  |       <supports>
  |          <mime-type>text/html</mime-type>
  |          <portlet-mode>VIEW</portlet-mode>
  |       </supports>
  |       <portlet-info>
  |          <title>IPC Portlet A</title>
  |       </portlet-info>
  |    </portlet>
  |    <portlet>
  |       <portlet-name>IPCPortletB</portlet-name>
  |       <portlet-class>sample.PortletB</portlet-class>
  |       <supports>
  |          <mime-type>text/html</mime-type>
  |          <portlet-mode>VIEW</portlet-mode>
  |       </supports>
  |       <portlet-info>
  |          <title>IPC Portlet B</title>
  |       </portlet-info>
  |    </portlet>
  | 
  | </portlet-app>     

Exception

  org.jboss.portal.portlet.container.PortletInitializationException: The portlet IPCPortletA threw a runtime exception during init
  |   	at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.start(PortletContainerImpl.java:264)
  |   	at org.jboss.portal.portlet.impl.container.PortletApplicationContextImpl.startPortletApplication(PortletApplicationContextImpl.java:130)
  |   	at org.jboss.portal.portlet.deployment.jboss.PortletAppDeployment.start(PortletAppDeployment.java:153)
  |   	at org.jboss.portal.core.deployment.jboss.PortletAppDeployment.start(PortletAppDeployment.java:94)
  |   	at org.jboss.portal.server.deployment.jboss.DeploymentContext.start(DeploymentContext.java:99)
  |   	at org.jboss.portal.server.deployment.jboss.PortalDeploymentInfoContext.start(PortalDeploymentInfoContext.java:211)
  |   	at org.jboss.portal.server.deployment.jboss.ServerDeployer.start(ServerDeployer.java:217)
  |   	at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
  |   	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
  |   	at sun.reflect.GeneratedMethodAccessor194.invoke(Unknown Source)
  |   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |   	at java.lang.reflect.Method.invoke(Method.java:585)
  |   	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  |   	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  |   	at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
  |   	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  |   	at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
  |   	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  |   	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  |   	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  |   	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  |   	at $Proxy194.deploy(Unknown Source)
  |   	at org.jboss.portal.server.deployment.jboss.ServerDeployer.deploy(ServerDeployer.java:259)
  |   	at org.jboss.portal.server.deployment.WebAppAdapter.deploy(WebAppAdapter.java:54)
  |   	at org.jboss.portal.server.deployment.WebAppIntercepter.handleNotification(WebAppIntercepter.java:160)
  |   	at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
  |   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |   	at java.lang.reflect.Method.invoke(Method.java:585)
  |   	at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:153)
  |   	at $Proxy197.handleNotification(Unknown Source)
  |   	at org.jboss.mx.util.JBossNotificationBroadcasterSupport.handleNotification(JBossNotificationBroadcasterSupport.java:127)
  |   	at org.jboss.mx.util.JBossNotificationBroadcasterSupport.sendNotification(JBossNotificationBroadcasterSupport.java:108)
  |   	at org.jboss.deployment.SubDeployerSupport.emitNotification(SubDeployerSupport.java:340)
  |   	at org.jboss.deployment.SubDeployerSupport.start(SubDeployerSupport.java:308)
  |   	at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:482)
  |   	at sun.reflect.GeneratedMethodAccessor256.invoke(Unknown Source)
  |   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |   	at java.lang.reflect.Method.invoke(Method.java:585)
  |   	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  |   	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  |   	at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
  |   	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  |   	at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
  |   	at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
  |   	at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
  |   	at org.jboss.ws.integration.jboss.DeployerInterceptor.start(DeployerInterceptor.java:92)
  |   	at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
  |   	at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
  |   	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  |   	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  |   	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  |   	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  |   	at $Proxy177.start(Unknown Source)
  |   	at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
  |   	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
  |   	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
  |   	at sun.reflect.GeneratedMethodAccessor117.invoke(Unknown Source)
  |   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |   	at java.lang.reflect.Method.invoke(Method.java:585)
  |   	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  |   	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  |   	at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
  |   	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  |   	at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
  |   	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  |   	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  |   	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  |   	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  |   	at $Proxy8.deploy(Unknown Source)
  |   	at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
  |   	at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
  |   	at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
  |   	at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
  |   	at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
  |   Caused by: java.lang.ClassCastException: sample.PortletA
  |   	at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.start(PortletContainerImpl.java:231)
  |   	... 73 more
  |   org.jboss.portal.portlet.container.PortletInitializationException: The portlet IPCPortletB threw a runtime exception during init
  |   	at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.start(PortletContainerImpl.java:264)
  |   	at org.jboss.portal.portlet.impl.container.PortletApplicationContextImpl.startPortletApplication(PortletApplicationContextImpl.java:130)
  |   	at org.jboss.portal.portlet.deployment.jboss.PortletAppDeployment.start(PortletAppDeployment.java:153)
  |   	at org.jboss.portal.core.deployment.jboss.PortletAppDeployment.start(PortletAppDeployment.java:94)
  |   	at org.jboss.portal.server.deployment.jboss.DeploymentContext.start(DeploymentContext.java:99)
  |   	at org.jboss.portal.server.deployment.jboss.PortalDeploymentInfoContext.start(PortalDeploymentInfoContext.java:211)
  |   	at org.jboss.portal.server.deployment.jboss.ServerDeployer.start(ServerDeployer.java:217)
  |   	at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
  |   	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
  |   	at sun.reflect.GeneratedMethodAccessor194.invoke(Unknown Source)
  |   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |   	at java.lang.reflect.Method.invoke(Method.java:585)
  |   	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  |   	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  |   	at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
  |   	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  |   	at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
  |   	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  |   	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  |   	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  |   	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  |   	at $Proxy194.deploy(Unknown Source)
  |   	at org.jboss.portal.server.deployment.jboss.ServerDeployer.deploy(ServerDeployer.java:259)
  |   	at org.jboss.portal.server.deployment.WebAppAdapter.deploy(WebAppAdapter.java:54)
  |   	at org.jboss.portal.server.deployment.WebAppIntercepter.handleNotification(WebAppIntercepter.java:160)
  |   	at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
  |   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |   	at java.lang.reflect.Method.invoke(Method.java:585)
  |   	at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:153)
  |   	at $Proxy197.handleNotification(Unknown Source)
  |   	at org.jboss.mx.util.JBossNotificationBroadcasterSupport.handleNotification(JBossNotificationBroadcasterSupport.java:127)
  |   	at org.jboss.mx.util.JBossNotificationBroadcasterSupport.sendNotification(JBossNotificationBroadcasterSupport.java:108)
  |   	at org.jboss.deployment.SubDeployerSupport.emitNotification(SubDeployerSupport.java:340)
  |   	at org.jboss.deployment.SubDeployerSupport.start(SubDeployerSupport.java:308)
  |   	at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:482)
  |   	at sun.reflect.GeneratedMethodAccessor256.invoke(Unknown Source)
  |   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |   	at java.lang.reflect.Method.invoke(Method.java:585)
  |   	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  |   	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  |   	at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
  |   	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  |   	at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
  |   	at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
  |   	at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
  |   	at org.jboss.ws.integration.jboss.DeployerInterceptor.start(DeployerInterceptor.java:92)
  |   	at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
  |   	at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
  |   	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  |   	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  |   	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  |   	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  |   	at $Proxy177.start(Unknown Source)
  |   	at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
  |   	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
  |   	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
  |   	at sun.reflect.GeneratedMethodAccessor117.invoke(Unknown Source)
  |   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |   	at java.lang.reflect.Method.invoke(Method.java:585)
  |   	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  |   	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  |   	at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
  |   	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  |   	at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
  |   	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  |   	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  |   	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  |   	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  |   	at $Proxy8.deploy(Unknown Source)
  |   	at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
  |   	at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
  |   	at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
  |   	at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
  |   	at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
  |   Caused by: java.lang.ClassCastException: sample.PortletB
  |   	at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.start(PortletContainerImpl.java:231)
  |   	... 73 more
  | 

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

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



More information about the jboss-user mailing list