首页 新闻 会员 周边 捐助

请各位前辈帮我看一下spring的bean,在线等,加班等

0
悬赏园豆:10 [已解决问题] 解决于 2016-10-21 09:36

请各路前辈点化,我的需求是整合shiro、spring、mybatis,跟着这个视频做的 http://www.56.com/u88/v_MTQwMjEyMzI1.html ,这就是我写的项目,

web.xml配置文件内容是下面这个(我的Q2789307885)晚上加班也要等。

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance http://www.springmodules.org/schema/cache/springmodules-cache.xsd
 3    http://www.springmodules.org/schema/cache/springmodules-ehcache.xsd " xmlns="http://java.sun.com/xml/ns/javaee"
 4  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
 5  id="WebApp_ID" version="2.5">
 6   <display-name>ShiroWeb03</display-name>
 7   <welcome-file-list>
 8     <welcome-file>index.html</welcome-file>
 9     <welcome-file>index.htm</welcome-file>
10     <welcome-file>index.jsp</welcome-file>
11     <welcome-file>default.html</welcome-file>
12     <welcome-file>default.htm</welcome-file>
13     <welcome-file>default.jsp</welcome-file>
14   </welcome-file-list>
15   
16   <!-- shiro过滤器定义 -->
17   <filter>
18       <filter-name>shiroFilter</filter-name>
19       <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
20       <init-param>
21           <!-- 该值缺省为false,表示生命周期由SpringApplicationContext管理,设置为true,表示由ServletContainer管理 -->
22           <param-name>targetFilterLifecycle</param-name>
23           <param-value>true</param-value>
24       </init-param>
25   </filter>
26   <filter-mapping>
27       <filter-name>shiroFilter</filter-name>
28       <url-pattern>/*</url-pattern>
29   </filter-mapping>
30   
31   <!-- spring配置文件 -->
32   <context-param>
33       <param-name>contextConfigLocation</param-name>
34       <param-value>classpath:applicationContext.xml</param-value>
35   </context-param>
36   <!-- 编码过滤器 -->
37   <filter>
38       <filter-name>encodingFilter</filter-name>
39       <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
40       <async-supported>true</async-supported>
41       <init-param>
42           <param-name>encoding</param-name>
43           <param-value>UTF-8</param-value>
44       </init-param>
45   </filter>
46   <filter-mapping>
47       <filter-name>encodingFilter</filter-name>
48       <url-pattern>/*</url-pattern>
49   </filter-mapping>
50   <!-- Spring监听器 -->
51   <listener>
52       <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
53   </listener>
54   <!-- 添加对springmvc的支持 -->
55   <servlet>
56       <servlet-name>springMVC</servlet-name>
57       <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
58       <init-param>
59           <param-name>contextConfigLocation</param-name>
60           <param-value>classpath*:spring-mvc.xml</param-value>
61       </init-param>
62       <load-on-startup>1</load-on-startup>
63       <async-supported>true</async-supported>
64   </servlet>
65   <servlet-mapping>
66       <servlet-name>springMVC</servlet-name>
67       <url-pattern>*.do</url-pattern>
68   </servlet-mapping>
69 </web-app>

下面这个是spring-MVC.xml配置

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <beans xmlns="http://www.springframework.org/schema/beans"
 3        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 4        xmlns:p="http://www.springframework.org/schema/p"
 5        xmlns:context="http://www.springframework.org/schema/context"
 6        xmlns:aop="http://www.springframework.org/schema/aop"
 7        xmlns:tx="http://www.springframework.org/schema/tx"
 8        xmlns:jee="http://www.springframework.org/schema/jee"
 9        xsi:schemaLocation="http://www.springframework.org/schema/beans
10             http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
11             http://www.springframework.org/schema/context 
12             http://www.springframework.org/schema/context/spring-context-3.0.xsd
13             http://www.springframework.org/schema/aop 
14             http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
15             http://www.springframework.org/schema/jee
16             http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
17             http://www.springframework.org/schema/tx 
18             http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
19             http://www.springframework.org/schema/context 
20             http://www.springframework.org/schema/context/spring-context-3.0.xsd">
21     <!--
22         使Spring支持自动检测组件,如注解的Controller,使用注解的包,包括子集
23     -->
24     <context:component-scan base-package="com.java1234.controller"/>
25     
26     <!-- 视图解析器 -->
27     <bean id="viewResolver"
28         class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping">
29         <property name="prefix" value="/"></property>
30         <property name="suffix" value=".jsp"></property>
31     </bean>
32 </beans>

这下面就是applicationContext.xml配置文件

  1 <?xml version="1.0" encoding="UTF-8"?>
  2 <beans xmlns="http://www.springframework.org/schema/beans"
  3        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4        xmlns:p="http://www.springframework.org/schema/p"
  5        xmlns:context="http://www.springframework.org/schema/context"
  6        xmlns:aop="http://www.springframework.org/schema/aop"
  7        xmlns:tx="http://www.springframework.org/schema/tx"
  8        xmlns:jee="http://www.springframework.org/schema/jee"
  9        xsi:schemaLocation="http://www.springframework.org/schema/beans
 10             http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
 11             http://www.springframework.org/schema/context 
 12             http://www.springframework.org/schema/context/spring-context-3.0.xsd
 13             http://www.springframework.org/schema/aop 
 14             http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
 15             http://www.springframework.org/schema/jee
 16             http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
 17             http://www.springframework.org/schema/tx 
 18             http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
 19             http://www.springframework.org/schema/context 
 20             http://www.springframework.org/schema/context/spring-context-3.0.xsd">
 21     <!--
 22             自动扫描
 23     -->
 24     <context:component-scan base-package="com.java1234.service"/>
 25     
 26     <!-- 配置数据源 -->
 27     <bean id="dataSource"
 28         class="org.springframework.jdbc.datasource.DriverManagerDataSource">
 29         <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"></property>
 30         <property name="url" value="jdbc:oracle:thin:@192.168.0.144:1521:orcl"></property>
 31         <property name="username" value="rycf"/>
 32         <property name="password" value="rycf"/>
 33     </bean>
 34     <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
 35         <property name="dataSource" ref="dataSource"/>
 36         <property name="mapperLocations" value="classpath:com/java1234/mappers/*.xml"/>
 37         <property name="configLocation" value="classpath:mybatis-config.xml"/>
 38     </bean>
 39     
 40     <!-- dao接口所在包名,spring会自动查找其下类 -->
 41     <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
 42         <property name="basePackage" value="com.java1234.dao"/>
 43         <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
 44     </bean>
 45     <!-- 事务管理 -->
 46     <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
 47         <property name="dataSource" ref="dataSource"/>
 48     </bean>
 49     <!-- 自定义Realm -->
 50     <bean id="myRealm" class="com.java1234.realm.MyRealm"/>
 51     <!-- 安全管理器 -->
 52     <bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
 53         <property name="realm" ref="myRealm"/>
 54     </bean>
 55     <!-- Shiro过滤器 -->
 56     <bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
 57         <!-- shiro的核心安全接口,这个属性是必须的 -->
 58         <property name="securityManager" ref="securityManager"/>
 59         <!-- 失败进入登录页面 -->
 60         <property name="loginUrl" value="/login.jsp"/>
 61         <!-- 失败进入指定页面 -->
 62         <property name="unauthorizedUrl" value="/unauthorized.jsp"/>
 63         <!-- Shiro连接约束配置,过滤链 -->
 64         <property name="filterChainDefinitions">
 65             <value>
 66                 /login=anon
 67                 /userClass_Admin=authc
 68                 /student=roles[teacher]
 69                 /teacher=perms["user:create"]
 70                 /superadmin=roles[super:*]
 71             </value>
 72         </property>
 73     </bean>
 74     <!-- 保证实现了Shiro内部lifecycle函数的bean执行 -->
 75     <bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>
 76     <!-- 开启Shiro注解 -->
 77     <bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" depends-on="lifecycleBeanPostProcessor"/>
 78     <bean class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
 79         <property name="securityManager" ref="securityManager"/>
 80     </bean>    
 81     <!-- 配置事务通知属性 -->
 82     <tx:advice id="txAdvice" transaction-manager="transactionManager">
 83         <!-- 定义事务传播属性 -->
 84         <tx:attributes>
 85             <tx:method name="insert*" propagation="REQUIRED"/>
 86             <tx:method name="update*" propagation="REQUIRED"/>
 87             <tx:method name="edit*" propagation="REQUIRED"/>
 88             <tx:method name="save*" propagation="REQUIRED"/>
 89             <tx:method name="add*" propagation="REQUIRED"/>
 90             <tx:method name="new*" propagation="REQUIRED"/>
 91             <tx:method name="set*" propagation="REQUIRED"/>
 92             <tx:method name="remove*" propagation="REQUIRED"/>
 93             <tx:method name="delete*" propagation="REQUIRED"/>
 94             <tx:method name="change*" propagation="REQUIRED"/>
 95             <tx:method name="check*" propagation="REQUIRED"/>
 96             <tx:method name="get*" propagation="REQUIRED" read-only="true"/>
 97             <tx:method name="find*" propagation="REQUIRED" read-only="true"/>
 98             <tx:method name="load*" propagation="REQUIRED" read-only="true"/>
 99             <tx:method name="*" propagation="REQUIRED" read-only="true"/>
100         </tx:attributes>
101     </tx:advice>
102     <!-- 配置事务切面 -->
103     <aop:config>
104         <aop:pointcut id="serviceOperation" expression="execution(* com.java1234.service.*.*(..))" />
105         <aop:advisor advice-ref="txAdvice" pointcut-ref="serviceOperation"/>
106     </aop:config>
107 </beans>

哎,报错信息就是下面这一大坨了

INFO: Initializing Spring FrameworkServlet 'springMVC'
2016-10-20 17:14:34,181 WARN  [AbstractApplicationContext.java:487] : Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping': Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/web/cors/CorsProcessor
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1101)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:291)
    at org.springframework.web.servlet.DispatcherServlet.createDefaultStrategy(DispatcherServlet.java:853)
    at org.springframework.web.servlet.DispatcherServlet.getDefaultStrategies(DispatcherServlet.java:821)
    at org.springframework.web.servlet.DispatcherServlet.initHandlerMappings(DispatcherServlet.java:592)
    at org.springframework.web.servlet.DispatcherServlet.initStrategies(DispatcherServlet.java:487)
    at org.springframework.web.servlet.DispatcherServlet.onRefresh(DispatcherServlet.java:476)
    at org.springframework.web.servlet.FrameworkServlet.onApplicationEvent(FrameworkServlet.java:806)
    at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1121)
    at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1117)
    at org.springframework.context.event.GenericApplicationListenerAdapter.onApplicationEvent(GenericApplicationListenerAdapter.java:52)
    at org.springframework.context.event.SourceFilteringListener.onApplicationEventInternal(SourceFilteringListener.java:100)
    at org.springframework.context.event.SourceFilteringListener.onApplicationEvent(SourceFilteringListener.java:69)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:773)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:634)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:682)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:553)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5253)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5543)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1978)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NoClassDefFoundError: org/springframework/web/cors/CorsProcessor
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404)
    at java.lang.Class.getConstructor0(Class.java:2714)
    at java.lang.Class.getDeclaredConstructor(Class.java:2002)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:80)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1094)
    ... 44 more
Caused by: java.lang.ClassNotFoundException: org.springframework.web.cors.CorsProcessor
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1854)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1703)
    ... 50 more
2016-10-20 17:14:34,184 ERROR [FrameworkServlet.java:502] : Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping': Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/web/cors/CorsProcessor
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1101)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:291)
    at org.springframework.web.servlet.DispatcherServlet.createDefaultStrategy(DispatcherServlet.java:853)
    at org.springframework.web.servlet.DispatcherServlet.getDefaultStrategies(DispatcherServlet.java:821)
    at org.springframework.web.servlet.DispatcherServlet.initHandlerMappings(DispatcherServlet.java:592)
    at org.springframework.web.servlet.DispatcherServlet.initStrategies(DispatcherServlet.java:487)
    at org.springframework.web.servlet.DispatcherServlet.onRefresh(DispatcherServlet.java:476)
    at org.springframework.web.servlet.FrameworkServlet.onApplicationEvent(FrameworkServlet.java:806)
    at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1121)
    at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1117)
    at org.springframework.context.event.GenericApplicationListenerAdapter.onApplicationEvent(GenericApplicationListenerAdapter.java:52)
    at org.springframework.context.event.SourceFilteringListener.onApplicationEventInternal(SourceFilteringListener.java:100)
    at org.springframework.context.event.SourceFilteringListener.onApplicationEvent(SourceFilteringListener.java:69)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:773)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:634)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:682)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:553)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5253)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5543)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1978)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NoClassDefFoundError: org/springframework/web/cors/CorsProcessor
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404)
    at java.lang.Class.getConstructor0(Class.java:2714)
    at java.lang.Class.getDeclaredConstructor(Class.java:2002)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:80)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1094)
    ... 44 more
Caused by: java.lang.ClassNotFoundException: org.springframework.web.cors.CorsProcessor
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1854)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1703)
    ... 50 more
十月 20, 2016 5:14:34 下午 org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping': Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/web/cors/CorsProcessor
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1101)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:291)
    at org.springframework.web.servlet.DispatcherServlet.createDefaultStrategy(DispatcherServlet.java:853)
    at org.springframework.web.servlet.DispatcherServlet.getDefaultStrategies(DispatcherServlet.java:821)
    at org.springframework.web.servlet.DispatcherServlet.initHandlerMappings(DispatcherServlet.java:592)
    at org.springframework.web.servlet.DispatcherServlet.initStrategies(DispatcherServlet.java:487)
    at org.springframework.web.servlet.DispatcherServlet.onRefresh(DispatcherServlet.java:476)
    at org.springframework.web.servlet.FrameworkServlet.onApplicationEvent(FrameworkServlet.java:806)
    at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1121)
    at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1117)
    at org.springframework.context.event.GenericApplicationListenerAdapter.onApplicationEvent(GenericApplicationListenerAdapter.java:52)
    at org.springframework.context.event.SourceFilteringListener.onApplicationEventInternal(SourceFilteringListener.java:100)
    at org.springframework.context.event.SourceFilteringListener.onApplicationEvent(SourceFilteringListener.java:69)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:773)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:634)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:682)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:553)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5253)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5543)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1978)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NoClassDefFoundError: org/springframework/web/cors/CorsProcessor
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404)
    at java.lang.Class.getConstructor0(Class.java:2714)
    at java.lang.Class.getDeclaredConstructor(Class.java:2002)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:80)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1094)
    ... 44 more
Caused by: java.lang.ClassNotFoundException: org.springframework.web.cors.CorsProcessor
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1854)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1703)
    ... 50 more
十月 20, 2016 5:14:34 下午 org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet [springMVC] in web application [/ShiroSpring1] threw load() exception
java.lang.ClassNotFoundException: org.springframework.web.cors.CorsProcessor
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1854)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1703)
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404)
    at java.lang.Class.getConstructor0(Class.java:2714)
    at java.lang.Class.getDeclaredConstructor(Class.java:2002)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:80)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1094)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:291)
    at org.springframework.web.servlet.DispatcherServlet.createDefaultStrategy(DispatcherServlet.java:853)
    at org.springframework.web.servlet.DispatcherServlet.getDefaultStrategies(DispatcherServlet.java:821)
    at org.springframework.web.servlet.DispatcherServlet.initHandlerMappings(DispatcherServlet.java:592)
    at org.springframework.web.servlet.DispatcherServlet.initStrategies(DispatcherServlet.java:487)
    at org.springframework.web.servlet.DispatcherServlet.onRefresh(DispatcherServlet.java:476)
    at org.springframework.web.servlet.FrameworkServlet.onApplicationEvent(FrameworkServlet.java:806)
    at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1121)
    at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1117)
    at org.springframework.context.event.GenericApplicationListenerAdapter.onApplicationEvent(GenericApplicationListenerAdapter.java:52)
    at org.springframework.context.event.SourceFilteringListener.onApplicationEventInternal(SourceFilteringListener.java:100)
    at org.springframework.context.event.SourceFilteringListener.onApplicationEvent(SourceFilteringListener.java:69)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:773)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:634)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:682)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:553)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5253)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5543)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1978)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
十月 20, 2016 5:14:34 下午 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory D:\Tomcat7.0\webapps\ShiroSpring1 has finished in 2,784 ms
十月 20, 2016 5:14:34 下午 org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-apr-8080"]
十月 20, 2016 5:14:34 下午 org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-apr-8009"]
十月 20, 2016 5:14:34 下午 org.apache.catalina.startup.Catalina start
INFO: Server startup in 3254 ms
问题补充:

搜百度搜的头都要炸了,不过我不会放弃的,启动tomcat的时候就死了

根目录97的主页 根目录97 | 初学一级 | 园豆:8
提问于:2016-10-20 17:40
< >
分享
最佳答案
0

这是因为spring-webmvc与spring-web的版本不对应导致的问题

根目录97 | 初学一级 |园豆:8 | 2016-10-21 09:35
其他回答(1)
0

那么多,看的头都炸了

收获园豆:10
laugher_ccc | 园豆:593 (小虾三级) | 2016-10-20 19:30

遇到这种问题,何不重新来 一遍

 

支持(0) 反对(0) laugher_ccc | 园豆:593 (小虾三级) | 2016-10-20 19:31

@laugher_ccc: 嗯,谢谢,应该是jar的问题

支持(0) 反对(0) 根目录97 | 园豆:8 (初学一级) | 2016-10-21 09:34

boom!

支持(0) 反对(0) 根目录97 | 园豆:8 (初学一级) | 2016-10-21 09:34
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册