I/O failure during classpath scanning in spring MVC

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 failed
org.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.xsd
http://www.springframework.org/schema/context
http://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

share improve 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

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

share improve this answer
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值