我正在尝试为新的 WSO2 AppServer(版本 5.0.0)运行一个非常简单的应用程序,但似乎发生了一些非常奇怪的事情。当我尝试访问执行简单 JNDI 查找的页面时,我收到以下错误:
HTTP Status 500 - org.apache.jasper.JasperException: Unable to compile class for JSP Generated servlet error:
Only a type can be imported. javax.naming.InitialContext resolves to a package
An error occurred at line: 11 in the jsp file: /jndi.jsp
Generated servlet error: InitialContext cannot be resolved to a type
An error occurred at line: 11 in the jsp file: /jndi.jsp Generated servlet error:
InitialContext cannot be resolved to a type
该页面仅包含以下代码:
<!DOCTYPE html>
<%@page contentType="text/html" pageEncoding="ISO-8859-1"%>
<%@page import="javax.naming.InitialContext" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>JNDI Test</title>
</head>
<body>
<h1>JNDI Test</h1>
<%
InitialContext ctx = new InitialContext();
%>
<p>Context: <%= ctx.getNameInNamespace() %>
</body>
</html>
似乎tomcat编译器无法“看到”java运行时类,但我不知道为什么。
任何帮助,将不胜感激。