Tomcat7出现HTTP Status 500 - java.lang.ClassCastException: org.apache.jasper.el.ELContextImpl cannot be cast to org.apache.jasper.

今天在Tomcat7上发布了一个war,过一阵子发现localhost:8080都进不去了。在浏览器输入http://localhost:8080出现如下内容:

几天折磨下来,看到bug就头痛,可是没办法啊,还是得想办法解决。

Google百度一番,终于得解。

如下:::

里面说是EL表达式的错误,个人呢觉得方案2比较好用,

于是修改C:\Tomcat7\conf\context.xml如下:

<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- The contents of this file will be loaded for each web application -->
<Context>
    <Loader delegate="true" />

    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>

    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->

    <!-- Uncomment this to enable Comet connection tacking (provides events
         on session expiration as well as webapp lifecycle) -->
    <!--
    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
    -->

</Context>

加入了上面的粗体字后,停止Tomcat7服务,在启动Tomcat7服务,OK!!!

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
这个错误信息是在使用Apache Axis(一个Java库,用于创建Web服务和客户端)时遇到的问题。错误的具体含义是:由于一个`org.apache.axis.AxisFault`异常,系统试图将一个字符串类型的值强制转换为`java.lang.Long`类型,但这是不允许的,因为`String`并不是`Long`类型的子类或可以自动转换的类型。 - `org.apache.axis.AxisFault`:表示在Axis框架中发生了错误,可能是由于网络问题、请求处理错误或者是与服务端接口不匹配导致的。 - `java.lang.ClassCastException`:这是一个运行时异常,它发生在试图将一个对象从一个类转换到另一个类,但它们实际上是不兼容的类型时。 - `java.lang.String cannot be cast to java.lang.Long`:这句话直译就是“无法将字符串转换为长整型”。 可能的原因包括: 1. 在服务端,预期接收的是long类型的参数,但在发送请求时误传了字符串。 2. 代码中有一个地方尝试将从API返回的响应解析为long,但实际响应可能是字符串而非数字。 3. 可能的数据绑定或序列化问题,如XML或JSON转换时出错。 要解决这个问题,你需要检查出错代码行,确认是否正确地处理了数据类型,并确保在发送和接收数据时类型匹配。如果是在调用远程服务,检查一下服务的文档,看看预期的参数格式。如果是代码错误,修复转换的地方,可能需要使用`Long.parseLong()`或`Long.valueOf()`函数来正确转换字符串。如果你不确定,还可以考虑添加适当的异常处理代码来捕获并处理这个错误。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值