Spring MVC + Eclipse + Tomcat - eclipse

I know there are a lot of explanation about how to configure spring MVC with tomcat and eclipse.
Just wondering what I am missing. I've already check other solutions, but none help me out with this.
Here are the files I'm using:
1) web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/dispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
2) dispatcher-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
<!-- Enables the Spring MVC #Controller programming model -->
<annotation-driven />
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
<resources mapping="/resources/**" location="/resources/" />
<!-- Resolves views selected for rendering by #Controllers to .jsp resources in the /WEB-INF/views directory -->
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/" />
<beans:property name="suffix" value=".jsp" />
</beans:bean>
<context:component-scan base-package="com.controle.pronto" />
</beans:beans>
3) index.jsp
<%# taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%# page session="false" %>
<html>
<head>
<title>Home</title>
</head>
<body>
<h1>Hello world!</h1>
</body>
</html>
4) HomeController.java
package com.controle.pronto;
import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
* Handles requests for the application home page.
*/
#Controller
public class HomeController {
private static final Logger logger = LoggerFactory.getLogger(HomeController.class);
/**
* Simply selects the home view to render by returning its name.
*/
#RequestMapping(value = "/", method = RequestMethod.GET)
public String home(Locale locale, Model model) {
logger.info("Welcome home! The client locale is {}.", locale);
Date date = new Date();
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
String formattedDate = dateFormat.format(date);
model.addAttribute("serverTime", formattedDate );
return "home";
}
}
5) And here is my worskspace structure
src
main
webapp
WEB-INF
views
home.jsp
dispatcher-servlet.xml
web.xml
index.jsp
When i try to access:
- localhost:8080/controleponto
- localhost:8080/controleponto/index
- localhost:8080/controleponto/index.jsp
I get into 404 page - The requested resource is not available.
If you could provide me some feedback in what I'm doing wrong, I'll be thankful.
Thanks,
Luis Amaral

Go to your server.xml file. You will find your context root there. something like this
<Context docBase="yourApp" path="/yourApp" reloadable="true" source="org.eclipse.jst.jee.server:yourApp"/></Host>
Try loading localhost:8080/yourApp assuming you are running tomcat on port 8080.

At first, the server will search for the index file. So, past your index.jsp file outside the webapp directory.
Also, try adding in your dispatcher-servlet.xml.

First try with local:8080 , If its running fine Then its means your Tomcat is working fine .
Than just put simple .html file just under web-app and right click on it run it as server you can see its run in eclipse ,then you know the actual name your application using for your web application.
Than everything will run smoothly , I had faced this problem myself lots of time

Related

Getting 404 error when executing spring MVC

I am getting 404 error every time executing Spring application. I have created the dynamic web project using eclipse. I am new to spring and use eclipse first time. Please help to solve this issue.
My web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>SpringBasic</display-name>
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
spring-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">
<context:component-scan base-package="com.bt.controller" />
<mvc:annotation-driven />
<bean class = "org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name = "prefix" value = "/WEB-INF/jsp/" />
<property name = "suffix" value = ".jsp" />
</bean>
</beans>
MyController
package com.bt.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
#Controller
public class MyController {
#RequestMapping("/")
#ResponseBody
public ModelAndView loadhellopage() {
System.out.println("controller");
String msg="Finally";
ModelAndView mav=new ModelAndView("hellopage");
mav.addObject("msg", "Finally");
return mav;
}
}
hellopage.jsp:
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
${message}
</body>
</html>
this is my folder structure:
Also included all the jar files in lib folder under WEB-INF.
When running the project on apache tomcat it is giving 404 error

Eclipse EE Kepler Spring MVC unable to locate views in .html/.jsp

