javax.el.E​​LException:类[java.lang.Number]必须是public,非抽象而不是接口

时间:2017-12-21 16:49:16

标签: jsp jstl el

我得到"错误500:javax.el.E​​LException:类[java.lang.Number]必须是公共的,非抽象的而不是接口"在我的jsp页面上。

这是日志。

000001f8 ServletWrappe E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: An exception was thrown by one of the service methods of the servlet [/WEB-INF/pages/tpl/docDetail.jsp] in application [gsa]. Exception created : [javax.el.ELException: The class [java.lang.Number] must be public, non-abstract and not an interface
        at javax.el.ImportHandler.findClass(ImportHandler.java:231)
        at javax.el.ImportHandler.resolveClass(ImportHandler.java:185)
        at javax.servlet.jsp.el.ScopedAttributeELResolver.getValue(ScopedAttributeELResolver.java:140)
        at org.apache.jasper.el.JasperELResolver.getValue(JasperELResolver.java:110)
        at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:80)
        at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
        at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:815)
        at com.ibm._jsp._docDetail._jspx_meth_c_out_1(_docDetail.java:311)
        at com.ibm._jsp._docDetail._jspService(_docDetail.java:130)
        at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:99)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1235)
        at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:779)
        at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
        at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
        at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:122)
        at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:220)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1124)
        at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:1390)
        at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:196)
        at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
        at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
        at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
        at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:318)
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
        at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)

这是我的docDetail.jsp页面代码:



<%-- --------------- LANGUAGE --------------- --%>
<%@ page contentType="text/html; charset=UTF-8" %>
<%-- --------------- TAGLIBS --------------- --%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%-- --------------- IMPORTS --------------- --%>

<%@page import="java.util.List,java.util.Iterator,
                com.vw.gsasearch.domain.tpl.model.TplProcess" %> 
                
            

<c:set var="cssURL">
  <bean:message key="css.elsa.vw"  />
</c:set>
<c:set var="cssURL">
  <html:rewrite page="${cssURL}" />
</c:set>

<html>
<head>
  <LINK href='<c:out value="${cssURL}" />' rel="stylesheet" type="text/css" />
  <style>
  td{
        color: #000000; 
        font-size: 10pt; 
        font-family: Arial, Helvetica, sans-serif; 
        text-decoration: none;  
   }
  </style>  
  
   <script language="JavaScript" type="text/javascript">
      var g_count;
      var g_position;
	  function disableButtons() {
	 
	  	if (top['barFs']) {
	  	  g_count = '<c:out value="${Number}"/>';
	  	  g_position = '<c:out value="${Position}"/>';
	  	  if (!(top['barFs'].disableButtons)) {
            window.setTimeout("delay100()", 100);
          } else {
            top['barFs'].disableButtons(g_count, g_position);
          }
	  	}
		
	  }
	  function delay100() {
        if (!(top['barFs'].disableButtons)) {
          window.setTimeout("delay100()", 100);
        } else {
          top['barFs'].disableButtons(g_count, g_position);
        }
	
      }
      
  </script>
</head>

<body class="elsaBackground_light" onload="disableButtons();">
<form>
	<table cellpadding="5" cellspacing="5">
		<tr>
   <%-- <td><bean:message key="process.pid" bundle="TPL" />:</td>
    <td><select class="readonlyInput" readonly="readonly" name="kdnr" size="1">
    <option>&nbsp;</option></td> --%>
		  <td><bean:message key="process.revised"  />: </td>
		  <td><c:out value="${procedure.changeDate}" /></td>
		</tr>
	</table>
	</body>
	
	<%-- remove session atrribute --%>	
	<%--<c:remove var="procedure" scope="session" /> --%>	
</html>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:3)

修复您的变量名称以符合Java naming conventions,此问题将消失。

罪魁祸首在这里:

<c:out value="${Number}"/>

在EL 3.0的新“导入常量”功能中:

at javax.el.ImportHandler.findClass(ImportHandler.java:231) 
at javax.el.ImportHandler.resolveClass(ImportHandler.java:185)

在Java中,变量名以小写开头,类名以大写开头。从EL 3.0开始,java.lang.*包中的任何内容都隐式导入EL范围,因此也java.lang.Number。换句话说,当您在EL中引用与${Number}类匹配的java.lang.Number时,它会尝试加载它无法执行的操作,因为它是abstract

但这毕竟不是你的意图。您显然希望引用一个您误导Number而不是number的自定义变量。

至于为什么Apache EL试图解决${Number}这样的问题,而它根本没有任何常量是一个不同的问题。你最好report an issue to Tomcat guys