我正在使用新的基於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
我想通了,phantomJS運行不正常。我在CentOS上運行服務器並將phantomJS複製到/ usr/local/bin,但在CentOS上這樣做是不夠的,您必須安裝2個額外的軟件包。我做了sudo yum安裝freetype和sudo yum安裝fontconfig和viola它開始工作。 – user2317558
嗨,很高興聽到你得到它的工作! –