I'm new to Spring MVC. I'm trying out simple projects like Hello World.
I originally created a Hello World using IntelliJ IDEA IDE which worked just fine. However, when I tried Eclipse EE IDE, it returned a 404 message
HTTP Status 404 -
type Status report
message
description The requested resource is not available.
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>FirstSpringMVCProject</display-name>
<servlet>
<servlet-name>spring-dispatcher</servlet-name> <!-- spring-dispatcher is the file named spring-dispatcher-servlet.xml -->
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>spring-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
spring-dispatcher.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<context:component-scan base-package="com.springmvcproject" />
<!-- HandlerMapping class -->
<!-- There are plenty of handler mapping classes, this is just an example of one of the classes available -->
<bean id="HandlerMapping" class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" />
<!-- defines the location or path where to look for views and what file extension to look for -->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
</bean>
HelloController.java
package com.springmvcproject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
#Controller
public class HelloController {
#RequestMapping("/hello")
public String helloWorld(){
return "hellopage";
}
}
hellopage.jsp
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h4> This is the hello page (HelloPage.jsp)</h4>
</body>
</html>
I don't see any reasons why it will not display the contents of the hellopage.jsp when I try to access http://localhost:8080/FirstSpringMVCProject/hello
Here's the screenshot of the folder structure. There are no warnings or error.
I don't know if I just missed something here or if Eclipse is requiring something else.
I hope you can help.
Thank you.

The requested resource is not available in Dynamic Project use Spring in Eclipse

I created a Dynamic Project in Eclipse, but when I opened, it was throwing ClassNotFound exception that is "Servlet [HelloWorld] in web application [/HelloWorld] threw load() exception java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet" from server. It's simple project - HelloWorld.
This is my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
id="WebApp_ID" version="3.1">
<display-name>HelloWorld</display-name>
<welcome-file-list>
<welcome-file>redirect.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
</web-app>
This is HelloWorld-servlet.xml:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemalocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="controller">
<bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="caseSensitive" value="true"></property>
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView">
<property name="prefix" value="/WEB-INF/jsp/">
<property name="suffix" value=".jsp">
</property>
</property>
</property>
</bean>
</context:component-scan>
</beans>
This is redirect.jsp:
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<% response.sendRedirect("hello.html");%>
This is helloworldcontroller.java
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
#Controller
public class helloworldcontroller {
#RequestMapping(value="/hello")
public ModelAndView index(ModelMap m)
{
String mss = "Hello World";
return new ModelAndView("hello", "ms", mss);
}
}
When I import some projects of another people that it run with no exception. But I create new project following step by step it's always throw exception. That make me crazy. I need to help. Thanks!

Fetching data from facebook by Spring social

