java tomcat:只能导入一种类型。 com.aB 解析为一个包
我有以下项目结构:
./WEB-INF/web.xml
./WEB-INF/lib
./WEB-INF/classes/com/a/B.class
./index.jsp
当我尝试将此项目放入 tomcat webapp 并尝试执行 index.jsp 时,我收到错误:
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 6 in the generated java file
Only a type can be imported. com.a.B resolves to a package
如果我尝试导入任何其他不存在的类名,我会收到完全相同的错误。
这是我的 web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index_canvas.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>B</servlet-name>
<servlet-class>com.a.B</servlet-class>
</servlet>
</web-app>
有什么想法吗?
谢谢!
i have the following project structure:
./WEB-INF/web.xml
./WEB-INF/lib
./WEB-INF/classes/com/a/B.class
./index.jsp
when i try to put this project in tomcat webapp and try to execute index.jsp i get the error:
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 6 in the generated java file
Only a type can be imported. com.a.B resolves to a package
if I try to import any other class names that do not exist I get the exact same error.
this is my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index_canvas.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>B</servlet-name>
<servlet-class>com.a.B</servlet-class>
</servlet>
</web-app>
Any ideas ?
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用动态链接文件,通过将类复制到适当的位置解决了问题。它可能与我不知道的权限问题有关。至少现在我确信这个错误与找不到课程有关。
感谢您的帮助。
i used dynamic linked files, i resolved the issue by copying the classes to their appropriate place. it may relate to permissions issues i do not know. at least now i'm sure that this error related to no finding the class.
thanks for your assistance.