You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by "Hu, Yiguang" <Yi...@stercomm.com> on 2006/06/01 01:56:37 UTC

java.lang.ClassCastException

After I got the portlet setup, I am running into a ClassCastException. I
was basically mimic the configs from the jpetstore. What this
complaining. Sorry abusing the kind helps. I just try to get the stuff
working. I am trying both jsf bridge and struts bridge. That's why you
saw different questions. Thanks a lot for your help. Yiguang

 

let fragment: [[name, ptmnotl::ptmnotl], [id, jp-xx2]]

2006-05-31 19:47:25,209 [http-28080-Processor24] DEBUG
org.apache.jetspeed.aggregator.impl.RenderingJobImpl - Rendering OID
jp-xx2 org.apache.jetspeed.engine.servlet.ServletRequestImpl@16c57b1
org.apache.jetspeed.aggregator.impl.HttpBufferedResponse@1f143f1

2006-05-31 19:47:25,211 [http-28080-Processor24] ERROR
org.apache.jetspeed.factory.JetspeedPortletFactory - Cannot create
Portlet instance org.apache.portals.bridges.struts.StrutsPortlet for
Portlet Application ptmnotl

java.lang.ClassCastException

        at
org.apache.jetspeed.factory.JetspeedPortletFactory.getPortletInstance(Je
tspeedPortletFactory.java:204)

        at
org.apache.jetspeed.container.invoker.ServletPortletInvoker.invoke(Servl
etPortletInvoker.java:189)

        at
org.apache.jetspeed.container.invoker.ServletPortletInvoker.render(Servl
etPortletInvoker.java:125)

        at
org.apache.pluto.PortletContainerImpl.renderPortlet(PortletContainerImpl
.java:119)

 

struts-portlet-config.xml

...

<portlet-url-type>

                <action path="/Welcome">

...

 

Web.xml

...

 

  <servlet>

    <servlet-name>action</servlet-name>

 
<servlet-class>org.apache.portals.bridges.struts.PortletServlet</servlet
-class>

    <init-param>

      <param-name>config</param-name>

      <param-value>/WEB-INF/struts-config.xml</param-value>

    </init-param>

    <init-param>

      <param-name>debug</param-name>

      <param-value>2</param-value>

    </init-param>

    <init-param>

      <param-name>detail</param-name>

      <param-value>2</param-value>

    </init-param>

    <load-on-startup>2</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</s