i am using Spring social for fetching the data from facebook but encountering a weird error
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'homeController': Injection of autowired dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.social.facebook.api.Facebook
org.springframework.social.quickstart.HomeController.facebook; nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type
[org.springframework.social.facebook.api.Facebook] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {#org.springframework.beans.factory.annotation.Autowired(required=true)}
I believe facebook object will come from the api. I don't have to define it manually.
my web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd">
<display-name>Spring Social Facebook</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/forms/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
rootcontext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- Root Context: defines shared resources visible to all other web components -->
<!-- Enable #Annotation-drive bean configuration -->
<context:annotation-config />
<context:component-scan base-package="org" />
<!-- Configures External Property Resolution -->
<import resource="properties.xml" />
<!-- Configures Shared Data Access Resources -->
<!-- <import resource="data.xml" /> -->
<!-- Configures Spring Social -->
<bean class="org.springframework.social.quickstart.config.SocialConfig" />
</beans>
servlet-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
<!-- Enables the Spring MVC #Controller programming model -->
<annotation-driven />
<!-- Resolves views selected for rendering by #Controllers to .jsp resources in the /WEB-INF/views directory -->
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/" />
<beans:property name="suffix" value=".jsp" />
</beans:bean>
</beans:beans>
In my controller I am autowiring my Facebook obj.
#Controller
public class HomeController {
#Autowired
private Facebook facebook;
/*
#Inject
public HomeController(Facebook facebook) {
this.facebook = facebook;
}*/
#RequestMapping(value = "/fb", method = RequestMethod.GET)
public String home(Model model) {
System.out.println("Inside home method");
List<Reference> friends = facebook.friendOperations().getFriends();
model.addAttribute("friends", friends);
return "home";
}
}
taken from spring social quickstart example. Probably you cant inject it by yourself, instead you have to use factory-like method:
#Bean
#Scope(value="request", proxyMode=ScopedProxyMode.INTERFACES)
public Facebook facebook() {
return connectionRepository().getPrimaryConnection(Facebook.class).getApi();
}
it needs other dependencies, no point to copy-paste them all here. Take a look at:
https://github.com/spring-projects/spring-social-samples/blob/master/spring-social-quickstart/src/main/java/org/springframework/social/quickstart/config/SocialConfig.java

There is no Action mapped for namespace [/] and action name [] associated with context path [/struts]

I've looked through all similar Qs on stackoverflow but it didn't help, sorry. The main difference I have from all of them is that I got EMPTY action name in error message. Googling didn't help :(
Hope someone just could give a hint where to look for the source of the problem. thx
message:
Stacktraces
There is no Action mapped for namespace [/] and action name [] associated with context path [/struts]. - [unknown location]
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58
..................
struts.xml:
<?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.devMode" value="true" />
<package name="default" namespace="/*" extends="struts-default">
<action name="login"
class="training.struts.action.LoginAction">
<result>login.jsp</result>
</action>
</package>
</struts>
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>Struts Lab</display-name>
<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>
<!-- Spring Config -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/springServlet/appServlet/mvc-servlet.xml,
/WEB-INF/db/db-cfg.xml,
/WEB-INF/springServlet/application-security.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>mvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/springServlet/appServlet/mvc-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- Spring Security -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- *** -->
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
well..image is impossible so the project structure is:
src/main/java
----+training.struts.action.LoginAction.java
src/main/webapp
----+WEB-INF
--------+classes
-----------+struts.xml
--------+db
-----------+db-cfg.xml
--------+springServlet
-----------+appServlet
---------------+mvc-servlet.xml
-----------+application-security.xml
--------+index.jsp
--------+login.jsp
--------+web.xml
UPDATE:
So sad to be stupid =(
I've moved my login.jsp from WEB-INF to webapp root and that solved the problem.
UPDATE2:
I've made some investigation:
if I remove "welcome-file-list" block from web.xml, container will look for "index.jsp" in webapp root to show as first view on application running. If I delete "index.jsp" then I'll got the identical exception message:
There is no Action mapped for namespace [/] and action name [] associated with context path [/struts]
So in my opinion if you have empty action name in error message with correct xml settings for struts, the first step should be start-up JSP availability checking.
Cheers, guys.
Add the below blank action to you struts.xml file in "/" package namespace and it will show the index.html when you will only try to access your url (like appid.app.com) and it will not show the error. Normally it will add a blank action and app engine will redirect the blank action to your welcome file.
<action name="" class="com.candi.actions.Dashboard" method="noAction">
<result name="success">index.jsp</result>
</action>
Add / in your namespace instead of /* :
<package name="default" namespace="/" extends="struts-default">
Or if issue not resolved than you can use Config Browser Plugin.
The Config Browser Plugin is a simple tool to help view an application's configuration at runtime. It is very useful when debugging problems that could be related to configuration issues.
OK, so I have placed login.jsp in a wrong place in my web-app folders structure.
That was the mistake
Add the following package in struts.xml
<package name="default" namespace="/" extends="struts-default">
<action name="login"
class="training.struts.action.LoginAction">
<result>login.jsp</result>
</action>
</package>
I changed the namespace in package tag to '/' and the problem resolved!!!
For me, I changed the opening tag of the web.xml file from
<web-app>
to
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">