highcharts导出 - Java方法

时间:2013-09-24 00:56:39

标签: highcharts highstock

我使用新的基于Java的导出服务器通过向服务器发送POST请求将输入JSON转换为SVG。

最初我通过运行jetty在我的本地机器上进行了一些测试,并且我能够向localhost发送POST请求:8080 / export并返回SVG。

我现在已经构建了was文件并将其部署在Tomcat服务器上,导出服务器正在端口8080上运行。我可以打开演示页面(http://:8080 / highcharts-export-web),但当我点击"生成图像"或通过客户端发送POST请求我看到一个消息"抱歉,服务器此刻正在处理太多请求。请再试一次。"

我尝试远程调试并在Java中看到了一个Pool异常,如果我做错了什么,请你告诉我。以下是我的app-convert.properties

#### phantomjs properties ####

# the host and port phantomjs listens to
host = 127.0.0.1
port = 7777

# location of the phantomjs executable, could be for example /usr/local/bin/phantomjs
exec = /usr/bin/phantomjs

# name of the convert script used by phantomjs
script = highcharts-convert.js

#### connect properties used to connect with phantomjs running as HTTP-server ####
# all values in milliseconds

# specifies the timeout when reading from phantomjs when a connection is established
readTimeout = 6000

# timeout to be used when opening a communications link to the phantomjs server
connectTimeout = 500

# the whole request to the phantomjs server is scheduled, max timeout can last to this      value. This is because in java you can't rely on the above two timeouts.
maxTimeout = 6500

#### Pool properties ####

# number of phantomjs servers you can run in the pool.
poolSize = 2

# The pool is implemented as a BlockingQueue. When asking for a phantom server  connection and nothing is available, it waits for the number of milliseconds defined by maxWait
maxWait = 500

1 个答案:

答案 0 :(得分:0)

使用导出服务器时出现问题时,首先要做的是启用日志记录调试消息。这可以为您提供出错的线索。要启用调试消息,请在highcharts-export / highcharts-export-web / src / main / resources / log4j.properties中取消注释这些行

# Debug specific class
log4j.logger.services=DEBUG
log4j.logger.converter=DEBUG
log4j.logger.exporter=DEBUG
log4j.logger.pool=DEBUG

启动应用程序服务器并查找用于启动phantomjs的突击队。请参阅文件Server.java中第53行的调试语句

你能用这个突击队员启动一个phantomjs服务器吗?