ssh框架遇到的问题总结

2018-06-18 03:52:28来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折

一.、org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'driverName' of bean class [com.mchange.v2.c3p0.ComboPooledDataSource]: Bean property 'driverName' 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 'driverName' of bean class [com.mchange.v2.c3p0.ComboPooledDataSource]: Bean property 'driverName' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
错误翻译过来就是:driverClassName 名我 com.mchange.v2.c3p0.ComboPooledDataSource不认得,改个我认识的,不然我罢工
解决:改名(注意使用的是c3p0,springjdbc不是这样配置的
driverClassName -->driverClass
url -->jdbcUrl
username -->user
password—>password

、Caused by: java.lang.NoClassDefFoundError: javax/transaction/SystemException
解决:确少geronimo-jta jar包

 

三、Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'dataSource' threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/jdbc/datasource/TransactionAwareDataSourceProxy
解决:<!-- 配置事务 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
<property name="dataSource" ref="dataSource"></property>//这里不要用dataSource.改用sessionFactory
</bean>

四、Caused by: java.lang.ClassNotFoundException: org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy
解决:确少spring-jdbc-4.2.4.RELEASE.jar包

五、HTTP Status 500 - Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.
严重: Exception occurred during processing request: Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.
org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.

解决:在service的类上加上@Transactional注解


六、Bean 'sessionFactory'; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Tag 'property' must have a 'name' attribute
Offending resource: class path resource [applicationContext.xml]
Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Tag 'property' must have a 'name' attribute
Offending resource: class path resource [applicationContext.xml]

解决:<!-- 配置hibernate映射文件 -->时<property name="">的值忘记写了

、Caused by: java.lang.ClassNotFoundException: com.mchange.v2.ser.Indirector”
解决:缺少mchange-commons-java-0.2.3.4.jar

八、.java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
解决:缺少mysql驱动jar包

、.Could not load requested class : com.ssh.entity.User
解决:因为pojo里的文件,xml的文件以及数据库里的文件之间的映射有问题

、Caused by: org.springframework.aop.framework.AopConfigException: Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify proxy interfaces.
解决:可能jar包重复也可能缺少cglib-2.1.3.jar

十一、.No result defined for action com.ssh.action.UserAction and result success
解决:是Struts.xml配置问题


十二、.Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: Emp is not mapped [from Emp]
解决:applicationContext中没有加载*.hbm.xml映射文件

十三、.Caused by: org.hibernate.boot.MappingException: Association [com.ssh.entity.Dept.setEmp] references an unmapped entity [com.ssh.entity.Dept.setEmp] : origin(null)

解决:是xxx.hbm.xml中<class name="com.ssh.entity.User" table="user">name中的路径应该是xxx实体类的路径,结果写到其他的实体类的路径了


十四、.Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deptDaoImpl' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'sessionFactory' of bean class [com.ssh.dao.impl.DeptDaoImpl]: 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?
解决:没有依赖注入

十五、.严重: Servlet.service() for servlet [jsp] threw exception
javax.el.PropertyNotFoundException: Property [id] not found on type [java.lang.String]

解决:jsp中输出的id与实体类的eid不一致<c:forEach items="list" var="emp">或者是<c:forEach items="list" var="emp">items中应该写成${list }
<td>${emp.id }</td>

十六、.Caused by: org.hibernate.MappingException: Duplicate property mapping of ename found in com.ssh.entity.Emp
解决:xxx.hbm.xml映射文件中有重复字段

十七、.HTTP Status 500 - not-null property references a null or transient value : com.ssh.entity.Emp.esex; nested exception is org.hibernate.PropertyValueException: not-null property references a null or transient value : com.ssh.entity.Emp.esex
解决:是xxx.hbm.xml中的属性设置为不能为空,但是我前台表单中的数据填写为空了。


十八、.org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unnamed bean definition specifies neither 'class' nor 'parent' nor 'factory-bean' - can't generate bean name
Offending resource: class path resource [springmvc.xml]
解决:由于:bean 没有配置完整,少了class等属性的配置或者配置了空的bean<bean></bean>


十九、.java.lang.IllegalArgumentException: Expected MultipartHttpServletRequest: is a MultipartResolver configured?
解决:这是因为找不到multipartReslover的原因,在springMVC配置文件配置它的时候,不能用其他名字,只能用指定名字id="multipartResolver",否则就出现这种找不到的错误。

Caused by: 元素类型为 "struts" 的内容必须匹配 "((package|include|bean|constant)*,unknown-handler-stack?)"。 - file:/E:/JavaDeveleper/apache-tomcat-9.0.0.M22/webapps/shop/WEB-INF/classes/struts.xml:17:10
解决:Struts.xml配置文件中的action要写在package中

二十、.java.lang.NoSuchMethodException: com.opensymphony.xwork2.ActionSupport.listAll()
解决:spring.xml核心配置文件忘记配置给应类的Javabean实例化

二十一、.Caused by: Action class [userAction] not found - action - file:/C:/Users/smfx1314/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/sshtest/WEB-INF/classes/struts.xml:7:63
java.lang.NoSuchMethodException: com.ssh.action.UserAction.save()

解决:原因是缺少jar包:struts2-spring-plugin-2.1.8.jar或者清理缓存,project

22、.There is no Action mapped for namespace [/] and action name [delete] associated with context path [/sshtest]. - [unknown location]
解决:Struts.xml中的action方法使用的是user_*的方式,在jsp页面中或其他请求中没有按照user_*的方式请求,加上前缀user就可以了

23.Caused by: java.io.FileNotFoundException: class path resource [com.ssh.entity.Emp] cannot be opened because it does not exist

解决:映射文件对应路径应该是“/”,我使用的是“.”

24.Caused by: org.hibernate.property.access.spi.PropertyAccessBuildingException: Could not locate field nor getter method for property named [com.shop.entity.User#name]

解决:映射配置文件中的实体属性名和实体类中属性名不一致
解决方案: 修改映射配置文件属性名,保证名称和实体类中属性名称一致

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:K:树、二叉树与森林之间的转换及其相关代码实现

下一篇:jvm内存