A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

java.lang.NullPointerException     action.LoginAction.execute(LoginAction.java:42)    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)    java.lang.reflect.Method.invoke(Unknown Source)    com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450)    com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252)    org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)    com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)    com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)    org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)    com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)    com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:249)    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)    com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:249)    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)    com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)    org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)    org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)    org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)    com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)    com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)    com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)    com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)    com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)    org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)    com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)    com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)    org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:546)    org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)    java.lang.Thread.run(Unknown Source)   


You are seeing this page because development mode is enabled. Development mode, or devMode, enables extra debugging behaviors and reports to assist developers. To disable this mode, set:   struts.devMode=falsein your WEB-INF/classes/struts.properties file.

LoginAction.java代码如下:
package action;
import java.util.Map;
import service.UserService;
import domain.UserVo;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
public class LoginAction extends ActionSupport{
private String userName;
private String userPsw;
private  UserService userService;

    public String getUserName() {
  return userName;
}
public void setUserName(String userName) {
  this.userName = userName;
}
public String getUserPsw() {
  return userPsw;
}
public void setUserPsw(String userPsw) {
  this.userPsw = userPsw;
}
public UserService getUserService() {
  return userService;
}
public void setUserService(UserService userService) {
  this.userService = userService;
}
public String execute() throws Exception{
     
  UserVo result=userService.findByProperty(userName,userPsw);
     if(result!=null)
     {
      Map session = ActionContext.getContext().getSession();
      if(session.containsKey("userVo"))
       session.remove("userVo");
          session.put("userVo", result);
          return SUCCESS;
     }
     else return ERROR;
   }
}



评分

参与人数 1技术分 +1 收起 理由
黄兴旺 + 1 亲 去新版块去提问吧

查看全部评分

5 个回复

倒序浏览
哥们 看着挺恐怖的{:soso_e100:}
回复 使用道具 举报
看到就头疼,那么多
回复 使用道具 举报
呵呵  我也是  但是我必须得解决问题
回复 使用道具 举报
哥们,如果你确定你项目没问题,那就是struts里面的架包冲突,看截图。
解决办法:

QQ截图20131015095228.png (85.14 KB, 下载次数: 15)

QQ截图20131015095228.png
回复 使用道具 举报
嗯  谢谢帮忙,问题解决了
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马