您的位置:首页 > 其它

ssh学习笔记(1)

2009-08-25 18:29 190 查看
学习struts2、hibernate、spring也有一段时间了。 这两天集成三个框架,做了个小小的实例。练习过程中出现的异常真的是层出不穷、五花八门搞得我头都大了,其中这几个错误让我记忆犹深。

第一个:<br /> Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMe解决办法是:

1.去掉类路径上的关于Hibernate的3个lib

asm.jar

asm-attrs.jar

cglib-2.1.3.jar

2.加入Spring中的以下4个lib

asm-2.2.2.jar

asm-commons-2.2.2.jar

asm-util-2.2.2.jar

cglib-nodep-2.1_3.jar

原因是:spring中的asm jar包和hibernate里的asm jar包冲突,得删除当中一个。

第二个:<br />Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting 'name pattern' at character position 55<br />execution(*com.compss.sevice.impl.ProductManagerImpl.*(..))<br />可能出现的问题是:*com.compss.sevice.impl.ProductManagerImpl * 后面要留一个空格。

第三个:

Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [org.springframework.transaction.config.TxNamespaceHandler] for namespace [http://www.springframework.org/schema/tx]: problem with handler class file or dependent class; nested exception is java.lang.AbstractMethodError: org.springframework.transaction.config.TxNamespaceHandler.init()V

可能原因是: struts2.x 版本的问题,我开始时用的struts2.1.6出现这个错误始终没有解决,而换成struts2.0.14后就没有出现这个问题了。

第四个:

java.lang.IllegalArgumentException: attempt to create saveOrUpdate event with null entity

这个问题也让看半天没看明白,网上的答案也是五花八门。
但最后还是从网上找到了这个答案。

一般是因为jsp页面传的对象属性不对 如:
<s:textfield name="author.username" label="name"></s:textfield>
但action中是 Author a; 故应修改为:
<s:textfield name="a.username" label="name"></s:textfield>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: