2013-09-24 40 views
1

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

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

我现在已经构建了was文件并已将其部署到Tomcat服务器上,导出服务器正在端口8080上运行。我可以调出演示页面(http://:8080/highcharts-export-web) ,但是当我点击“生成图像”或通过客户端发送POST请求时,我看到msg“对不起,服务器正在处理太多请求,请重试。”

我试着远程调试,发现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 

回答

0

在使用出口服务器出现问题时,你可以做的第一件事就是启用日志记录调试消息。这可以让你知道发生了什么问题。要启用调试消息,取消这些线路在highcharts出口/ highcharts出口的web/src目录/主/资源/ 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服务器吗?

+0

我想通了,phantomJS运行不正常。我在CentOS上运行服务器并将phantomJS复制到/ usr/local/bin,但在CentOS上这样做是不够的,您必须安装2个额外的软件包。我做了sudo yum安装freetype和sudo yum安装fontconfig和viola它开始工作。 – user2317558

+0

嗨,很高兴听到你得到它的工作! –