Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

[S2] Could not locate dispatcher for ${location}

Kalyan Sarkar

2007-05-14



Hi,
I am new to both Struts 2 and portlet.
I'm getting the following exception whenever my action returns...

20:00:27,031 ERROR [Jsr168Dispatcher] Could not execute action
javax.portlet.PortletException: Could not locate dispatcher for
'${location}'

The stacktrace also shows...

20:00:27,359 ERROR [PortletServlet] javax.portlet.PortletException: Error
executing action renderDirect
20:00:27,359 ERROR [[ReproTemplatePortlet]] Servlet.service() for servlet
ReproTemplatePortlet threw exception
javax.portlet.PortletException: Error executing action renderDirect

I am developing a Struts 2 based portlet application. My struts.xml goes
like this ...

<struts>

  <include file="struts-portlet-default.xml" />

  <package name="view" extends="struts-portlet-default" namespace="/view">
    <action name="index" class="com.opensymphony.xwork2.ActionSupport">
       <result name="success">/pages/view/uploadTemplate.jsp</result>
    </action>
    <action name="upload" method="execute"
class="com.anshinsoft.repro.dashboard.template.action.UploadTemplateAction">
       <result name="success">/pages/view/success.jsp</result>
     <result name="failure">/pages/view/uploadTemplate.jsp</result>
    </action>
 </package>

</struts>

And the portlet.xml is like this ...

  <portlet id="ReproTemplatePortlet">
   <description xml:lang="EN">Repro Template Portlet</description>
    <portlet-name>ReproTemplatePortlet</portlet-name>
    <display-name xml:lang="EN">Repro Template Portlet</display-name>
   
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</portlet-class>



    <!-- Portlet-initialization parameter -->
    <init-param>
       <!-- The view mode namespace. Maps to a namespace in the xwork
config file -->
       <name>viewNamespace</name>
       <value>/view</value>
    </init-param>
    <init-param>
       <!-- The default action to invoke in view mode -->
       <name>defaultViewAction</name>
       <value>index</value>
    </init-param>
    <init-param>
      <!-- The edit mode namespace. Maps to a namespace in the xwork
config file -->
      <name>editNamespace</name>
      <value>/edit</value>
    </init-param>
    <init-param>
      <!-- The default action to invoke in edit mode -->
      <name>defaultEditAction</name>
      <value>index</value>
    </init-param>    

    <!-- Expiration cache for the portlet -->
    <expiration-cache>0</expiration-cache>

    <!-- mime-type and mode supported by the portlet-->
    <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>edit</portlet-mode>
       <!--portlet-mode>help</portlet-mode-->
    </supports>

    <!-- Supported locale of the portlet -->
    <supported-locale>en</supported-locale>
   
    <!-- Portlet information -->
    <portlet-info>
       <title>Repro Template Portlet</title>
       <short-title>SP</short-title>
       <keywords>struts,portlet</keywords>
    </portlet-info>    

    <!-- Defined security roles -->
    <security-role-ref>
       <role-name>administrator</role-name>
    </security-role-ref>
    <security-role-ref>
       <role-name>guest</role-name>
    </security-role-ref>
    <security-role-ref>
       <role-name>power-user</role-name>
    </security-role-ref>
    <security-role-ref>
       <role-name>user</role-name>
    </security-role-ref>
  </portlet>
</portlet-app>

Can anybody help? Thanks in advance.

Best regards,
Kalyan Sarkar




--
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.