Basit bir Bahar MVC web uygulaması uygulamak için çalışıyorum.Appled bir proje inşa Ve tomcat üzerinde dağıtım sırasında bu hatayı alıyorum.HTTP 404 hata kodu Merhaba dünya uygulaması için ilkbahar MVC web uygulaması
<?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">
<display-name>Theka Desi Khana</display-name>
<!-- 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/root-context.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>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
kök context.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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
</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"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
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 -->
<context:component-scan base-package="com.theka.desi.Controllers" />
<!-- 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>
<!-- Handles HTTP GET requests for /resources/** by efficiently serving
up static resources in the ${webappRoot}/resources directory -->
<resources mapping="/resources/**" location="/resources/" />
</beans:beans>
HomeController
package com.theka.desi.Controllers;
import javax.servlet.ServletContext;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
@RequestMapping("/")
public class HomeController {
@Autowired
private ServletContext servletContext;
private final Logger logger = Logger.getLogger(HomeController.class);
public ServletContext getServletContext() {
return servletContext;
}
public void setServletContext(ServletContext servletContext) {
this.servletContext = servletContext;
}
@RequestMapping("/")
public String welcome() {
return "redirect:/home";
}
@RequestMapping("/home")
public ModelAndView home() {
ModelAndView view = new ModelAndView("index");
return view;
}
}
Konsol Giriş:
Mar 26, 2016 6:09:56 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:desi' did not find a matching property.
Mar 26, 2016 6:09:56 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/7.0.65
Mar 26, 2016 6:09:56 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Oct 9 2015 08:36:58 UTC
Mar 26, 2016 6:09:56 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 7.0.65.0
Mar 26, 2016 6:09:56 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 8.1
Mar 26, 2016 6:09:56 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.3
Mar 26, 2016 6:09:56 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Mar 26, 2016 6:09:56 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jdk1.7.0_79\jre
Mar 26, 2016 6:09:56 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.7.0_79-b15
Mar 26, 2016 6:09:56 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Mar 26, 2016 6:09:56 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: C:\Users\nand\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Mar 26, 2016 6:09:56 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: G:\Softy\apache-tomcat-7.0.65-windows-x64\apache-tomcat-7.0.65
Mar 26, 2016 6:09:56 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\Users\nand\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Mar 26, 2016 6:09:56 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=G:\Softy\apache-tomcat-7.0.65-windows-x64\apache-tomcat-7.0.65
Mar 26, 2016 6:09:56 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\Users\nand\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
Mar 26, 2016 6:09:56 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=G:\Softy\apache-tomcat-7.0.65-windows-x64\apache-tomcat-7.0.65\endorsed
Mar 26, 2016 6:09:56 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
Mar 26, 2016 6:09:56 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.7.0_79\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Common Files\lenovo\easyplussdk\bin;C:\Program Files (x86)\Skype\Phone\;.
Mar 26, 2016 6:09:56 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Mar 26, 2016 6:09:56 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Mar 26, 2016 6:09:56 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1234 ms
Mar 26, 2016 6:09:56 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mar 26, 2016 6:09:56 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.65
Mar 26, 2016 6:09:59 PM org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Mar 26, 2016 6:09:59 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Mar 26, 2016 6:09:59 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
Mar 26, 2016 6:09:59 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'appServlet'
Mar 26, 2016 6:10:00 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Mar 26, 2016 6:10:00 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Mar 26, 2016 6:10:00 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 4357 ms
Mar 26, 2016 6:10:50 PM org.apache.catalina.loader.WebappClassLoaderBase modified
SEVERE: Resource '/WEB-INF/classes/com/theka/desi/Controllers/HomeController.class' is missing
Mar 26, 2016 6:10:50 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/desi] has started
Mar 26, 2016 6:10:50 PM org.apache.catalina.core.ApplicationContext log
INFO: Destroying Spring FrameworkServlet 'appServlet'
Mar 26, 2016 6:10:50 PM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
Mar 26, 2016 6:10:52 PM org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Mar 26, 2016 6:10:52 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Mar 26, 2016 6:10:52 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
Mar 26, 2016 6:10:53 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'appServlet'
Mar 26, 2016 6:10:53 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/desi] is completed
Server üzerinde Çalıştır ı> Prject_ olarak projeyi kaçarken çalıştırın
Dağıtım dizin yapısı>
catalina.out'un herhangi bir günlüğü – andy
@andy log ekledim. Günlük ile ilgili haritalama yoktur. – nand
Günlüğe kaydetme, uygulamanın dağıtıldığını göstermiyor. –