• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts2 tiles2 No result defined for action result success

 
Yuva Kumar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

Sorry for the lengthy post, I wanted to give as much information as possible. Would appreciate, if someone can look at the code and suggest me where I am wrong. Thanks. I am using Tomcat6 / Struts2 / Tiles2 / Hibernate / Mysql5. Kindly let me know if any other information is required.

I am trying to create a web application using Struts2 / Tiles2 / Hibernate. I have a login page, and once the user is validated successfully, user should be taken to the home page containing some sample menu items for further navigations. When starting the application, user is able to see the login page. enter the login credentials, after that, the same is being submitted to the Tomcat server. But after login validation, the user is not taken to home page, but instead gets an error page as follows :


-------- Error Message on the browser ------
Struts Problem Report

Struts has detected an unhandled exception:
Messages:
No result defined for action com.accel.prjmgt.action.LoginAction and result success
Stacktraces
No result defined for action com.accel.prjmgt.action.LoginAction and result success

com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:375)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:277)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Unknown Source)


You are seeing this page because development mode is enabled. Development mode, or devMode, enables extra debugging behaviors and reports to assist developers. To disable this mode, set:

struts.devMode=false

in your WEB-INF/classes/struts.properties file.
-------- End of Error Message on the browser ------

-------- WebContent/WEB-INF/lib folder list is as follows ---------

antlr-2.7.6.jar
aopalliance-1.0.jar
asm.jar
cglib-2.2.jar
classworlds-1.1.jar
commons-beanutils-1.7.0.jar
commons-chain-1.2.jar
commons-collections-3.2.jar
commons-digester-2.0.jar
commons-fileupload-1.2.1.jar
commons-io-1.3.2.jar
commons-logging-1.1.jar
commons-logging-api-1.1.1.jar
commons-validator-1.3.1.jar
dom4j-1.6.1.jar
freemarker-2.3.16.jar
hibernate-3.2.5.ga.jar
hibernate-annotations-3.2.1.ga.jar
hibernate-core.jar
hibernate-jpa-2.0-api-1.0.0.Final.jar
javassist-3.12.0.GA.jar
json-lib-2.3-jdk15.jar
jta-1.1.jar
jul-to-slf4j-1.6.1.jar
log4j-1.2.14.jar
log4j-over-slf4j-1.6.1.jar
mysql-connector-java-5.0.8-bin.jar
ognl-3.0.jar
oro-2.0.8.jar
slf4j-api-1.6.1.jar
slf4j-simple-1.6.1.jar
sslext-1.2-0.jar
struts2-convention-plugin-2.2.1.jar
struts2-core-2.2.1.jar
struts2-embeddedjsp-plugin-2.2.1.jar
struts2-jquery-grid-plugin-2.5.0.jar
struts2-jquery-plugin-2.5.0.jar
struts2-json-plugin-2.2.1.jar
struts2-tiles-plugin-2.2.1.jar
tiles-api-2.2.1.jar
tiles-core-2.2.1.jar
tiles-el-2.2.1.jar
tiles-jsp-2.2.1.jar
tiles-ognl-2.2.1.jar
tiles-servlet-2.2.1.jar
velocity-1.6.3.jar
velocity-tools-1.3.jar
xwork-core-2.2.1.jar

-------- End of WebContent/WEB-INF/lib folder list ---------

-------- Struts.xml is as follows ---------

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />
<constant name="struts.custom.i18n.resources" value="ApplicationResources" />

<package name="default" extends="struts-default" namespace="/">
<result-types>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
<result-type name="json" class="org.apache.struts2.json.JSONResult" default="true"/>
</result-types>
<action name="login" class="com.accel.prjmgt.action.LoginAction">
<result name="success" type="tiles">welcome.tiles</result>
<result name="input" type="tiles">welcome.tiles</result>
<result name="error">pages/Login.jsp</result>
</action>
.....

</struts>
-------- End of Struts.xml ---------

