黑马程序员技术交流社区

标题: 在用ssh开发的系统中,登录异常 大家帮忙解决下 [打印本页]

作者: 冷月    时间: 2013-10-9 13:53
标题: 在用ssh开发的系统中,登录异常 大家帮忙解决下
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;
   }
}




作者: 冯超    时间: 2013-10-9 15:44
哥们 看着挺恐怖的{:soso_e100:}
作者: 潘才新    时间: 2013-10-9 23:53
看到就头疼,那么多
作者: 冷月    时间: 2013-10-10 01:19
呵呵  我也是  但是我必须得解决问题
作者: 狼人→浪人    时间: 2013-10-15 10:26
哥们,如果你确定你项目没问题,那就是struts里面的架包冲突,看截图。
解决办法:

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

QQ截图20131015095228.png

作者: 冷月    时间: 2013-10-16 09:37
嗯  谢谢帮忙,问题解决了




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2