问题描述
我正在尝试在浏览器上显示我的报告,但我一直收到此错误:
I'm trying to display my reports on the browser , but I keep getting this error:
这个奇怪的是,它只会在我尝试生成报告时发生从服务器上安装的版本开始,但不是当我在我的电脑上本地使用时
the strange thing about this, is that it only happens when I attempt to generate the reports from the version installed on the server, but not when I do it locally from my pc
你知道为什么会发生这种情况吗?
Have you any idea why this is happening ?
推荐答案
这似乎是无头模式问题。您需要将 java.awt.headless
属性设置为 true
。这可以使用:
This seems like a Headless mode issue. You need to set the java.awt.headless
property to true
. That can be done using:
static {
System.setProperty("java.awt.headless", "true");
}
或者,通过将tomcat启动命令中的无头属性设置为 -Djava.awt.headless = true
Or, by setting the headless property in your tomcat startup command as -Djava.awt.headless=true
此外,你可以阅读更多关于为什么这是必要的,你可以阅读有关无头模式
Also, you can read more on why this is necessary, you can read about the Headless mode here
这篇关于无法初始化类net.sf.jasperreports.engine.util.JRStyledTextParser的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!