package com.shi.service.imp;import com.shi.service.inter.BaseServiceInter;
import com.shi.util.inter.HibernateUtilInter;public class BaseServiceImp implements BaseServiceInter {
HibernateUtilInter hibernateUtilInter; 

public HibernateUtilInter getHibernateUtilInter() {
return hibernateUtilInter;
} public void setHibernateUtilInter(HibernateUtilInter hibernateUtilInter) {
this.hibernateUtilInter = hibernateUtilInter;
System.out.println("BaseServiceImp.sethibernate");
} public boolean save(Object obj) {

boolean b=hibernateUtilInter.save(obj);

return b;
} public boolean delete(Object obj) {
boolean b=hibernateUtilInter.delete(obj);
return b;
} public boolean update(Object obj) {
boolean b=hibernateUtilInter.update(obj);
return b;
}}
使用Spring 已经初始化过了 为什么调用不了层代码 报错
type Exception reportmessagedescription The server encountered an internal error that prevented it from fulfilling this request.exceptionjava.lang.NullPointerException
com.shi.service.imp.BaseServiceImp.save(BaseServiceImp.java:20)
com.shi.action.RegisterAction.regUser(RegisterAction.java:93)
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)
ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:871)
ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1294)
ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68)
com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:117)
com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:108)
ognl.OgnlRuntime.callMethod(OgnlRuntime.java:1370)
ognl.ASTMethod.getValueBody(ASTMethod.java:91)
ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)
ognl.SimpleNode.getValue(SimpleNode.java:258)
ognl.Ognl.getValue(Ognl.java:467)

解决方案 »

  1.   

    com.shi.service.imp.BaseServiceImp.save(BaseServiceImp.java:20)。。BaseServiceImp的20行空指针?
    boolean b=hibernateUtilInter.save(obj);这一行吗??hibernateUtilInter为空注入失败
      

  2.   

    但是不是空啊 我查了下 注入成功了 obj也不为空  
      

  3.   

    UniversityServiceinter universityServiceinter; 之前我是采用实现BaseServiceInter  接口的方式 直接调用 实现该接口内的方法  不行 现在我采用BaseServiceInter  baseServiceInter; 方法 直接调用才行