我试图在新的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运行时类,但是我不知道为什么。
任何帮助都将不胜感激。
发布于 2012-11-08 17:12:15
将jndi查找代码添加到单独的java类中,并从jsp页面调用它。
https://stackoverflow.com/questions/12602009
复制相似问题