首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

严重: Servlet.service() for servlet default threw exception

2013-09-11 
严重: Servlet.service() for servlet default threw exception求救严重: Servlet.service() for servlet

严重: Servlet.service() for servlet default threw exception 求救
严重: Servlet.service() for servlet default threw exception
java.lang.NullPointerException
at org.bookstore.action.UserAction.register(UserAction.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:404)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)





UserAction类里是这样子

  public String register()throws Exception{
System.out.println(usertable.getUsername());
UserTable usertable1=new UserTable();
usertable1.setUsername(usertable.getUsername());
usertable1.setAge(usertable.getAge());
usertable1.setPassword(usertable.getPassword());
usertable1.setSex(usertable.getSex());
userService.saveUserTable(usertable1);
 
return SUCCESS;
  }
调试在 System.out.println(usertable.getUsername());
就出错

UserTable类里值这样子

public class UserTable implements java.io.Serializable {

// Fields

private Integer userid;
private String username;
private String password;
private String sex;
private Integer age;
  private Set orderses=new HashSet(0);


[解决办法]
空指针异常 
usertable.getUsername()
usertable 在哪里实例的?

[解决办法]
UserTable没创建get、set方法?
[解决办法]
usertable这个是哪来的?
都没有setUsertable方法,这个肯定是空的

热点排行