description-关于tomcat 报错原因

问题描述

关于tomcat 报错原因

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

java.lang.ClassCastException: com.sany.web.session.WebSession cannot be cast to java.lang.String
com.sany.web.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:34)》<!--->

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.35 logs.

/**

  • */
    package com.sany.web.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;

import com.sany.util.log.ILogger;

public class SetCharacterEncodingFilter implements Filter {
private static final ILogger logger = ILogger.getInstance().getILogger(SetCharacterEncodingFilter.class);
public void init(FilterConfig arg0) throws ServletException {
// TODO Auto-generated method stub

}

public void doFilter(ServletRequest request, ServletResponse response, FilterChain fileter) throws IOException, ServletException {
    // TODO Auto-generated method stub
    request.setCharacterEncoding("GBK");
    HttpServletRequest req = (HttpServletRequest) request;

// response.setCharacterEncoding("GBK");
try{
fileter.doFilter(request, response);

}
catch(Exception e){
logger.error((String)req.getSession().getAttribute("user"),"doFilter(ServletRequest request=" + request
+ ", ServletResponse response=" + response
+ ") - [方法错误]", e);

        e.printStackTrace();
    }
}
public void destroy() {
    // TODO Auto-generated method stub

}

}

解决方案

com.sany.web.session.WebSession cannot be cast to java.lang.String
类型转换错误 应该用WebSession接的你用的是String
错误在etCharacterEncodingFilter.java:34

解决方案二:

 (String)(req.getSession().getAttribute("user"))
时间: 2025-01-31 05:59:17

description-关于tomcat 报错原因的相关文章

Tomcat报错:HTTP Status 500 (Wrapper cannot find servlet class)解决办法_java

Tomcat报错:HTTP Status 500 - Wrapper cannot find servlet class HTTP Status 500 - Wrapper cannot find servlet class com.servlet.servlet.RegServlet or a class it depends on type Exception report message Wrapper cannot find servlet class com.servlet.servl

hibernate-有关tomcat报错500的问题

问题描述 有关tomcat报错500的问题 description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: Failed to load or instantiate TagExtraInfo class: org.apache.struts.taglib.bean

spring-新人求助 tomcat 报错ClassNotFoundException

问题描述 新人求助 tomcat 报错ClassNotFoundException 2016-4-20 10:11:33 org.apache.catalina.core.ApplicationContext log信息: Initializing Spring FrameworkServlet 'spring'2016-4-20 10:11:39 org.apache.catalina.core.StandardContext listenerStart严重: Error configurin

mycelipse 启动tomcat 报错

问题描述 mycelipse 启动tomcat 报错 1C myeclipse-blue 同时开启两个,一个正常一个报错如下: 解决方案 虚拟机配置错误,重新配置一下虚拟机 解决方案二: 注:Unrecognized option: -vmargs 错误吗 解决方案三: 启动tomcat报错tomcat启动报错解决方案Tomcat启动报错,一闪而过 等问题 解决方案四: 不能创建Java虚拟机,一个严重的异常操作,程序将返回,之前我有个同学也遇到过,没什么大问题,清理一下垃圾和插件,然后重启一下

图片-eclipse下启动tomcat报错

问题描述 eclipse下启动tomcat报错 解决方案 你的这个目录下边是不是空的啊 解决方案二: 我怎么觉得你的路径有些问题呢 解决方案三: 我用的是eclipse-jee-indigo-SR2-win32这个版本,其它版本可能有所不同 配置servers服务时,会在工作路径下创建一个servers.且不会把调试目录放入Tomcat里的webapps里.但用地址仍可访问.等工程完成可以打包成.war手工放入webapps里. 1.找不到apr--(这个网上很多的,搜一下,要下一个对应版本的t

eclipse启动tomcat报错

问题描述 eclipse启动tomcat报错 一下报错信息:FATAL ERROR in native method: JDWP No transports initialized jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)ERROR: transport error 202: gethostbyname: unknown hostERROR: JDWP Transport dt_socket failed to initialize TRANSPORT

myeclipse中启动tomcat报错

问题描述 myeclipse中启动tomcat报错 在myeclipse中启动tomcat时报错,不知道怎么解决,请网友指点:报错信息如下Deployment is out of date due to changes in the underlying project contents.You'll need to 'Redeploy' the project to update the deployed archive; 警告提示是:构建路径指定执行环境 JavaSE-1.6.工作空间中没有

config-eclipse中,添加web.xml后,tomcat报错。

问题描述 eclipse中,添加web.xml后,tomcat报错. The Tomcat server configuration at ServersTomcat v7.0 Server at localhost-config is missing. Check the server for errors. 解决方案 Tomcat v7.0 Server没启动吧

eclipse中,使用tomcat插件启动tomcat报错

问题描述 eclipse中,使用tomcat插件启动tomcat报错 具体错误: SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [/manager] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalin