java - WARNING: No mapping found for HTTP request with URI [/projectShaun/home] in DispatcherServlet with name 'DispatcherServlet' -


when start console no errors, when try access following url: http://localhost:8080/projectshaun/home following error:

no mapping found http request uri [/projectshaun/] in dispatcherservlet name 'dispatcherservlet

dispatcherservlet-servlet:

<?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-4.0.xsd http://www.springframework.org/schema/mvc  http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">  <bean class="org.springframework.web.servlet.mvc.support.controllerclassnamehandlermapping"/>      <bean class="org.springframework.web.servlet.view.internalresourceviewresolver">         <property name="prefix" value="/web-inf/jsp/" />         <property name="suffix" value=".jsp" />     </bean> </beans> 

web.xml:

<?xml version="1.0" encoding="utf-8"?> <web-app version="3.0" 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"> <context-param>     <param-name>contextconfiglocation</param-name>     <param-value>web-inf/applicationcontext.xml</param-value> </context-param>     <servlet>         <servlet-name>dispatcherservlet</servlet-name>         <servlet-class> org.springframework.web.servlet.dispatcherservlet </servlet-class>     </servlet>     <servlet-mapping>         <servlet-name>dispatcherservlet</servlet-name>         <url-pattern>/</url-pattern>     </servlet-mapping> </web-app> 

applicationcontext:

<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:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"     xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"     xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:task="http://www.springframework.org/schema/task"     xsi:schemalocation="http://www.springframework.org/schema/aop      http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd     http://www.springframework.org/schema/aop/spring-aop-3.2.xsd      http://www.springframework.org/schema/beans      http://www.springframework.org/schema/beans/spring-beans-3.2.xsd      http://www.springframework.org/schema/context      http://www.springframework.org/schema/context/spring-context-3.2.xsd      http://www.springframework.org/schema/jee      http://www.springframework.org/schema/jee/spring-jee-3.2.xsd      http://www.springframework.org/schema/tx      http://www.springframework.org/schema/tx/spring-tx-3.2.xsd      http://www.springframework.org/schema/task      http://www.springframework.org/schema/task/spring-task-3.2.xsd" >    <context:component-scan base-package="com.projectshaun.controller" />    <mvc:annotation-driven />    <tx:annotation-driven/>  <bean id="datasource" class="org.apache.commons.dbcp.basicdatasource" destroy-method="close">     <property name="driverclassname" value="com.mysql.jdbc.driver" />     <property name="url" value="jdbc:mysql://localhost:3306/projectshaun" />     <property name="username" value="root" />     <property name="password" value="" />   </bean>    <bean id="sessionfactory" class="org.springframework.orm.hibernate4.localsessionfactorybean">     <property name="datasource" ref="datasource"></property>      <property name="annotatedclasses">             <list>                 <value>com.projectshaun</value>             </list>         </property>     <property name="hibernateproperties">       <props>         <prop           key="hibernate.dialect">org.hibernate.dialect.mysql5dialect</prop>         <prop key="hibernate.show_sql">true</prop>       </props>     </property>   </bean>    <bean id="transactionmanager" class="org.springframework.orm.hibernate4.hibernatetransactionmanager"      p:sessionfactory-ref="sessionfactory">   </bean> </beans> 

homecontroller:

package com.projectshaun.controller;  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;  import com.projectshaun.service.accountservice;  @controller public class homecontroller {      @autowired     accountservice accountservice;      @requestmapping(value = "/home")     public modelandview welcome() {         modelandview modelandview = new modelandview("welcome");         modelandview.addobject("greeting", "welcome projectshaun!");         return modelandview;     } } 

do have welcome.jsp file in web-inf/jsp folder? might problem, can check project context root correct.(right click on project name -> properties -> web project settings -> in context root should projectshaun)


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -