Apache Tomcat 8.0.27.0 版本遇到的一些坑This static method of interface UserOperation can only be accessed as

 

前言:

    今天在写web应用的时候报错了,我在报错了的地方看了又看,都没看出有什么问题,在网上检索,也全都是一些答非所问的结果。为什么,为什么,满脑子都是为什么,语法没有错啊。

经过:

    看了看报错信息:

 

 
org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 13 in the jsp file: /WEB-INF/node/NavbarFixedTop.jspThis static method of interface UserOperation can only be accessed as UserOperation.getUser10: <%@page contentType="text/html" pageEncoding="UTF-8"%>11: 12: <%13: User navbarFixedTopUser = UserOperation.getUser(request);14: %>15: 16: 

Unable to compile class for JSP:无法编译JSP类?我的第一个反应是我的jsp文件语法有问题。。。。。。,但是我怎么看都看不出语法错误在哪里,然后我搜了搜详细的错误信息:This static method of interface UserOperation can only be accessed as UserOperation.getUser

 

uploading.4e448015.gif转存失败重新上传取消uploading.4e448015.gif转存失败重新上传取消uploading.4e448015.gif转存失败重新上传取消uploading.4e448015.gif转存失败重新上传取消uploading.4e448015.gif转存失败重新上传取消

 

什么都没搜到,后来,我看了一看tomcat的版本8.0.27.0

uploading.4e448015.gif转存失败重新上传取消uploading.4e448015.gif转存失败重新上传取消uploading.4e448015.gif转存失败重新上传取消uploading.4e448015.gif转存失败重新上传取消uploading.4e448015.gif转存失败重新上传取消

由此,我联想到了我这里使用了jdk8的新特性,接口里面可以定义静态方法,而且只有写在jsp里面才报错,由此我猜测可能是tomcat的流程问题导致无法支持这个新特性。

 

 

结论:

    在写web应用的时候,要注意使用web容器是否支持编程语言的所有特性,支持哪些特性,不支持哪些特性;

    tomcat 8.0.27.0 虽然8开头,但并不完全支持java8

 

博主个人博客:https://remonkado.com/

你可能感兴趣的:(Web)