问题描述
- spring mvc ?????????
-
严重: Servlet.service() for servlet [DispatcherServlet] in context with path [/vicp_cq] threw exception [Request processing failed; nested exception is org.springframework.orm.hibernate3.HibernateSystemException: Unknown entity: com.viststem.yjj.user.model.User; nested exception is org.hibernate.MappingException: Unknown entity: com.viststem.yjj.user.model.User] with root cause
org.hibernate.MappingException: Unknown entity: com.viststem.yjj.user.model.User
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:693)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1485)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:120)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:713)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:701)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:697)
at com.viststem.user.dao.impl.UserDaoImpl.addUser(UserDaoImpl.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at com.sun.proxy.$Proxy25.addUser(Unknown Source)
at com.visystem.user.service.impl.UserServiceImpl.addUser(UserServiceImpl.java:33)
at com.visystem.user.controller.UserController1.addUser(UserController1.java:49)
解决方案
Spring参考手册 mvc:annotation-driven
解决方案二:
1、Unknown entity: com.viststem.yjj.user.model.User--------未知实体类:可能实体类未注入
2、com.viststem.user.dao.impl.UserDaoImpl.addUser(UserDaoImpl.java:71)------用户DAO实现 类71行有错误 ,用鼠标左键点击UserDaoImpl.java就会跳到错误处。
3、com.visystem.user.controller.UserController1.addUser(UserController1.java:49)-----用户controller的49行有问题 点击过去查看
解决方案三:
threw exception [Request processing failed;你前台是post请求,后台是get接收吧,我感觉是这个问题,你把错的地方提出来看看。
解决方案四:
我打断点进行输出,前台可以把数据传到控制层,就是到存不到数据库,报了一个错误source no found,
时间: 2024-10-20 07:58:56