ervlet-class>

    <init-param>

      <param-name>contextName</param-name>

      <param-value>ptmnotl</param-value>

    </init-param>

    <load-on-startup>0</load-on-startup>

  </servlet>

  <servlet-mapping>

    <servlet-name>action</servlet-name>

    <url-pattern>*.jsp</url-pattern>

  </servlet-mapping>

  <servlet-mapping>

    <servlet-name>JetspeedContainer</servlet-name>

    <url-pattern>/container/*</url-pattern>

  </servlet-mapping>

  <session-config>

    <session-timeout>30</session-timeout>

  </session-config>

...

 

Struts-config.xml

.......

<controller pagePattern="$M$P" inputForward="false"
processorClass="org.apache.portals.bridges.struts.PortletRequestProcesso
r" />

 

        <message-resources
parameter="com/myapp/struts/ApplicationResource"/>    

        

            

        <plug-in
className="org.apache.struts.validator.ValidatorPlugIn">

        <set-property property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>

        </plug-in>

....

 

Portlet.xml

<portlet-app id="ptmnotl" name="ptmnotl" version="1.0.5">

  <portlet id="ptmnotl">

    <init-param>

      <name>ServletContextProvider</name>

 
<value>org.apache.jetspeed.portlet.ServletContextProviderImpl</value>

    </init-param>

    <init-param>

      <name>ViewPage</name>

      <value>/index.jsp</value>

    </init-param>

    <portlet-name>ptmnotl</portlet-name>

    <display-name>ptmnotl</display-name>

    <description>ptmnotl</description>

 
<portlet-class>org.apache.portals.bridges.struts.StrutsPortlet</portlet-
class>

    <expiration-cache>-1</expiration-cache>

    <supports>

      <mime-type>text/html</mime-type>

      <portlet-mode>VIEW</portlet-mode>

    </supports>

    <portlet-info>

      <title>ptmnotl</title>

      <keywords>ptmnotl</keywords>

    </portlet-info>

  </portlet>

</portlet-app>


Re: java.lang.ClassCastException

Posted by Aaron Evans <aa...@gmail.com>.
My only suggestion is to check the contents of your WEB-INF/lib
directory closely against that of the jpetstore example as they relate
to struts, portlets and the bridge.

On 5/31/06, Hu, Yiguang <Yi...@stercomm.com> wrote:
> After I got the portlet setup, I am running into a ClassCastException. I
> was basically mimic the configs from the jpetstore. What this
> complaining. Sorry abusing the kind helps. I just try to get the stuff
> working. I am trying both jsf bridge and struts bridge. That's why you
> saw different questions. Thanks a lot for your help. Yiguang
>
>
>
> let fragment: [[name, ptmnotl::ptmnotl], [id, jp-xx2]]
>
> 2006-05-31 19:47:25,209 [http-28080-Processor24] DEBUG
> org.apache.jetspeed.aggregator.impl.RenderingJobImpl - Rendering OID
> jp-xx2 org.apache.jetspeed.engine.servlet.ServletRequestImpl@16c57b1
> org.apache.jetspeed.aggregator.impl.HttpBufferedResponse@1f143f1
>
> 2006-05-31 19:47:25,211 [http-28080-Processor24] ERROR
> org.apache.jetspeed.factory.JetspeedPortletFactory - Cannot create
> Portlet instance org.apache.portals.bridges.struts.StrutsPortlet for
> Portlet Application ptmnotl
>
> java.lang.ClassCastException
>
>         at
> org.apache.jetspeed.factory.JetspeedPortletFactory.getPortletInstance(Je
> tspeedPortletFactory.java:204)
>
>         at
> org.apache.jetspeed.container.invoker.ServletPortletInvoker.invoke(Servl
> etPortletInvoker.java:189)
>
>         at
> org.apache.jetspeed.container.invoker.ServletPortletInvoker.render(Servl
> etPortletInvoker.java:125)
>
>         at
> org.apache.pluto.PortletContainerImpl.renderPortlet(PortletContainerImpl
> .java:119)
>
>
>
> struts-portlet-config.xml
>
> ...
>
> <portlet-url-type>
>
>                 <action path="/Welcome">
>
> ...
>
>
>
> Web.xml
>
> ...
>
>
>
>   <servlet>
>
>     <servlet-name>action</servlet-name>
>
>
> <servlet-class>org.apache.portals.bridges.struts.PortletServlet</servlet
> -class>
>
>     <init-param>
>
>       <param-name>config</param-name>
>
>       <param-value>/WEB-INF/struts-config.xml</param-value>
>
>     </init-param>
>
>     <init-param>
>
>       <param-name>debug</param-name>
>
>       <param-value>2</param-value>
>
>     </init-param>
>
>     <init-param>
>
>       <param-name>detail</param-name>
>
>       <param-value>2</param-value>
>
>     </init-param>
>
>     <load-on-startup>2</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</s
> ervlet-class>
>
>     <init-param>
>
>       <param-name>contextName</param-name>
>
>       <param-value>ptmnotl</param-value>
>
>     </init-param>
>
>     <load-on-startup>0</load-on-startup>
>
>   </servlet>
>
>   <servlet-mapping>
>
>     <servlet-name>action</servlet-name>
>
>     <url-pattern>*.jsp</url-pattern>
>
>   </servlet-mapping>
>
>   <servlet-mapping>
>
>     <servlet-name>JetspeedContainer</servlet-name>
>
>     <url-pattern>/container/*</url-pattern>
>
>   </servlet-mapping>
>
>   <session-config>
>
>     <session-timeout>30</session-timeout>
>
>   </session-config>
>
> ...
>
>
>
> Struts-config.xml
>
> .......
>
> <controller pagePattern="$M$P" inputForward="false"
> processorClass="org.apache.portals.bridges.struts.PortletRequestProcesso
> r" />
>
>
>
>         <message-resources
> parameter="com/myapp/struts/ApplicationResource"/>
>
>
>
>
>
>         <plug-in
> className="org.apache.struts.validator.ValidatorPlugIn">
>
>         <set-property property="pathnames"
> value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
>
>         </plug-in>
>
> ....
>
>
>
> Portlet.xml
>
> <portlet-app id="ptmnotl" name="ptmnotl" version="1.0.5">
>
>   <portlet id="ptmnotl">
>
>     <init-param>
>
>       <name>ServletContextProvider</name>
>
>
> <value>org.apache.jetspeed.portlet.ServletContextProviderImpl</value>
>
>     </init-param>
>
>     <init-param>
>
>       <name>ViewPage</name>
>
>       <value>/index.jsp</value>
>
>     </init-param>
>
>     <portlet-name>ptmnotl</portlet-name>
>
>     <display-name>ptmnotl</display-name>
>
>     <description>ptmnotl</description>
>
>
> <portlet-class>org.apache.portals.bridges.struts.StrutsPortlet</portlet-
> class>
>
>     <expiration-cache>-1</expiration-cache>
>
>     <supports>
>
>       <mime-type>text/html</mime-type>
>
>       <portlet-mode>VIEW</portlet-mode>
>
>     </supports>
>
>     <portlet-info>
>
>       <title>ptmnotl</title>
>
>       <keywords>ptmnotl</keywords>
>
>     </portlet-info>
>
>   </portlet>
>
> </portlet-app>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org