疑难杂症...求大神! 用的是tomcat7,然后第一次登录所有功能 正常使用,没有问题,然后点击退出,再次登录时报错:求大神! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 应该和tomcat无关,看看登出操作,都做了些什么。方便的话,可以把这块的代码拿来看看啊~ 的一次登录网页正常,退出后第二次登报错?看看你处理登录和退出的servlet 内存溢出有很多原因的,在myeclipse把tomcat的jdk中的Optional Java VM argument:-Xms128m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=128m,意思网上搜,再者就是好好检查程序吧,把程序优化一下 package com.ldm.user.quit;import com.opensymphony.xwork2.Action;import com.opensymphony.xwork2.ActionSupport;public class QuitAction extends ActionSupport { private static final long serialVersionUID = -3561246517849289095L; public String execute() throws Exception { QuitProcessor quit = new QuitProcessor(); if (quit.quitSystem()) { return Action.LOGIN; } this.addActionMessage(quit.getMessage()); return Action.ERROR; } } package com.ldm.user.quit;import java.util.Hashtable;import java.util.Map;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import com.opensymphony.xwork2.ActionContext;import com.ldm.login.Login;public class QuitProcessor {final static Log logger = LogFactory.getLog(QuitProcessor.class); private String message; public QuitProcessor() { this.message = ""; } /** * @return the message */ public String getMessage() { return message; } /** * @param message * the message to set */ public void setMessage(String message) { this.message = message; } @SuppressWarnings("unchecked") public boolean quitSystem() { Map<?, ?> session = ActionContext.getContext().getSession(); Map<?, ?> application = ActionContext.getContext().getApplication(); Login login = (Login) session.get("user"); if (null == login || "".equals(login.getUsername().trim())) { this.message = "退出系统错误--Session error"; logger.debug(this.message); return false; } try { application.remove(login.getUsername()); session.clear(); return true; } catch (Exception e) { this.message = "退出系统错误--application error"; logger.error("quit system error!", e); } return false; }} import com.opensymphony.xwork2.Action;import com.opensymphony.xwork2.ActionSupport;public class QuitAction extends ActionSupport { private static final long serialVersionUID = -3561246517849289095L; public String execute() throws Exception { QuitProcessor quit = new QuitProcessor(); if (quit.quitSystem()) { return Action.LOGIN; } this.addActionMessage(quit.getMessage()); return Action.ERROR; } }//import java.util.Hashtable;import java.util.Map;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import com.opensymphony.xwork2.ActionContext;import com.ldm.login.Login;public class QuitProcessor {final static Log logger = LogFactory.getLog(QuitProcessor.class); private String message; public QuitProcessor() { this.message = ""; } /** * @return the message */ public String getMessage() { return message; } /** * @param message * the message to set */ public void setMessage(String message) { this.message = message; } @SuppressWarnings("unchecked") public boolean quitSystem() { Map<?, ?> session = ActionContext.getContext().getSession(); Map<?, ?> application = ActionContext.getContext().getApplication(); Login login = (Login) session.get("user"); if (null == login || "".equals(login.getUsername().trim())) { this.message = "退出系统错误--Session error"; logger.debug(this.message); return false; } try { application.remove(login.getUsername()); session.clear(); return true; } catch (Exception e) { this.message = "退出系统错误--application error"; logger.error("quit system error!", e); } return false; }} 退出没有任何error是把?tghl是什么目录?LZ的工程名是什么?把路径关系截个图发下呗?另外,是否存在jsp跳转涉及/tghl相关的?(嗯,日志看不出你的类有问题,猜测与配置的路径有关;登出的Action,建议将remove和clear操作注释掉试试能否正常再次登录) tghl是项目名,跳转路径是对的啊,第一次登录一切能用,退出后也能登录,但是里面的功能不能用 个人觉得不是tomcat的原因,要看看你退出的代码是怎么写的,可能是退出那边有毛病 ssh 一个外键里面有多个值的问题求解! java入门教程:Hello world程序 采用jocky混淆java代码的问题 js 缺少对象错误 求解决 小问题,在线结贴! 高分求救,原来用access的时候分页没问题,现在用mysql就有问题了 还是乱码问题,折磨几天了,跪拜求指导,磕头了! 问个部署的问题...servlet 关于javaBean在jsp中引用的问题! SSH2中使用birt JSP下拉框多选 jxl 出力excel,单元格线的问题。实在不知道原因在哪里啊
package com.ldm.user.quit;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;public class QuitAction extends ActionSupport {
private static final long serialVersionUID = -3561246517849289095L;
public String execute() throws Exception {
QuitProcessor quit = new QuitProcessor();
if (quit.quitSystem()) {
return Action.LOGIN;
}
this.addActionMessage(quit.getMessage());
return Action.ERROR;
}
}
package com.ldm.user.quit;import java.util.Hashtable;
import java.util.Map;import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;import com.opensymphony.xwork2.ActionContext;
import com.ldm.login.Login;public class QuitProcessor {
final static Log logger = LogFactory.getLog(QuitProcessor.class);
private String message;
public QuitProcessor() {
this.message = "";
}
/**
* @return the message
*/
public String getMessage() {
return message;
}
/**
* @param message
* the message to set
*/
public void setMessage(String message) {
this.message = message;
}
@SuppressWarnings("unchecked")
public boolean quitSystem() {
Map<?, ?> session = ActionContext.getContext().getSession();
Map<?, ?> application = ActionContext.getContext().getApplication();
Login login = (Login) session.get("user");
if (null == login || "".equals(login.getUsername().trim())) {
this.message = "退出系统错误--Session error";
logger.debug(this.message);
return false;
}
try {
application.remove(login.getUsername());
session.clear();
return true;
} catch (Exception e) {
this.message = "退出系统错误--application error";
logger.error("quit system error!", e);
}
return false;
}
}
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;public class QuitAction extends ActionSupport {
private static final long serialVersionUID = -3561246517849289095L;
public String execute() throws Exception {
QuitProcessor quit = new QuitProcessor();
if (quit.quitSystem()) {
return Action.LOGIN;
}
this.addActionMessage(quit.getMessage());
return Action.ERROR;
}
}
//import java.util.Hashtable;
import java.util.Map;import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;import com.opensymphony.xwork2.ActionContext;
import com.ldm.login.Login;public class QuitProcessor {
final static Log logger = LogFactory.getLog(QuitProcessor.class);
private String message;
public QuitProcessor() {
this.message = "";
}
/**
* @return the message
*/
public String getMessage() {
return message;
}
/**
* @param message
* the message to set
*/
public void setMessage(String message) {
this.message = message;
}
@SuppressWarnings("unchecked")
public boolean quitSystem() {
Map<?, ?> session = ActionContext.getContext().getSession();
Map<?, ?> application = ActionContext.getContext().getApplication();
Login login = (Login) session.get("user");
if (null == login || "".equals(login.getUsername().trim())) {
this.message = "退出系统错误--Session error";
logger.debug(this.message);
return false;
}
try {
application.remove(login.getUsername());
session.clear();
return true;
} catch (Exception e) {
this.message = "退出系统错误--application error";
logger.error("quit system error!", e);
}
return false;
}
}
另外,是否存在jsp跳转涉及/tghl相关的?(嗯,日志看不出你的类有问题,猜测与配置的路径有关;登出的Action,建议将remove和clear操作注释掉试试能否正常再次登录)
tghl是项目名,跳转路径是对的啊,第一次登录一切能用,退出后也能登录,但是里面的功能不能用