-------- tiles-def.xml is as follows ---------

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN"
"http://tiles.apache.org/dtds/tiles-config_2_1.dtd">

<tiles-definitions>

<definition name="baseLayout" template="pages/layout/BaseLayout.jsp">
<put-attribute name="title" value="" />
<put-attribute name="header" value="pages/layout/Header.jsp" />
<put-attribute name="menu" value="pages/Menu.jsp" />
<put-attribute name="body" value="" />
<put-attribute name="footer" value="pages/layout/Footer.jsp" />
</definition>

<definition name="welcome.tiles" extends="baseLayout">
<put-attribute name="title" value="Welcome" />
<put-attribute name="body" value="pages/Welcome.jsp" />
</definition>

<definition name="master.tiles" extends="baseLayout">
<put-attribute name="title" value="Master Maintenance" />
<put-attribute name="body" value="pages/MasterMenu.jsp" />
</definition>
....

</tiles-definitions>
-------- End of tiles-def.xml ---------

-------- web.xml is as follows ---------
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0" metadata-complete="true">

<display-name>Struts2 Application</display-name>

<listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>
<context-param>
<param-name>tilesDefinitions</param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</context-param>

<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>

<listener>
<listener-class>
com.accel.listeners.HibernateListener
</listener-class>
</listener>

<welcome-file-list>
<welcome-file>/pages/Login.jsp</welcome-file>
</welcome-file-list>
</web-app>
-------- End of web.xml ---------

-------- LoginAction is as follows ---------
package com.accel.prjmgt.action;

//import com.accel.prjmgt.business.LoginDAO;
//import com.accel.prjmgt.data.LoginDO;
import com.opensymphony.xwork2.ActionSupport;

public class LoginAction extends ActionSupport
{
private String username;
private String password;

public String execute()
{
// LoginDAO login = new LoginDAO();
// LoginDO user = new LoginDO();

// String sReturn = login.getUser(username);

// System.out.println("===================== > " + sReturn + "< =====================");


return "success";
}
.....
}
-------- End of LoginAction.java ---------

-------- login.jsp is as follows ---------
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<link href="<s:url value="/pages/stylesheets/style.css"/>" rel="stylesheet" type="text/css"/>
<html>
<head>
<title>Rate Card Generator</title>
</head>

<body height="50%" margin-top="25%">
<h2 align="center">Rate Card Generator - Login</h2>
<div id = "errors" align = "center">

<s:actionerror />

</div>
<s:form action="login" method="post">
<div class="greenBorder" style="display: table; height: 400px; #position: relative; overflow: hidden;">
<div style=" #position: absolute; #top: 50%;display: table-cell; vertical-align: middle;">
<div class="greenBorder" style=" #position: relative; #top: -50%">
<s:textfield name="username" key="label.username" size="20" /> <s:password name="password" key="label.password" size="20" /> <s:submit method="execute" key="label.login" align="center" />

</div>
</div>
</div>
</s:form>
</body>
</html>
-------- End of login.jsp ---------

Struts.xml is available in src folder and in classes folder.
tiles-def.xml and web.xml are available in WEB-INF folder

Regards,

Yuva

 
Gopakumar Naryanan
Ranch Hand
Posts: 72
Eclipse IDE Hibernate Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I asume that you mút have figủred out the issue by this time.From stacktrace it is clear that struts is unable To navigate to the result page configured. Hence make changes. To the path.. try adding / as prefix, if you are using IDE do a ctrl+click on the path it must point to your result page.
 
Yuva Kumar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear GopaKumar

Thanks for you reply. I was not able to figure out the issue, but was able to get a solution. I changed the tiles plugin jars to a lower version and the errors are gone......Earlier I was using struts2-tiles-plugin-2.2.1.jar, and after replacing them with struts2-tiles-plugin-2.1.6.jar, my application is working now. Strange.

Anyway thanks for your reply.

Thanks,

Yuva
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic