0Day Forums
Liferay + Struts2 There is no Action mapped for namespace /testPortlet1 and action name startTestPortlet1, why? - Printable Version

+- 0Day Forums (https://zeroday.vip)
+-- Forum: Coding (https://zeroday.vip/Forum-Coding)
+--- Forum: CMS (https://zeroday.vip/Forum-CMS)
+--- Thread: Liferay + Struts2 There is no Action mapped for namespace /testPortlet1 and action name startTestPortlet1, why? (/Thread-Liferay-Struts2-There-is-no-Action-mapped-for-namespace-testPortlet1-and-action-name-startTestPortlet1-why)



Liferay + Struts2 There is no Action mapped for namespace /testPortlet1 and action name startTestPortlet1, why? - concretionalxopmuinnl - 07-20-2023

I am absolutly new in Liferay portlet development and I have the following problem.

When I try to add my first portlet (developed by me) in the portlet I obtein this error message:

> testPortlet1 is temporarily unavailable.

And in the stacktrace of my IDE I see this error message:

2014-12-19 11:37:55,874 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] ERROR commons.CommonsLogger.error(38) - Could not find action
There is no Action mapped for namespace /testPortlet1 and action name startTestPortlet1. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
..............................................................................
..............................................................................
..............................................................................
11:37:55,883 ERROR [PortletServlet:96] javax.portlet.PortletException: Could not find action startTestPortlet1
javax.portlet.PortletException: Could not find action startTestPortlet1
at org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher.serviceAction(Jsr168Dispatcher.java:454)
at org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher.render(Jsr168Dispatcher.java:322)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:101)
..............................................................................
..............................................................................
..............................................................................
Caused by: There is no Action mapped for namespace /testPortlet1 and action name startTestPortlet1. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
..............................................................................
..............................................................................
..............................................................................
11:37:55,892 ERROR [jsp:154] There is no Action mapped for namespace /testPortlet1 and action name startTestPortlet1. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
..............................................................................
..............................................................................
..............................................................................

So this is the **structs.xml** section related to my portlet:

<package name="TestPortlet1Package" extends="struts-portlet-default" namespace="/">
<action name="startTestPortlet1" class="TestPortlet1Action" method="startTestPortlet1">
<result name="success">/testPortlet1/testPortlet1.jsp</result>
</action>
</package>

This is my JSP view (definied inside the **\Web\src\main\webapp\testPortlet1\testPortlet1.jsp**):

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
<style>
.portlet-topper#portlet_SliderNewsPortlet_WAR_KMPortlets, .portlet-title#portlet_SliderNewsPortlet_WAR_KMPortlets {
display: none
}

.portlet#portlet_SliderNewsPortlet_WAR_KMPortlets, .portlet-content#portlet_SliderNewsPortlet_WAR_KMPortlets {
border: 0;
margin: 0;
padding: 0;
background: 0;

}
</style>
<hr style="height:1px;border:none;color:#1d8843;background-color:#1d8843;width: 98%" size="4px">
<table width="100%">
<tr>
<td>
<table class="homePortletTitle">
<tr>
<td style="padding-bottom: 0px;"><img src="/km-theme/images/km-icons/section_icon_focus.png"></td>
<th style="">TestPortlet1</th>
<td style="">Hello World Portlet</td>
</tr>
</table>
</td>
</tr>

<tr>
<td>
<p>Hello World !!!</p>
</td>
</tr>
</table>

And this is my portlet configuration definied into **portlet.xml** file:

<portlet>

<portlet-name>testPortlet1</portlet-name>
<display-name>testPortlet1</display-name>
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</portlet-class>

<init-param>
<name>viewNamespace</name>
<value>/testPortlet1</value>
</init-param>

<init-param>
<name>defaultViewAction</name>
<value>startTestPortlet1</value>
</init-param>

<expiration-cache>0</expiration-cache>

<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
</supports>

<portlet-info>
<title>testPortlet1</title>
</portlet-info>

</portlet>

What am I missing? How can I solve this issue? I am going crazy.

Tnx