- 浏览: 1233353 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (883)
- Spring (101)
- Swing (1)
- Mysql (21)
- Js (59)
- Jsp (2)
- Hibernate (19)
- Myeclipse (5)
- SqlServer 2000 (2)
- poi (15)
- Java (70)
- SSH (12)
- Html (47)
- Fusion Charts (1)
- C\C++ (2)
- 汇编 (36)
- Jquery (37)
- Struts2 (6)
- Ubuntu (16)
- powerDesinger (4)
- Jboss (3)
- JAX-RS (13)
- JAXB (5)
- JAX-WS (11)
- JMS (4)
- WebSocket (8)
- PHP (16)
- Flash (1)
- maven (3)
- Oracle (8)
- HttpClient (6)
- sqlserver (19)
- svn (5)
- Tomcat (3)
- Jdbc (3)
- EsayUi (11)
- 微信公众平台 (19)
- IIS (2)
- Freemarker (11)
- Comet (1)
- Spring MVC (85)
- JBoss Seam (3)
- 二维码 (9)
- Spring Security (4)
- Ehcache (3)
- Apache Shiro (7)
- jackson (16)
- JPA (8)
- jcaptcha (2)
- RSA (2)
- Ajax (6)
- 跟我学Shiro (0)
- Spring4 (19)
- 跟我学spring3 (0)
- css (32)
- excel (4)
- Filter (3)
- 微信公众帐号开发教程 (0)
- Android (6)
- log4j (6)
- 淘宝接口 (17)
- 支付集成 (3)
- 单点登录 (3)
- Html5 (27)
- 移动平台前端 (3)
- Linux (44)
- FusionCharts (27)
- Json Jackson Xml (5)
- 方培工作室-微信开发 (0)
- Apache与Tomcat与IIS整合 (10)
- Nginx (17)
- webService (2)
- apache (4)
- lucene (3)
- lodop (2)
- Shiro (3)
- zTree (2)
- ireport (12)
- Servlet3.0 (5)
- 前端美工 (19)
- AngularJS (1)
- C#开发微信门户及应用 (0)
- Shell (3)
- bat脚本 (16)
- Bootstrap (26)
- Less (10)
- photoshop (6)
- Redis (6)
- Mongodb (10)
- MyBatis (3)
- 数据结构 (0)
- 读写分离-主从复制 (0)
- JFinal (0)
- 百度地图api (3)
- hadoop-hbase-hive-spark (3)
- WebStorm (2)
- Quartz (5)
- ios (0)
- Mina (8)
- Android Studio (4)
- Ratchet教程 (0)
- 移动端重构系列 (1)
- cubic-bezier贝塞尔曲线CSS3动画工具 (1)
- nginx+tomcat+memcached集群 (0)
- 集群 (0)
- ZooKeeper (3)
- Dubbo (0)
- vpn (0)
- kafka (0)
- JVM垃圾回收机制 (0)
- 微信小程序 (0)
- Lua (0)
- Hystrix (0)
- Vue.js (0)
- mycat (0)
- Openresty (0)
- springBoot (0)
- 新分类 (0)
- guava (0)
- 大数据 (0)
- Sentinel (0)
最新评论
-
JackMacing:
中文怎么解决?
SpringMVC与iReport(JasperReports) 5.6整合开发实例 -
18335864773:
用pageoffice把.可以实现在线的文档操作.直接转pdf ...
转:使用jasperreport动态生成pdf,excel,html -
linhao0907:
推荐一款轻量开源的支付宝组件:https://github.c ...
关于Alipay支付宝接口(Java版) -
songronghu:
太好了,非常有用,谢谢分享~
Java ConcurrentModificationException 异常分析与解决方案 -
wzwahl36:
http://www.atool.org/json2javab ...
Java下利用Jackson进行JSON解析和序列化
struts2.1.6+hibernate3.3+spring3.0遇到的问题
首先进行单元测试:出现问题
package com.zzc.junit; import java.util.List; import javax.annotation.Resource; import org.junit.Test; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; import org.springframework.transaction.annotation.Transactional; import com.zzc.dao.SqlServerDao; @ContextConfiguration("classpath:applicationContext.xml") public class Test1 extends AbstractJUnit4SpringContextTests { SqlServerDao sqlServerDAO; @Test public void query() { List<String> list = sqlServerDAO.query(); for(String s : list) { System.out.println(s); } } public SqlServerDao getSqlServerDAO() { return sqlServerDAO; } @Resource(name="sqlServerDao") public void setSqlServerDAO(SqlServerDao sqlServerDAO) { this.sqlServerDAO = sqlServerDAO; } }
问题1:
Caused by: java.lang.NoClassDefFoundError: org/junit/runners/BlockJUnit4ClassRunner
上网查看了下,原来是junit的jar包版本问题,spring2.5.6配搭junit4.4是没有问题的,但是spring3.0配搭junit4.4,使用了
@ContextConfiguration等spring3.0新的annotation就会有问题,将junit4.4改为junit4.82版本,问题解决。
问题2:
org/aopalliance/intercept/MethodInterceptor
Spring3.0 运行问题
报的错误是:java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor
上网查了下,这可能是spring3.0特有的问题,2.5就没有!出错的原因是少了个包,解决的方案是去
http://sourceforge.net/projects/aopalliance/files/下载aopalliance-alpha1.jar,加到路径里,就行了!
spring3.0比2.5需要好多额外的包,除了上面的aopalliance外,还可能会需要asm和cglib!
下载加入了aopalliance-alpha1.jar,进行测试,再次抛出异常:
问题3:
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class
[org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator]: Constructor threw exception; nested
exception is java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice
Caused by: java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice
上网查看,发现又少了 com.springsource.org.aopalliance-1.0.0.jar 的jar包
com.springsource.org.aopalliance-1.0.0.jar
下载地址:
ce.org.aopalliance-1.0.0.jar
问题4:
再次进行测试,又出现了新的问题:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlServerDao' defined in
file [E:\dormitory\Dormitory\WebRoot\WEB-INF\classes\com\zzc\dao\impl\SqlServerDaoImpl.class]: Initialization of bean failed;
nested exception is org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named
'org.springframework.transaction.interceptor.TransactionInterceptor#0' must be of type [org.aopalliance.aop.Advice], but was
actually of type [org.springframework.transaction.interceptor.TransactionInterceptor]
Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named
'org.springframework.transaction.interceptor.TransactionInterceptor#0' must be of type [org.aopalliance.aop.Advice], but was
actually of type [org.springframework.transaction.interceptor.TransactionInterceptor]
解决方案:
将applicationContext.xml中的<tx:annotation-driven transaction-manager="transactionManager" />这一行注释掉
再运行,通过了。 但存在的问题是 事务不能工作了。
再解决:
TransactionInterceptor是 org.aopalliance.aop.Advice 的一个实现,可能是Jar包的冲突。
到jar包中去查看。
我的问题是: aopalliance-1.0.jar 和 aopalliance-alpha1.jar之间的冲突。
将aopalliance-alpha1.jar去掉,再运行就OK了。
问题5:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlServerDao' defined in
file [E:\dormitory\Dormitory\WebRoot\WEB-INF\classes\com\zzc\dao\impl\SqlServerDaoImpl.class]: BeanPostProcessor before
instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Aspect
Caused by: java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Aspect
加入aspectjrt.jar和aspectjweaver.jar,问题解决
问题6:
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class
[com.mchange.v2.c3p0.ComboPooledDataSource] for bean with name 'sqlServerDataSource' defined in class path resource
[applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: com.mchange.v2.c3p0.ComboPooledDataSource
Caused by: java.lang.ClassNotFoundException: com.mchange.v2.c3p0.ComboPooledDataSource
一看知道,少了c3p0的jar,因为我使用了c3p0的数据源
<bean id="mysqlDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="org.gjt.mm.mysql.Driver"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/dormitory? useUnicode=true&characterEncoding=UTF-8"/> <property name="user" value="root"/> <property name="password" value="123456"/> <!--初始化时获取的连接数,取值应在minPoolSize与maxPoolSize之间。Default: 3 --> <property name="initialPoolSize" value="3"/> <!-- 连接池中保留的最小连接数。 --> <property name="minPoolSize" value="1"/> <!-- 连接池中保留的最大连接数。Default: 15 --> <property name="maxPoolSize" value="300"/> <!-- 最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 --> <property name="maxIdleTime" value="60"/> <!-- 当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 --> <property name="acquireIncrement" value="5"/> <!-- 每60秒检查所有连接池中的空闲连接。Default: 0 --> <property name="idleConnectionTestPeriod" value="60"/> </bean>
加入c3p0-0.9.1.2.jar,问题解决
评论
发表评论
-
spring boot整合mybatis+mybatis-plus
2019-02-08 23:58 0https://www.cnblogs.com/lia ... -
Spring点滴 Spring实战系列
2018-11-14 18:06 0https://www.cnblogs.com/si ... -
(亲测可用)Description Resource Path Location Type Java compiler level does not match
2017-06-13 10:54 0解决办法 在项目上右键Properties-》Pro ... -
易百教程
2017-06-07 14:00 0http://www.yiibai.com/lua/l ... -
Hibernate原生SQL查询
2017-04-10 14:20 0http://blog.csdn.net/houpe ... -
关于Spring Data redis几种对象序列化的比较
2016-09-06 15:01 0问题 最近在整一个spring data r ... -
spring 结合 Redis 例子,简单入门例子
2016-09-05 10:51 0http://oyhk.iteye.com/blog/ ... -
spring与redis集成之aop整合方案
2016-09-05 10:20 0http://blog.csdn.net/zhann ... -
Dubbo搭建例子
2016-09-03 17:35 0http://blog.csdn.net/lzxads ... -
集群部署服务和消费者测试(1)
2016-09-03 17:10 0修改dp和dc程序为注册到集群zookeeper中 ... -
zookeeper 服务器安装 单例和集群
2016-09-03 17:02 0http://blog.csdn.net/fangxi ... -
dubbo起步搭建Spring+SpringMVC+dubbo的开发环境
2016-09-03 16:49 0http://blog.csdn.net/fangxi ... -
Memcached与Spring AOP构建数分布式据库前端缓存框架
2016-09-02 22:19 0由于上一篇有介绍了Memcached缓存,并集群部 ... -
Dubbo与Zookeeper、SpringMVC整合和使用(负载均衡、容错)
2016-09-02 22:11 0原文链接:http://blog.csdn.net/cong ... -
Hibernate Shards 数据的水平、垂直切割
2016-08-13 10:29 0http://www.cnblogs.com/RicC ... -
重要,Spring注解事务无效 和 Cannot add foreign key constraint
2016-02-20 02:18 0Cannot add foreign key con ... -
SpringMVC获取request对象 Spring MVC_HandlerInterceptorAdapter的使用
2015-11-30 23:58 01.注解法 Java代码 ... -
MyEclipse设置Java代码注释模板
2015-10-15 11:33 0Window-Preferences-Java-Co ... -
MyEclipse、eclipse代码自动补全(联想输入)
2015-10-15 11:32 0MyEclipse(eclipse)的自动补全(联想输入)分 ... -
Spring2.5.6中定时器Quarz的使用
2015-10-08 10:07 688下面说明详细的配置: applicationContext ...
相关推荐
Struts2.1.6+Hibernate3.3.1+Spring2.5.6整合的完整jar包,花了很长时间从Struts2.1.6、Hibernate3.3.1、Spring2.5.6挑出来的,在项目中已经应用,没有问题,不要嫌分高,下载了看了就知道好不好了,好的话给个好评...
Struts2.1.6、Hibernate3.3.1和Spring2.5.6是Java Web开发中的三个关键框架,它们分别负责MVC(模型-视图-控制器)架构、对象关系映射(ORM)以及依赖注入(DI)和面向切面编程(AOP)。这些框架的整合使用被称为SSH...
Struts2.1.6、Spring2.5和Hibernate3.3是三个经典的Java开源框架,它们在2009年左右是企业级Java应用开发的主流选择。这个配置组合通常被称为SSH(Struts2、Spring、Hibernate)三位一体,用于构建高效、灵活且可...
Struts1.2+Struts2.1.6+spring 2.0+hibernate3.1+Ibatis2.3 SSH
Struts2.1.6、Spring2.5和Hibernate3.3是经典的Java Web开发框架组合,被称为S2SH。这个框架整合提供了模型-视图-控制器(MVC)架构,使得开发者能够高效地构建企业级应用。下面将详细介绍这三个框架的配置步骤。 *...
SSH Struts 2.1.6 + Hibernate 3 + spring 3 框架 模板 这是学习 ssh的时候,方便开发,做了个模板。 如果重新做网站的话,可以直接在这个工程上开发。只需做很小的修改,例如在配置文件中修改工程名。创了这个模板...
### 解决Struts2.1.6 + Spring + Hibernate 中文乱码问题 在Web开发过程中,特别是使用Java EE框架时,字符编码问题一直是开发者关注的重点之一。对于使用Struts2.1.6、Spring以及Hibernate这三个框架组合的项目而...
Struts1.2+Struts2.1.6+spring 2.0+hibernate3.1+Ibatis2.3内个框架的集成
Struts2.1.6、Spring 2.5.6 和 Hibernate 3.3 是经典的Java Web开发框架组合,常被称为S2SH。这个整合实例是基于这些框架实现了一个基本的CRUD(创建、读取、更新、删除)功能。下面我们将详细探讨这三个框架以及...
开发环境:Windows XP sp3、SQL Server 2005、JDK 1.6、Struts2.1.6、Spring 2.0、Hibernate3.1、MyEclipse 5.5、Tomcat 6.0 使用步骤: 1、下载解压之后,使用IDE导入工程 2、把工程中的“演示数据脚本.sql”导入到...
Struts2、Hibernate和Spring是Java开发中三大主流框架,它们各自解决应用程序的不同问题...总的来说,Struts2.1.6、Hibernate3.3.1和Spring2.5.6的整合是Java EE开发中一个经典的架构模式,至今仍被许多项目所采用。
### Struts2.1.6 + Hibernate3.3.2 + Spring2.5.5 + Extjs3.0.0 + Annotations 整合开发 #### 一、技术栈概述 本篇文章将详细介绍如何使用Struts2.1.6、Hibernate3.3.2、Spring2.5.5和Extjs3.0.0以及Annotations来...
struts2.1.6 +spring2.5 +hibernate3.2 整合开发的 jar包 _ 01部分 struts2.1.6 +spring2.5 +hibernate3.2 整合开发的 jar包 _ 02部分 大家只要将这两个部分的包全部下载下来,就可以搭建struts2 + spring + ...
在"struts2.1.6+hibernate3.3.1+spring2.5.6"的整合中,我们首先会了解每个框架的主要特性: 1. Struts2.1.6:这是Struts2的一个版本,它引入了更灵活的动作映射、拦截器机制、强大的插件支持以及对AJAX的友好支持...
Struts2.1.6、Spring2.5.6和Hibernate3.3.2是三个在Java Web开发中广泛使用的开源框架,它们的整合为开发者提供了强大的后端支撑。这个整合包是为了解决企业在构建基于Java的Web应用程序时面临的复杂性问题,通过将...
下面将详细介绍Struts2.1.6、Hibernate3和Spring2.5整合所需的关键知识点。 1. **Struts2.1.6**:Struts2是一个基于MVC设计模式的Web应用框架,用于构建可维护性、扩展性强的Java Web应用程序。在Struts2.1.6版本中...
在这个例子中,使用的版本分别是Struts2.1.6、Hibernate3.3.2和Spring2.5.6。 首先,让我们详细了解一下这三个框架的核心功能: 1. **Struts2**:这是一个基于MVC(Model-View-Controller)设计模式的Web应用框架...
struts2.1.6 +spring2.5 +hibernate3.2 整合开发的 jar包 _ 01部分 struts2.1.6 +spring2.5 +hibernate3.2 整合开发的 jar包 _ 02部分 大家只要将这两个部分的包全部下载下来,就可以搭建struts2 + spring + ...
这里我们关注的是一个经典的组合:Spring 2.5、Struts 2.1.6和Hibernate 3.2.5的整合。这三大框架分别承担了不同的职责:Spring作为依赖注入(DI)和面向切面编程(AOP)的核心,Struts提供了模型-视图-控制器(MVC...