-
Spring MVC项目启动报错,百度没找到解决方案30
Spring MVC启动报错,错误日志如下:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#0': Cannot create inner bean '(inner bean)' of type [org.springframework.http.converter.ByteArrayHttpMessageConverter] while setting bean property 'messageConverters' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#3': Initialization of bean failed; nested exception is java.lang.ClassCastException: org.aspectj.weaver.ResolvedType$Array cannot be cast to org.aspectj.weaver.ReferenceType
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:281)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:125)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:353)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:153)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1360)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#3': Initialization of bean failed; nested exception is java.lang.ClassCastException: org.aspectj.weaver.ResolvedType$Array cannot be cast to org.aspectj.weaver.ReferenceType
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:270)
... 41 more
Caused by: java.lang.ClassCastException: org.aspectj.weaver.ResolvedType$Array cannot be cast to org.aspectj.weaver.ReferenceType
at org.aspectj.weaver.BoundedReferenceType.parameterize(BoundedReferenceType.java:64)
at org.aspectj.weaver.ResolvedType.parameterize(ResolvedType.java:1878)
at org.aspectj.weaver.ResolvedMemberImpl.parameterize(ResolvedMemberImpl.java:682)
at org.aspectj.weaver.ResolvedMemberImpl.parameterizedWith(ResolvedMemberImpl.java:644)
at org.aspectj.weaver.ResolvedMemberImpl.parameterizedWith(ResolvedMemberImpl.java:597)
at org.aspectj.weaver.ReferenceType.getDeclaredMethods(ReferenceType.java:512)
at org.aspectj.weaver.ResolvedType.addAndRecurse(ResolvedType.java:263)
at org.aspectj.weaver.ResolvedType.getMethodsWithoutIterator(ResolvedType.java:258)
at org.aspectj.weaver.ResolvedType.lookupResolvedMember(ResolvedType.java:379)
at org.aspectj.weaver.JoinPointSignatureIterator.findSignaturesFromSupertypes(JoinPointSignatureIterator.java:178)
at org.aspectj.weaver.JoinPointSignatureIterator.hasNext(JoinPointSignatureIterator.java:69)
at org.aspectj.weaver.patterns.SignaturePattern.matches(SignaturePattern.java:287)
at org.aspectj.weaver.patterns.KindedPointcut.matchInternal(KindedPointcut.java:106)
at org.aspectj.weaver.patterns.Pointcut.match(Pointcut.java:146)
at org.aspectj.weaver.internal.tools.PointcutExpressionImpl.getShadowMatch(PointcutExpressionImpl.java:235)
at org.aspectj.weaver.internal.tools.PointcutExpressionImpl.matchesExecution(PointcutExpressionImpl.java:101)
at org.aspectj.weaver.internal.tools.PointcutExpressionImpl.matchesMethodExecution(PointcutExpressionImpl.java:92)
at org.springframework.aop.aspectj.AspectJExpressionPointcut.getShadowMatch(AspectJExpressionPointcut.java:403)
at org.springframework.aop.aspectj.AspectJExpressionPointcut.matches(AspectJExpressionPointcut.java:272)
at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:225)
at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:263)
at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:295)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findAdvisorsThatCanApply(AbstractAdvisorAutoProxyCreator.java:117)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:87)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:68)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:359)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:322)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:407)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1461)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
... 43 more
applicationContext.xml配置文件如下:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-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/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd "> <context:component-scan base-package="com.*" /> <mvc:annotation-driven /> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location" value="classpath:hibernate.properties" /> </bean> <mvc:interceptors> <mvc:interceptor> <mvc:mapping path="/**/*.do" /> <bean class="com.common.interceptor.NeedLogin"></bean> </mvc:interceptor> </mvc:interceptors> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="${dataSource.driverClassName}" /> <property name="jdbcUrl" value="${dataSource.url}" /> <property name="user" value="${dataSource.userName}" /> <property name="password" value="${dataSource.password}" /> <property name="maxPoolSize" value="${dataSource.maxPoolSize}" /> <property name="minPoolSize" value="${dataSource.minPoolSize}" /> <property name="initialPoolSize" value="${dataSource.initialPoolSize}" /> <property name="maxIdleTime" value="${dataSource.maxIdleTime}" /> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${dataSource.dialect}</prop> <prop key="hibernate.show_sql">${dataSource.hibernate.show_sql}</prop> <prop key="hibernate.format_sql">${dataSource.hibernate.format_sql}</prop> <prop key="hibernate.hbm2ddl.auto">${dataSource.hbm2ddl.auto}</prop> </props> </property> <property name="mappingResources"> <list> </list> </property> </bean> <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager" p:sessionFactory-ref="sessionFactory"> </bean> <aop:config proxy-target-class="true"> <aop:pointcut id="serviceMethod" expression="execution(* com.login.service.impl.*.*(..))" /> <aop:advisor pointcut-ref="serviceMethod" advice-ref="txAdvice" /> </aop:config> <tx:advice id="txAdvice" transaction-manager="txManager"> <!--事务属性定义--> <tx:attributes> <tx:method name="add*" propagation="REQUIRED" rollback-for="Exception" /> <tx:method name="del*" propagation="REQUIRED" rollback-for="Exception" /> <tx:method name="modify*" propagation="REQUIRED" rollback-for="Exception" /> </tx:attributes> </tx:advice> </beans>
2012年10月29日 22:12
1个答案 按时间排序 按投票排序
-
采纳的答案
下载aspectj-1.6.10.jar和aspectjweaver-1.6.9
参考:http://stackoverflow.com/questions/4243710/spring-application-context-load-order
一样的错误。。。2012年10月29日 22:25
相关推荐
#### 六、常见问题及解决方案 1. **访问出现404错误**: - 检查控制台输出,查看是否有缺失的jar包。 - 如果jar包已存在但仍然报错,检查IDEA中的项目发布设置是否正确添加了lib依赖。 - 重启Tomcat服务器。 ...
### Spring Boot项目导出WAR包并部署到Tomcat遇到404错误的解析与解决方案 在实际开发过程中,经常会遇到将Spring Boot应用打包为WAR格式并部署至Tomcat服务器的需求。这种方式可以更好地与传统Java Web项目的部署...
项目搭建源码资料中,开发者可以找到如何配置和整合这些技术的具体步骤,包括Spring的配置文件、Spring MVC的控制器实现、Mybatis的Mapper接口和XML配置、Dubbo的provider和consumer配置,以及Zookeeper的客户端连接...
ShardingJDBC是阿里巴巴开源的轻量级数据库中间件,它提供了一种数据库分片解决方案,用于解决单一数据库无法处理大量数据的问题。这里提到的“只分表不分库”意味着项目仅对单个数据库内的表进行了水平拆分,而没有...
实战项目的构建过程不仅涵盖了基础的技术栈选择和组件使用,还深入到了具体的功能实现细节和技术难点解决方案,对于想要深入了解Spring Boot并应用于实际项目中的开发者来说是非常宝贵的参考资料。
总之,Spring框架提供了一站式的解决方案,涵盖了从基础的依赖注入到复杂的Web和数据库操作,以及面向切面编程,大大简化了Java应用的开发工作。理解并熟练运用Spring的各个组件和机制,可以帮助开发者更高效地编写...
以上是项目开发过程中遇到的一些典型问题及其解决方案,这些知识对于Java开发者来说是非常基础且重要的。掌握这些技巧可以提高开发效率,解决实际问题。在遇到类似问题时,可以参考这些经验进行排查和处理。
Struts2作为MVC设计模式的实现,负责处理HTTP请求和响应,提供了一种灵活的控制层解决方案。在项目中,Struts2用于接收用户请求,调用业务逻辑,然后返回相应的视图。配置Action和结果映射,以及拦截器,都是Struts...
spring配置是jwx必须的,如果没有配置spring上下文,jwx在启动阶段会报错。 url-pattern模式匹配微信公众号平台服务器配置的URL配置,如果需要处理多个微信公众号,可以配置多个servlet-mapping或者使用路径通配符...
总的来说,SSH框架结合了Struts2的MVC功能、Spring的DI/AOP和事务管理、以及Hibernate的ORM特性,为Java Web开发提供了一套高效且灵活的解决方案。通过Maven进行项目构建,可以更方便地管理和控制依赖,加速开发流程...
这说明了Spring Boot社区已经积累了相当多的案例和解决方案,对于开发者来说,可以利用这些现成的资源来快速定位和解决问题。总之,理解和运用好Spring Boot的资源访问机制,对于开发和部署Spring Boot项目是至关...
本篇文章将详细介绍如何将这三者集成,以及在集成过程中可能遇到的问题及其解决方案。 首先,SpringBoot是由Pivotal团队维护的一个开源框架,它旨在简化Spring应用的初始搭建以及开发过程。SpringBoot通过自动配置...
- 一站式支付解决方案,统一下单接口,支持支付宝、微信、网银等多种支付方式。不涉及业务的纯粹的支付平台。 - 统一下单(统一下单接口、统一扫码)、订单管理、数据分析、财务报表、商户管理、渠道管理、对账系统...
这个问题的解决方案是,对于那些与特定请求相关的数据,不应该使用ThreadLocal来存储,尤其是在Servlet容器中。如果确实需要使用ThreadLocal,务必要在请求结束时正确清理,或者使用其他机制(如HttpSession)来存储...
### 自整理Java关于基础和框架的面试题 #### 基础知识点 ##### JDK常用的包 - **java.lang**: 包含所有基本类,如`String`、`Math`等。...- Spring是一个开源框架,提供了一整套的企业级服务解决方案...