Java webapp 在 Linux 上产生 StackOverflow 异常

标签 java linux tomcat web stack-overflow

我有一个在 Tomcat 9 上运行的 Java-web 应用程序。它在 Windowns 机器上运行良好。但是在 Debian Linux 服务器上部署此应用程序后,我在某些特定页面上遇到了 java.lang.StackOverflow 异常。这是堆栈跟踪日志的开头:

27-Dec-2017 08:54:43.746 SEVERE [https-jsse-nio-9443-exec-3] 
org.apache.catalina.core.ApplicationDispatcher.invoke Servlet.service() for 
servlet [jsp] threw exception
java.lang.StackOverflowError
at java.io.UnixFileSystem.canonicalize0(Native Method)
at java.io.UnixFileSystem.canonicalize(UnixFileSystem.java:172)
at java.io.File.getCanonicalPath(File.java:618)
at org.apache.catalina.webresources.AbstractFileResourceSet.file(AbstractFileResourceSet.java:90)

请在此处查看完整的堆栈跟踪: https://pastebin.com/0AmFDY8F

据我了解,Jasper 编译JSP 页面源代码时出现异常,这与Linux 路径/目录的解析有某种关系。谁能帮我弄清楚到底是什么问题?如果问题可能与此相关,我没有创建任何符号链接(symbolic link)。

最佳答案

根据您的堆栈跟踪,问题是由于无法找到由您的 Spring 框架解析的特定路径引起的:

org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)

...

Caused by: java.io.IOException: JSPException including path '/struct/context/tutorials.jsp'.

Spring 框架很可能使用规范路径来解析文件,但失败可能是因为框架中存在一些与您要部署到的 Unix 系统类型相关的怪癖。

请在 Spring 文档中引用它:

The default script supports most Linux distributions and is tested on CentOS and Ubuntu. Other platforms, such as OS X and FreeBSD, will require the use of a custom embeddedLaunchScript.

请注意,Debian 未列出。希望这能让您走上正确的道路。
如果我在这里追逐一条红鲱鱼,我很抱歉 - 但你没有给我们太多继续下去的机会。

关于Java webapp 在 Linux 上产生 StackOverflow 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47994103/

相关文章:

jakarta-ee - 在 Tomcat、WebLogic、Glassfish 等中使用哪个 MBeanServer?

hibernate - NoClassDefFound错误: org/hibernate/cfg/Configuration

Java 缓冲区策略导致严重滞后

java - system.out 对象到字符串

php - Linux 上 php 服务内存使用率高

ruby - 在 linux 服务器上不使用 rvm 从 Ruby 1.9.2p290 升级到 1.9.3p2

linux - 为什么 *nix 命令被称为 Man(1)、Diff(1)、Cat(1) 等

java - @OneToOne Hibernate 带注释。无法正确保存

java - Checked Exception是编译时还是运行时?

java - 无法将应用程序部署到 Tomcat