0

I looked at everypost related with this problem and tried nearly all of them. I'm getting this error. I also have created an empty Spring Maven MVC project and duplicated view and controller and named them as example.jsp and ExampleController.java etc. Shortly, I can not get any respond from Tomcat. I do not know it has anything to do with it but I' also getting and error at the beginning of Console log.

Thanks in advance...

Console log beginning warning (I do not know it has an affect on this problem):

WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:SpitterSpring' did not find a matching property.

Here is my actual part of error:

Tem 11, 2014 4:55:32 PM org.springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler
INFO: Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
Tem 11, 2014 4:55:32 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFO: FrameworkServlet 'appServlet': initialization completed in 885 ms
Tem 11, 2014 4:55:32 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Tem 11, 2014 4:55:32 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Tem 11, 2014 4:55:32 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 9260 ms
Tem 11, 2014 4:55:34 PM org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/spitter/] in DispatcherServlet with name 'appServlet'
Tem 11, 2014 4:55:39 PM org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/spitter/spitter/deneme] in DispatcherServlet with name 'appServlet'
Tem 11, 2014 4:55:45 PM org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/spitter/deneme] in DispatcherServlet with name 'appServlet'
Tem 11, 2014 4:55:52 PM org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/spitter/deneme] in DispatcherServlet with name 'appServlet'

Here is my web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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_2_5.xsd">

    <!-- The definition of the Root Spring Container shared by all Servlets 
        and Filters -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/application-config.xml</param-value>
    </context-param>

    <!-- Creates the Spring Container shared by all Servlets and Filters -->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <!-- Processes application requests -->
    <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>/</url-pattern>
    </servlet-mapping>


</web-app>

Here is my servlet-context.xml file

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

    <context:component-scan base-package="com.ex.spitter.mvc" />

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


</beans:beans>

Here is my com.ex.spitter.mvc -> HomeController:

package com.ex.spitter.mvc;

import java.util.Map;

import javax.inject.Inject;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.ex.spitter.service.SpitterService;

@Controller
public class HomeController {

    private SpitterService spitterService;

    @Inject
    public HomeController(SpitterService spitterService) {
        this.spitterService = spitterService;
    }

    @RequestMapping(value = { "/", "/home" }, method = RequestMethod.GET)
    public String showHomePage(Map<String, Object> model) {
        model.put("spittles", spitterService.getRecentSpittles(spittlesPerPage));
        return "home";
    }

    // <start id="spittlesPerPage"/>
    public static final int DEFAULT_SPITTLES_PER_PAGE = 25;

    private int spittlesPerPage = DEFAULT_SPITTLES_PER_PAGE;

    public void setSpittlesPerPage(int spittlesPerPage) {
        this.spittlesPerPage = spittlesPerPage;
    }

    public int getSpittlesPerPage() {
        return spittlesPerPage;
    }
    // <end id="spittlesPerPage"/>
}
SerhatCan
  • 590
  • 1
  • 7
  • 26
  • which uri are u calling as base? I don't see the "/spitter/" URI mapping from your warning anywhere in your controller, just the "/" and "/home" - mapping. Or is "/spitter/" == "/" in your controller? Apart from that: What does your browser console give you for the error code? 404 or something else? – Dominik Jul 11 '14 at 14:16
  • Yes, I have the base package com.ex.spitter and my controller is in com.ex.spitter.mvc. I'm getting a 404 eror as you said. Tomcat is opening it as default localhost/spitter . Yet, I tried the all versions like localhost /, /spitter/home, /home etc. – SerhatCan Jul 11 '14 at 14:21
  • Thanks probably there is something wrong with sts, workspace or server etc. I will try to load it again because I do not think it is related with the source code – SerhatCan Jul 11 '14 at 15:05
  • [Check this answer][1] [1]: http://stackoverflow.com/questions/3566146/setting-property-source-to-org-eclipse-jst-jee-serverjsftut-did-not-find-a – GobyDot Jul 21 '14 at 03:45

1 Answers1

0

The problem was not solved but I changed my workspace and try to do it copy the codes. Besides, I will try to use a different version of Tomcat or install a Jboss

SerhatCan
  • 590
  • 1
  • 7
  • 26