spring配置hibernate错误 急100分在线等···

z649010333 2010-01-26 04:09:26
是在启动tomcat时抛的错误 错误信息:

action: null
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.SecurityException: class "org.apache.commons.collections.LRUMap"'s signer information does not match signer information of other classes in the same package
Caused by: java.lang.SecurityException: class "org.apache.commons.collections.LRUMap"'s signer information does not match signer information of other classes in the same package

spring 配置:
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>

hibernate 配置:
<session-factory>
<property name="connection.username">root</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/webexe
</property>
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="myeclipse.connection.profile">sql</property>
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<mapping resource="_config/education/hbm/EDepArtment.hbm.xml" />
<mapping resource="_config/education/hbm/EDepEmp.hbm.xml" />
<mapping resource="_config/education/hbm/EDepJob.hbm.xml" />
<mapping resource="_config/education/hbm/EDepLoginfo.hbm.xml" />
<mapping resource="_config/education/hbm/EExamBasic.hbm.xml" />
<mapping resource="_config/education/hbm/EExamSubject.hbm.xml" />
<mapping resource="_config/education/hbm/ENews.hbm.xml" />
<mapping resource="_config/education/hbm/ESchool.hbm.xml" />
<mapping resource="_config/education/hbm/ESchoolClassinfo.hbm.xml" />
<mapping resource="_config/education/hbm/ESchoolClasskind.hbm.xml" />
<mapping resource="_config/education/hbm/ESchoolGrade.hbm.xml" />
<mapping resource="_config/education/hbm/ESchoolImport.hbm.xml" />
<mapping resource="_config/education/hbm/ESchoolKind.hbm.xml" />
<mapping resource="_config/education/hbm/EStudentDefaulter.hbm.xml" />
<mapping resource="_config/education/hbm/EStudentEvent.hbm.xml" />
<mapping resource="_config/education/hbm/EStudentHonor.hbm.xml" />
<mapping resource="_config/education/hbm/EStudentInfo.hbm.xml" />
<mapping resource="_config/education/hbm/EStudentKind.hbm.xml" />
<mapping resource="_config/education/hbm/EStudentState.hbm.xml" />
<mapping resource="_config/education/hbm/EStuMark.hbm.xml" />
<mapping resource="_config/education/hbm/ETeach.hbm.xml" />
<mapping resource="_config/education/hbm/ETeacherAptitude.hbm.xml" />
<mapping resource="_config/education/hbm/ETeacherBasic.hbm.xml" />
<mapping resource="_config/education/hbm/ETeacherFile.hbm.xml" />
<mapping resource="_config/education/hbm/ETeacherGlory.hbm.xml" />
<mapping resource="_config/education/hbm/ETeacherState.hbm.xml" />
</session-factory>


里面的路径是没问题的

望高手指点
...全文
416 27 打赏 收藏 转发到动态 举报
写回复
用AI写文章
27 条回复
切换为时间正序
请发表友善的回复…
发表回复
shanshu12 2011-03-10
  • 打赏
  • 举报
回复
很可能是缺少commons-beanutils.jar文件
shanshu12 2011-03-10
  • 打赏
  • 举报
回复
我也遇到过这种配置错误,最后逐个jar包添加进去后才解决。应该是项目CLASSPATH的包的配置问题。
主要检查这几个包:
common-collection-3.2.1.jar,commons-beanutils.ja
asm-2.2.3.jar
asm-commons-2.2.3.jar
asm-util-2.2.3.jar
cglib-nodep-2.1_3.jar
_A 2010-04-16
  • 打赏
  • 举报
回复
3个包:asm.jar、asm-attrs.jar、cglib-2.1.jar
应该就是包冲突的问题,出现这个问题的兄弟可以试试

俺也是个菜菜,说的不对的话不要骂我啊嘿嘿~~
_A 2010-04-16
  • 打赏
  • 举报
回复
我用的MyEclipse5.5
也出现了这个问题
我将common-collection.jar替换成了common-collection-3.2.1.jar,commons-beanutils.jar替换成了commons-beanutils-1.8.0.jar依然报错,
最后我删除了4个包,就不报错了
_A 2010-04-16
  • 打赏
  • 举报
回复
asd
Simple_Key 2010-01-27
  • 打赏
  • 举报
回复
........................
z649010333 2010-01-27
  • 打赏
  • 举报
回复
昨天的这个问题解决了

像你们说的最主要是jar包的问题 是少了commons-beanutils.jar

但要注意的是 我在以前的开发环境是没有commons-beanutils.jar 包的 但项目也没有问题

所以一直没有注意到那里去

这个错误只要注意这两个地方就可以了common-collection.jar commons-beanutils.jar

zidasine 2010-01-26
  • 打赏
  • 举报
回复
jar包版本问题 查找common-collection。jar的何时版本
crazylaa 2010-01-26
  • 打赏
  • 举报
