SpringMVC项目找不到Controller

现象:

  新建一个Spring+SpringMVC的项目,配置文件都也检查无误,访问项目根目录下的index.jsp可以访问到,

  但是访问不到action,报错:No mapping found for HTTP request with URI [/test/testPlugAction/init] in DispatcherServlet with name 'dispatcher'

       在配置文件中添加<bean id="testPlugService" class="com.test.easyui.TestPlugServiceImpl"></bean>

  启动报错:org.springframework.beans.factory.CannotLoadBeanClassException:

       Cannot find class [com.test.easyui.TestPlugServiceImpl] for bean with name 'testPlugService' defined in ServletContext resource

        [/WEB-INF/applicationContext.xml];

       nested exception is java.lang.ClassNotFoundException: com.test.easyui.TestPlugServiceImpl找不到类

原因:

  打开项目的工作空间查看编译后的文件位置,如果在WEB-INF下没有classes文件,这就可能是以上报错现象的原因。

解决:

  修改项目编译文件的位置,在eclipse中选中项目右键-properties-Java Build Path-Source中,选择Default output folder把编译后的文件放在WEB-INF的classes文件夹中,

  如果没有classes文件夹可以新建一个,如下图:

  

 

 

转载于:https://www.cnblogs.com/nstart/p/7116895.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值