我搭了一个SSH框架,其中Hibernate部分使用了hibernate-generic-dao,google项目库中一个开源的basedao,然后执行时service调用dao时就会出现这个错误:
2013-07-22 12:50:15 [http-bio-8080-exec-6:40202] - [DEBUG] Initiating transaction commit
2013-07-22 12:50:15 [http-bio-8080-exec-6:40202] - [DEBUG] Committing Hibernate transaction on Session [org.hibernate.impl.SessionImpl@2b2a3f12]
2013-07-22 12:50:15 [http-bio-8080-exec-6:40202] - [DEBUG] commit
2013-07-22 12:50:15 [http-bio-8080-exec-6:40203] - [DEBUG] re-enabling autocommit
2013-07-22 12:50:15 [http-bio-8080-exec-6:40203] - [DEBUG] committed JDBC Connection
2013-07-22 12:50:15 [http-bio-8080-exec-6:40204] - [DEBUG] transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
2013-07-22 12:50:15 [http-bio-8080-exec-6:40208] - [DEBUG] Not closing pre-bound Hibernate Session [org.hibernate.impl.SessionImpl@2b2a3f12] after transaction
2013-07-22 12:50:15 [http-bio-8080-exec-6:40208] - [DEBUG] disconnecting session
2013-07-22 12:50:15 [http-bio-8080-exec-6:40209] - [DEBUG] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
2013-07-22 12:50:15 [http-bio-8080-exec-6:40209] - [DEBUG] trace com.mchange.v2.resourcepool.BasicResourcePool@bc6d906 [managed: 3, unused: 2, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@2dea006e)
2013-07-22 12:50:15 [http-bio-8080-exec-6:40226] - [DEBUG] transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
2013-07-22 12:50:15 [http-bio-8080-exec-6:40226] - [DEBUG] Checking ConfigurationProviders for reload.
2013-07-22 12:50:15 [http-bio-8080-exec-6:40230] - [DEBUG] Could not find template in cache, creating new one; id=[org/apache/struts2/dispatcher/error.ftl[zh_CN,UTF-8,parsed] ]
2013-07-22 12:50:15 [http-bio-8080-exec-6:40234] - [DEBUG] Compiling FreeMarker template org/apache/struts2/dispatcher/error.ftl[zh_CN,UTF-8,parsed]  from jar:file:/F:/Tomcat/apache-tomcat-7.0.26/webapps/oa/WEB-INF/lib/struts2-core-2.2.3.jar!/org/apache/struts2/dispatcher/error.ftl
2013-07-22 12:50:15 [http-bio-8080-exec-6:40288] - [DEBUG] Key 'location' was not found on instance of java.lang.NullPointerException. Introspection information for the class is: {getClass=public final native java.lang.Class java.lang.Object.getClass(), localizedMessage=java.beans.PropertyDescriptor[name=localizedMessage; propertyType=class java.lang.String; readMethod=public java.lang.String java.lang.Throwable.getLocalizedMessage()], cause=java.beans.PropertyDescriptor[name=cause; propertyType=class java.lang.Throwable; readMethod=public synchronized java.lang.Throwable java.lang.Throwable.getCause()], getSuppressed=public final synchronized java.lang.Throwable[] java.lang.Throwable.getSuppressed(), getCause=public synchronized java.lang.Throwable java.lang.Throwable.getCause(), getMessage=public java.lang.String java.lang.Throwable.getMessage(), equals=public boolean java.lang.Object.equals(java.lang.Object), java.lang.Object@7c6314a0=freeer.ext.beans.MethodMap@6c775143, hashCode=public native int java.lang.Object.hashCode(), class=java.beans.PropertyDescriptor[name=class; propertyType=class java.lang.Class; readMethod=public final native java.lang.Class java.lang.Object.getClass()], addSuppressed=public final synchronized void java.lang.Throwable.addSuppressed(java.lang.Throwable), fillInStackTrace=public synchronized java.lang.Throwable java.lang.Throwable.fillInStackTrace(), stackTrace=java.beans.PropertyDescriptor[name=stackTrace; propertyType=class [Ljava.lang.StackTraceElement;; readMethod=public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace(); writeMethod=public void java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[])], message=java.beans.PropertyDescriptor[name=message; propertyType=class java.lang.String; readMethod=public java.lang.String java.lang.Throwable.getMessage()], java.lang.Object@6cdf583e={public void java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[])=[Ljava.lang.Class;@d783d57, public boolean java.lang.Object.equals(java.lang.Object)=[Ljava.lang.Class;@510321a9, public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()=[Ljava.lang.Class;@249707cc, public final native java.lang.Class java.lang.Object.getClass()=[Ljava.lang.Class;@3780f4d8, public java.lang.String java.lang.Throwable.getLocalizedMessage()=[Ljava.lang.Class;@734aad5f, public synchronized java.lang.Throwable java.lang.Throwable.initCause(java.lang.Throwable)=[Ljava.lang.Class;@2bbc731b, public native int java.lang.Object.hashCode()=[Ljava.lang.Class;@6129080b, public java.lang.String java.lang.Throwable.toString()=[Ljava.lang.Class;@4ccf3c02, public java.lang.String java.lang.Throwable.getMessage()=[Ljava.lang.Class;@396cceb3, public synchronized java.lang.Throwable java.lang.Throwable.getCause()=[Ljava.lang.Class;@16766739, public final synchronized java.lang.Throwable[] java.lang.Throwable.getSuppressed()=[Ljava.lang.Class;@3772dab4, public synchronized java.lang.Throwable java.lang.Throwable.fillInStackTrace()=[Ljava.lang.Class;@55747bdc, public final synchronized void java.lang.Throwable.addSuppressed(java.lang.Throwable)=[Ljava.lang.Class;@526fd458}, suppressed=java.beans.PropertyDescriptor[name=suppressed; propertyType=class [Ljava.lang.Throwable;; readMethod=public final synchronized java.lang.Throwable[] java.lang.Throwable.getSuppressed()], getStackTrace=public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace(), setStackTrace=public void java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[]), toString=public java.lang.String java.lang.Throwable.toString(), initCause=public synchronized java.lang.Throwable java.lang.Throwable.initCause(java.lang.Throwable), printStackTrace=freeer.ext.beans.MethodMap@2bde07b0, getLocalizedMessage=public java.lang.String java.lang.Throwable.getLocalizedMessage()}
2013-07-22 12:50:15 [http-bio-8080-exec-6:40364] - [DEBUG] skipping cleanup counter=1
2013-07-22 12:50:15 [http-bio-8080-exec-6:40365] - [DEBUG] Closing single Hibernate Session in OpenSessionInViewFilter
2013-07-22 12:50:15 [http-bio-8080-exec-6:40365] - [DEBUG] Closing Hibernate Session
求解答!
附上service调用dao的方法:
@Override
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
public List<Demo> findAll() {
return demoDao.findAll();
}
就在这儿出错的。findAll是google那个开源框架写好的。

解决方案 »

  1.   

    肯定不是这个啊,我service是有一个接口的,这是实现部分...
      

  2.   

    lz使用的是jdk是哪个版本的啊?
      

  3.   

    Key 'location' was not found on instance of java.lang.NullPointerException.
    Introspection information for the class is: 
    {getClass=public final native java.lang.Class java.lang.Object.getClass(), localizedMessage=java.beans.PropertyDescriptor[name=localizedMessage