spring mvc - After adding ContextLoaderListener in web.xml. 404 Error as "The requested resource () is not available." -


In my spring mvc application, when I am adding applicationContext.xml to a web.xml file:

  & lt; Context param & gt; & Lt; Ultimate Name & gt; ContextConfigLocation & lt; / Lastname & gt; & Lt; Ultimate Price & gt; /WEB-INF/applicationContext.xml< / Super-valued & gt; & Lt; / Reference param & gt; & Lt; Listener & gt; & Lt; Audience category & gt; Org.springframework.web.context.ContextLoaderListener & lt; / Listener Category & gt; & Lt; / Listener & gt;  

When I delete the tag, this file is working on how I use applicationContext.xml

applicationContext.xml

  & lt; ? Xml version = "1.0" encoding = "UTF-8"? & Gt; I can include. & Lt; Beans xmlns = "http://www.springframework.org/schema/beans" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns: reference = "http: // www. Springframework.org/schema/context "xmlns: p =" http://www.springframework.org/schema/p "xmlns: mvc =" http://www.springframework.org/schema/mvc "xmlns: jd = "Http://www.springframework.org/schema/jdbc" xsi: Schema Location = "http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring- Bean-3.0 .xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/ Schema / MVC http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/ Spring-jdbc-3.0.xsd "& gt; & Lt ;! - To include one more base package - & gt; & Lt; Reference: Annotation-config / & gt; & Lt; Reference: component-scan base-package = "com.ankit.controller" /> & Lt; Reference: component-scan base-package = "com.ankit.service" /> & Lt; Mvc: annotation-operated / & gt; & Lt ;! - Added configuration has been added to enable memory - DB HSQLDB - & gt; & Lt ;! - & lt; Jd: embedded-database id = "data source 1" type = "hsqual" & gt; & Lt; Jd: script space = "classpath: schema.sql" /> & Lt; Jd: script space = "classpath: test-data.sql" /> & Lt; / JD: embedded-database & gt; - & gt; & Lt; Bean id = "SpringJDBCDo" class = "com.ankit.dao.impl.SpringJdbcDaoImpl" & gt; & Lt ;! - & lt; Property Name = "Data Source" Riff = "Datastra 1" /> - & gt; & Lt; / Bean & gt; & Lt; Bean id = "spring jdb service" category = "com.ankit.service.impl.SpringJdbcServiceImpl" & gt; & Lt; Property Name = "Vasant Jadi Bisidao" Riff = "Springjadi BCDDO" /> & Lt; / Bean & gt; & Lt; / Bean & gt;  

The first controller. Java

Package Com Comtrroler; Import organization Source: Import org.springframework.stereotype.Controller; Import organization Source: Import org.springframework.web.bind.annotation.RequestMapping; Import org.springframework.web.bind.annotation.RequestMethod; Import org.springframework.web.servlet.ModelAndView; Import com.ankit.beans.Employee; @ Controller Public Class First Controller {@Autowired com.ankit.service.SpringJdbcService springJdbcService; @RequestMapping (value = "/ searchJdbcContact", method = RequestMethod.GET) Public Model and Visual Search Tool () {employee vngmem = new employee (employee employee) = spring jdbcService.searchMemDts (vngmem); Return a new model and view ("Hello", "Message", Bean); }}

SpringJdbcService.java

  package com.ankit.service; Import com.ankit.beans.Employee; Public interface SpringJdbcService {employee search MemDts (employee vngmem); Zero summit MMMDT (employee membranesben); }  

SpringJdbcServiceImpl.java

  package com.ankit.service.impl; Import org.springframework.jdbc.BadSqlGrammarException; Import org.springframework.stereotype.Service; Import com.ankit.beans.Employee; Import com.ankit.service.SpringJdbcService; @Service Public Square SpringJdbcServiceImpl Applied SpringJdbcService {Public Employee Search MemDts (employee vngmem) {try {vngmem.setEmployeeName ("Ankit"); Return vngmem; } Hold (BadSqlGrammarException e) {e.printStackTrace (); } Hold (exception e) {e.printStackTrace (); } Return tap; }}  

and I am trying to hit this URL: Local Host: 8085 / mvc / searchJdbcContact.html


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -