Could not find action or result
Asked Answered
C

1

7

I am getting:

com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn Could not find action or result There is no Action mapped for namespace [/] and action name [] associated with context path [/]. - [unknown location]

I am using a combination of RAD + WebSphere for development with the following code:

struts.xml:

<struts>
    <constant name="struts.devMode" value="true" />
    <constant name="struts.custom.i18n.resources" value="ApplicationResources" />
    <package name="default" extends="struts-default" namespace="/">

web.xml:

<filter>
    <filter-name>struts2</filter-name>
    <filter-class> 
        org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter 
    </filter-class>
</filter>
<filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
    <welcome-file>Login.jsp</welcome-file>
</welcome-file-list>

I have read all blogs & tried everything mentioned on sites. It is an error because of some different reason what I am unable to find .

Crifasi answered 19/6, 2015 at 7:47 Comment(1)
The reason you have a slash added to the URL by the web server.Facies
F
5

There's no configuration for action name [] and namespace [/]. This is a problem. To solve this you should add a configuration. Supposed you have an index.jsp file in the root folder. Using a actionless result you can redirect to this page.

<package name="default" extends="struts-default" namespace="/">
   <action name=""><result>/index.jsp</result></action> 
   ...
Facies answered 19/6, 2015 at 8:21 Comment(4)
Thanks for your reply. I have tried this one but getting the same error. At least Login page should open which is mentioned in web.xml . <welcome-file-list> <welcome-file>Login.jsp</welcome-file> </welcome-file-list>Crifasi
And how would you like to open this page? First you should invoke the action then return a result, but web server won't allow you to do it if you use a welcome-file-list configuration.Facies
Above suggested option is working fine but stuck anywhere. When I use Struts2 filter in web.xml, it doesn't load remaining web.xml or index.jsp. But if I remove that filter from web.xml, it loads index.jsp. Ideally it should load index.jsp(web.xml) first than call goes to struts.xml .Crifasi
No, this is not the scenario. index.jsp is already at it's own place & whole mapping is perfect . I have crossed check the structure through net .Crifasi

© 2022 - 2024 — McMap. All rights reserved.