当前位置: 代码迷 >> Java Web开发 >> SSH hibernateTemplate有关问题
  详细解决方案

SSH hibernateTemplate有关问题

热度:751   发布时间:2016-04-17 01:09:21.0
SSH hibernateTemplate问题
HibernateTemplate ht=new HibernateTemplate(sessionFactory);
List list=ht.find("from Login where username=?","1");

报错java.lang.reflect.InvocationTargetException
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)
com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept。。。。。
我将find换成ht.save(login);没得问题
网上有说antlr-2.72.jar 和antlr-2.76.jar 试了下还是不得行 有说这是内存溢出但没说怎么解决,之前我用struts1.3没得内存溢出问题啊 
最后21分了。。不好意思

------解决方案--------------------
java.lang.reflect.InvocationTargetException
这个异常是因为底层调用Null而抛出的异常~

username和Login是必须存在于hibernate的xml配置文件里面并且定义好的...

不存在其中一个就会有这异常!!你看一下你的hibernate配置文件是否正确~
  相关解决方案