I/O failure during classpath scanning in spring MVC

来源:互联网 发布:dnf制裁秒淘宝能解么 编辑:程序博客网 时间:2024/06/03 18:44

I/O failure during classpath scanning in spring MVC

up vote0down votefavorite

Hi I am new to Spring and I am trying to do a simple spring mvc application which accepts values from customer form and displays the same in the same in the UI. Now the problem is when I try to publish the code in Jboss server I am getting the following error message:

14:40:31,555 ERROR [ContextLoader] Context initialization failedorg.springframework.beans.factory.BeanDefinitionStoreException: I/O failure during classpath scanning; nested exception is java.io.FileNotFoundException: D:\jboss-5.1.0.GA\server\default\deploy\SpringMVC.war\WEB-INF\classes\com\spring\customer\controller (The system cannot find the path specified)at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:222)at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:201)at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:84)at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69)

Here is my web.xml:

<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" id="WebApp_ID" version="2.5"><display-name>SpringMVC</display-name><servlet>   <servlet-name>mvc-dispatcher</servlet-name>   <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>   <load-on-startup>1</load-on-startup></servlet><servlet-mapping>     <servlet-name>mvc-dispatcher</servlet-name>     <url-pattern>*.htm</url-pattern></servlet-mapping><context-param><param-name>contextConfigLocation</param-name><param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value></context-param><listener>  <listener-class>    org.springframework.web.context.ContextLoaderListener  </listener-class></listener><error-page><error-code>404</error-code><location>/WEB-INF/pages/404.jsp</location></error-page><error-page><exception-type>java.lang.Exception</exception-type><location>/WEB-INF/pages/404.jsp</location></error-page></web-app>

And the Dispatcher Servlet code is as follows:

<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-2.5.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-2.5.xsd"><context:component-scan base-package="com.spring.customer.controller" /><bean class="com.spring.customer.validator.CustomerValidator" /><!-- Register the Customer.properties --><bean id="messageSource"    class="org.springframework.context.support.ResourceBundleMessageSource">    <property name="basename" value="com/spring/customer/properties/Customer" /></bean>    <bean id="viewResolver"      class="org.springframework.web.servlet.view.InternalResourceViewResolver" >      <property name="prefix">          <value>/WEB-INF/pages/</value>       </property>      <property name="suffix">         <value>.jsp</value>      </property></bean>

I tried searching in google but could not find what is wrong. I have been breaking my head for this issue for almost 2 hours. Some one help!!

P.S: I am using maven.

Thanks in advance

shareimprove this question
 
 
spring is trying to find the controllers at com.spring.customer.controller package. is this package correct? – Deividi Cavarzan May 8 '13 at 13:09
 
@DeividiCavarzan As I said I am using maven and the CustomerController.class file is in the location "web-inf/classes/com/spring/customer/controller" inside the folder named "target". – Venu May 8 '13 at 17:12

1 Answer

activeoldestvotes
up vote0down vote

There is :

<context:component-scan base-package="com.spring.customer.controller" />

and it seems you don't have such package in you application, but Spring is searching this package (so a directory) to find components.

Please verify that in binaries you have such package (or maybe you don't have this package at all?)

shareimprove this answer
0 0
原创粉丝点击