回复
集成问题,路过帮顶
greatmind829 2010-01-26
  • 打赏
  • 举报
回复
我以前也经常出现这样的问题,这可能是三大框架集成有问题吧!
删了再配置,试一试就行了。
java1109 2010-01-26
  • 打赏
  • 举报
回复
up
zl3450341 2010-01-26
  • 打赏
  • 举报
回复
进我的空间
在我的资源里面去下个SSH整合视频
看看就明白了
  • 打赏
  • 举报
回复
楼主还是没做出来么?做出来不妨贴出来解释一下!我是路人。。。
xinlan1022 2010-01-26
  • 打赏
  • 举报
回复
具体应该是jar包的问题
xinlan1022 2010-01-26
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 z649010333 的回复:]
引用 8 楼 xchen1986 的回复:
引用 7 楼 z649010333 的回复:
引用 4 楼 xchen1986 的回复:
是不是你lib包下有一个commons-collections-2.1.jar和commons-collctions-3.2.jar,你把第一个删掉就应该ok了!


我的只有第一个啊
你用的是myeclipse几的???



6.0啊
[/Quote]


6.0的话好像就会有这样的问题的,换个6.5的试试
z649010333 2010-01-26
  • 打赏
  • 举报
回复
谢谢各位 你们的方法都试了 还是不行 郁闷得很 结贴···
d_star 2010-01-26
  • 打赏
  • 举报
回复
有没有用到Struts?SSH集成的话,需要设置代理类和配置插件,不能直接访问Action
xchen1986 2010-01-26
  • 打赏
  • 举报
回复
action null 问题小计 收藏
1、严重: action: null
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
解决方案:
asm-2.2.3.jar
asm-commons-2.2.3.jar
asm-util-2.2.3.jar
cglib-nodep-2.1_3.jar
这几个包删掉就好了

2、严重: action: null(此错误我没出,不过网上搜的时候看到,故借来了)
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.SecurityException: class "org.apache.commons.collections.SequencedHashMap"'s signer information does not match signer information of other classes in the same package

Caused by: java.lang.SecurityException: class "org.apache.commons.collections.SequencedHashMap"'s signer information does not match signer information of other classes in the same package
解决方案:
方法一、把WEB-INF下的commons-collections-X.X.X删除,替换成commons-collections-3.2.1或以上版本。

commons-collections-3.2.1.jar下载地址:http://apache.freelamp.com/commons/collections/binaries/commons-collections-3.2.1-bin.zip

方法二、造成此异常的原因是commons-beanutils的签名版本问题,本人解决问题所用的方法——将WEB-INF下的commons-beanutils.jar或commons-beanutils-X.X.X.jar替换成commons-beanutils-1.8.0.jar

commons-beanutils-1.8.0.jar下载地址:
http://dev.xiaonei.com/apache-mirror/commons/beanutils/binaries/commons-beanutils-1.8.0-bin.zip

方法三、applicationContext.xml下看

<property name="mappingResources">
<list>
<value>com/smile/entity/Users.hbm.xml</value>
</list>
</property>

value路径是否正确

3、严重: action: null
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'UserinfoDAO' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'sessionFactory' of bean class [com.wang.hibernate.DAO.UserinfoDAO]: Bean property 'sessionFactory' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
org.springframework.beans.NotWritablePropertyException: Invalid property 'sessionFactory' of bean class [com.wang.hibernate.DAO.UserinfoDAO]: Bean property 'sessionFactory' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
解决方案:
注入配置错误,这个比较低级别,细心点,applicationContext.xml 中查看你的注入配置,如果确认没错,那么返回去看看是否为对应的属性提供了必要的set方法。

4、严重: action: null
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 2 in XML document from ServletContext resource [/WEB-INF/beans.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.
Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.
解决方案:
因为你的<beans>标记里面没有定义任何的dtd或者xsd文件嘛!
那解析器怎么知道这个xml文件是来干什么的?
给你一个示例:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/ beans http://www.springframework.org/schema/beans/spring- beans-2.0.xsd">
</beans>

我以前在网上找的 你看看
z649010333 2010-01-26
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 xchen1986 的回复:]
引用 7 楼 z649010333 的回复:
引用 4 楼 xchen1986 的回复:
是不是你lib包下有一个commons-collections-2.1.jar和commons-collctions-3.2.jar,你把第一个删掉就应该ok了!


我的只有第一个啊
你用的是myeclipse几的???

[/Quote]

6.0啊
xchen1986 2010-01-26
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 z649010333 的回复:]
引用 4 楼 xchen1986 的回复:
是不是你lib包下有一个commons-collections-2.1.jar和commons-collctions-3.2.jar,你把第一个删掉就应该ok了!


我的只有第一个啊
[/Quote]你用的是myeclipse几的???
加载更多回复(7)

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