首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

org.springframework.orm.hibernate3.HibernateQueryException: Instruction

2013-09-11 
大家帮忙总结下,使用SSH框架容易出现的问题,还有运行时候容易出现的问题!如题![解决办法]楼主可以参考一下

大家帮忙总结下,使用SSH框架容易出现的问题,还有运行时候容易出现的问题!
如题!

[解决办法]
楼主可以参考一下我的这两个博客
就是这两天整理的,希望对大家有帮助
“SSH整合项目中容易出现的错误整理 ”

还有一个博客
“SSH项目中,发布项目出现Error:listenerStart错误”
[解决办法]
最常见的的错误是404,报错提示:Servlet action is not available。页面报错,后台不报错。

这个问题最常见也最不好解决,因为出问题的地方不明确,不过一般出错原因是Struts跟Spring的整合出错了,解决问题的办法是,仔细检查Struts和Spring的配置文件。

一般写SSH项目,最好在Hibernate和Spring整合完后,写测试类测试成功以后整合Spring和Struts,整合时同样要写测试类测试。


[解决办法]
8.spring MVC+hibernate 
Exception in thread "main" org.springframework.dao.InvalidDataAccessResourceUsageException: Could not execute JDBC batch update; nested exception is org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update 
Caused by: org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update 
9. 
org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.transaction.interceptor.TransactionProxyFactoryBean] for bean with name 'userService' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/springframework/aop/framework/AbstractSingletonProxyFactoryBean 
Caused by: java.lang.NoClassDefFoundError: org/springframework/aop/framework/AbstractSingletonProxyFactoryBean 
方案:没加 spring 2.0 aop libraries 
10. 
org.apache.jasper.JasperException: Unable to compile class for JSP: 
方案:jsp网页中的java代码有问题 
11. 
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'CompanyController' defined in class path resource [com/company/test/company-config.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'methodNameResolver' of bean class [com.company.action.CompanyController]: Bean property 'methodNameResolver' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'methodNameResolver' of bean class [com.company.action.CompanyController]: Bean property 'methodNameResolver' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 


控制器没继承MultiActionController 

12. 


Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'turDiffService' defined in class path resource [com/expert/test/expert-config.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'turDifficultDao' of bean class [com.expert.operation.impl.TurDiffSerImpl]: Bean property 'turDifficultDao' is not writable or has an invalid setter method. Did you mean 'truDifficultDao'? 
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'turDifficultDao' of bean class [com.expert.operation.impl.TurDiffSerImpl]: Bean property 'turDifficultDao' is not writable or has an invalid setter method. Did you mean 'truDifficultDao'? 
原因: 
在定义时TurDifficultDao turDifficultDao ,把有个字母写错,后发现错误,改过来了,但没把get() set()方法中对应的改过来 

13. 

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'urlMapping' defined in class path resource [com/expert/test/expert-config.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named '' is defined 


Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named '' is defined 


原因: 
在expert-config.xml中创建 
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> 
<property name="mappings"> 
<props> 

<prop key=""></prop> 

</props> 
</property> 
</bean> 
没有给<prop key=""></prop>赋值 

14. 

org.springframework.orm.hibernate3.HibernateQueryException: Instruction is not mapped 

[from Instruction]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: 

Instruction is not mapped [from Instruction] 
Caused by: org.hibernate.hql.ast.QuerySyntaxException: Instruction is not mapped [from 

Instruction] 
原因:在data-config.xml中没加入<value>com/serializ/Instruction.hbm.xml</value> 
15. 

java.sql.SQLException: Field 'userId' doesn't have a default value 
原因:把配置文件的主键改为<generator class="assigned" /> 可以进行自定义主键值,因为我在设主键时没有设成自动增长的,要求填默认值是受了配置文件里<generator class="native"/>的影响了。 

16.org.apache.jasper.JasperException: Unable to compile class for JSP 

原因:jsp页面中的java代码括号不对称!


17.Error creating bean with name 'sessionFactory '

网友回复:Error creating bean with name 'sessionFactory '
网友回复: 'UserDAO ' 这个 java Bean 有问题, 

导致 : 严重: action: null 
再试试, 有可能是 没有符合javabean 的规则 

网友回复:spring的配置文件有错误~~
网友回复:UserDAO是自动生成的,spring配置肯定没问题啊
网友回复:我遇到的问题跟你遇到的一模一样,我到现在也还没能解决出来,如果你解决了希望能告诉一下。非常感谢
网友回复:RP
网友回复:看错误信息,似乎是java bean里的setter方法不正确。建议检查一下。
网友回复:Caused by: java.lang.NoClassDefFoundError:org/apache/commons/pool/impl/GenericObjectPool 
是一些包没有加载进去吧 
eclipse是数据字典的方式加载的,放到tomcat中要重新引用
网友回复:我在上面写到跟你出的问题大概差不多,我现在我的问题已经解决掉了,我在service类修改了一下,我的service是不是用工具生成的,我的错误是service继承了hibernateDaoSupport类,粗

心造成的
网友回复:我也遇到这个错误了,不过在网上终于找到了答案,你这个是一个包没有导入进去, <bean id= "dataSource " class= "org.apache.commons.dbcp.BasicDataSource " destroy-method= 

"close "> 除了需要commons-dbcp-1.2-1.jar之外还需要commons-pool.jar这个包,把后面这个commons-pool.jar包导入进去就应该行了,我的是这样解决的 

网友回复:commons-pool.jar: 
http://www.apache.org/dist/commons/pool/commons-pool-current.zip 
commons-dbcp-1.2.1.jar: 
http://archive.apache.org/dist/commons/dbcp/binaries/commons-dbcp-1.2.1.zip


我的异常网推荐解决方案:org.apache.jasper.JasperException: Unable to compile class,http://www.myexception.cn/j2ee/2308.html

热点排行