I am new to Highcharts. I am trying to set up a local highcharts export server according to http://www.highcharts.com/docs/export-module/setting-up-the-server. I cannot seem to get it work.
I am using the Java version.
Here is what I did:
I downloaded both PhantomJS and Highcharts export server from Github. I extracted them to two folders as follows:
D:\Tools\highcharts.com-master
D:\Tools\phantomjs-1.9.7-windows
I put D:\Tools\phantomjs-1.9.7-windows in the Windows PATH
In a DOS shell, I chose
D:\Tools\highcharts.com-master\exporting-server\phantomjs
as the working directory because highcharts-convert.js is in this directory
I ran this command
phantomjs highcharts-convert.js -host 127.0.0.1 -port 7777
and I got the following response:
OK, PhantomJS is ready.
- I ran
mvn install
in
D:\Tools\highcharts.com-master\exporting-server\java\highcharts-export
and
mvn clean package
in
D:\Tools\highcharts.com-master\exporting-server\java\highcharts-export\highcharts-export-web
and I got success in both.
Open another DOS prompt, and switch to
D:\Tools\highcharts.com-master\exporting-server\java\highcharts-export\highcharts-export-web
and then run
mvn jetty:run
and the web server starts. Note that I have
host = 127.0.0.1
port = 7777
exec = phantomjs.exe
in the app-convert.properties file under
D:\Tools\highcharts.com-master\exporting-server\java\highcharts-export\highcharts-export-web\src\main\webapp\WEB-INF\spring
Now in my chart, I have the following:
exporting: { enabled: true, url:'http://127.0.0.1:8080/export' }
However, when I chose one of download options such as JPEG, I got the following error:
Failed rendering:
SyntaxError: Unable to parse JSON string
I got stuck here. I looked for related posts, but did not find one.
Thanks in advance for any input!
---------------Update----------
After changing all ports to 8080 and stopping manually starting phantomjs based on Pawel's suggestion, I got limited success. Most of the time I got the same error message. Once in a while, I got one or two successes ONLY during the server start process (this means I clicked the dropdown menu and selected one of the download options when the web server (jetty) starts). The following is what I have during and after server starts (I have debug enabled according to HC document). Can anybody see anything wrong?
D:\Tools\highcharts.com-master\exporting-server\java\highcharts-export\highcharts-export-web>D:\Tools\apache-maven\bin\mvn jetty:run
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building highcharts-export-web 2.1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> jetty-maven-plugin:8.1.15.v20140411:run (default-cli) @ highcharts-export-web >>>
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ highcharts-export-web ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ highcharts-export-web ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ highcharts-export-web ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\Tools\highcharts.com-master\exporting-server\java\highcharts-export\highcharts-export-web\src\test\re
rces
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ highcharts-export-web ---
[INFO] No sources to compile
[INFO]
[INFO] <<< jetty-maven-plugin:8.1.15.v20140411:run (default-cli) @ highcharts-export-web <<<
[INFO]
[INFO] --- jetty-maven-plugin:8.1.15.v20140411:run (default-cli) @ highcharts-export-web ---
[INFO] Configuring Jetty for project: highcharts-export-web
[INFO] webAppSourceDirectory not set. Defaulting to D:\Tools\highcharts.com-master\exporting-server\java\highcharts-export\highcharts-export-web\sr
ain\webapp
[INFO] Reload Mechanic: manual
[INFO] Classes = D:\Tools\highcharts.com-master\exporting-server\java\highcharts-export\highcharts-export-web\target\classes
[INFO] Context path = /export
[INFO] Tmp directory = D:\Tools\highcharts.com-master\exporting-server\java\highcharts-export\highcharts-export-web\target\tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides = none
[INFO] web.xml file = file:/D:/Tools/highcharts.com-master/exporting-server/java/highcharts-export/highcharts-export-web/src/main/webapp/WEB-INF/we
ml
[INFO] Webapp directory = D:\Tools\highcharts.com-master\exporting-server\java\highcharts-export\highcharts-export-web\src\main\webapp
2014-09-29 20:15:20.044:INFO:oejs.Server:jetty-8.1.15.v20140411
2014-09-29 20:15:20.387:INFO:oejpw.PlusConfiguration:No Transaction manager found - if your webapp requires one, please configure one.
2014-09-29 20:15:21.732:INFO:/export:No Spring WebApplicationInitializer types detected on classpath
2014-09-29 20:15:22.028:INFO:/export:Initializing Spring root WebApplicationContext
Highcharts Export Server using C:\Users\ME~1\AppData\Local\Temp\export619479135740412406 as TEMP folder.
[DEBUG] [main 08:15:22] (ServerObjectFactory.java:afterBeanInit:186) Copy javascript file to temp folder, resource doesn't exist: maps.js
2014-09-29 20:15:22.536:INFO:/export:Initializing Spring FrameworkServlet 'export'
2014-09-29 20:15:23.055:WARN:oejsh.RequestLogHandler:!RequestLog
2014-09-29 20:15:23.070:INFO:oejs.AbstractConnector:Started [email protected]:8080
[INFO] Started Jetty Server
[INFO] Console reloading is ENABLED. Hit ENTER on the console to restart the context.
[DEBUG] [pool-1-thread-1 08:15:32] (AbstractPool.java:poolCleaner:53) HC: queue size: 0 poolSize 0
[DEBUG] [pool-1-thread-1 08:15:32] (AbstractPool.java:poolCleaner:74) in cleanpool, the surplus or shortage is: -10
[DEBUG] [pool-1-thread-1 08:15:32] (ServerObjectFactory.java:create:44) in makeObject, phantomjs.exe, highcharts-convert.js, 127.0.0.1
[DEBUG] [pool-1-thread-1 08:15:32] (ServerObjectFactory.java:getAvailablePort:102) Nothing free in Portusage {}
[DEBUG] [pool-1-thread-1 08:15:32] (ServerObjectFactory.java:create:44) in makeObject, phantomjs.exe, highcharts-convert.js, 127.0.0.1
[DEBUG] [pool-1-thread-1 08:15:32] (ServerObjectFactory.java:getAvailablePort:102) Nothing free in Portusage {8080=BUSY}
[DEBUG] [pool-1-thread-1 08:15:33] (ServerObjectFactory.java:create:44) in makeObject, phantomjs.exe, highcharts-convert.js, 127.0.0.1
[DEBUG] [pool-1-thread-1 08:15:33] (ServerObjectFactory.java:getAvailablePort:102) Nothing free in Portusage {8081=BUSY, 8080=BUSY}
[DEBUG] [pool-1-thread-1 08:15:33] (ServerObjectFactory.java:create:44) in makeObject, phantomjs.exe, highcharts-convert.js, 127.0.0.1
[DEBUG] [pool-1-thread-1 08:15:33] (ServerObjectFactory.java:getAvailablePort:102) Nothing free in Portusage {8082=BUSY, 8081=BUSY, 8080=BUSY}
[DEBUG] [pool-1-thread-1 08:15:34] (ServerObjectFactory.java:create:44) in makeObject, phantomjs.exe, highcharts-convert.js, 127.0.0.1
[DEBUG] [pool-1-thread-1 08:15:34] (ServerObjectFactory.java:getAvailablePort:102) Nothing free in Portusage {8083=BUSY, 8082=BUSY, 8081=BUSY, 8080
SY}
[DEBUG] [pool-1-thread-1 08:15:34] (ServerObjectFactory.java:create:44) in makeObject, phantomjs.exe, highcharts-convert.js, 127.0.0.1
[DEBUG] [pool-1-thread-1 08:15:34] (ServerObjectFactory.java:getAvailablePort:102) Nothing free in Portusage {8084=BUSY, 8083=BUSY, 8082=BUSY, 8081
SY, 8080=BUSY}
[DEBUG] [pool-1-thread-1 08:15:35] (ServerObjectFactory.java:create:44) in makeObject, phantomjs.exe, highcharts-convert.js, 127.0.0.1
[DEBUG] [pool-1-thread-1 08:15:35] (ServerObjectFactory.java:getAvailablePort:102) Nothing free in Portusage {8085=BUSY, 8084=BUSY, 8083=BUSY, 8082
SY, 8081=BUSY, 8080=BUSY}
[DEBUG] [pool-1-thread-1 08:15:35] (ServerObjectFactory.java:create:44) in makeObject, phantomjs.exe, highcharts-convert.js, 127.0.0.1
[DEBUG] [pool-1-thread-1 08:15:35] (ServerObjectFactory.java:getAvailablePort:102) Nothing free in Portusage {8086=BUSY, 8085=BUSY, 8084=BUSY, 8083
SY, 8082=BUSY, 8081=BUSY, 8080=BUSY}
[DEBUG] [pool-1-thread-1 08:15:36] (ServerObjectFactory.java:create:44) in makeObject, phantomjs.exe, highcharts-convert.js, 127.0.0.1
[DEBUG] [pool-1-thread-1 08:15:36] (ServerObjectFactory.java:getAvailablePort:102) Nothing free in Portusage {8087=BUSY, 8086=BUSY, 8085=BUSY, 8084
SY, 8083=BUSY, 8082=BUSY, 8081=BUSY, 8080=BUSY}
[DEBUG] [pool-1-thread-1 08:15:36] (ServerObjectFactory.java:create:44) in makeObject, phantomjs.exe, highcharts-convert.js, 127.0.0.1
[DEBUG] [pool-1-thread-1 08:15:36] (ServerObjectFactory.java:getAvailablePort:102) Nothing free in Portusage {8087=BUSY, 8086=BUSY, 8085=BUSY, 8084
SY, 8083=BUSY, 8082=BUSY, 8081=BUSY, 8080=BUSY, 8088=BUSY}
[DEBUG] [pool-1-thread-1 08:16:32] (AbstractPool.java:poolCleaner:53) HC: queue size: 10 poolSize 10
[DEBUG] [pool-1-thread-1 08:16:32] (AbstractPool.java:poolCleaner:63) HC: validating com.highcharts.export.server.Serverlistening to port: 8080
[DEBUG] [pool-1-thread-1 08:16:32] (ServerObjectFactory.java:validate:62) server passed validation
[DEBUG] [pool-1-thread-1 08:16:32] (AbstractPool.java:poolCleaner:63) HC: validating com.highcharts.export.server.Serverlistening to port: 8081
[DEBUG] [pool-1-thread-1 08:16:32] (ServerObjectFactory.java:validate:62) server passed validation
[DEBUG] [pool-1-thread-1 08:16:32] (AbstractPool.java:poolCleaner:63) HC: validating com.highcharts.export.server.Serverlistening to port: 8082
[DEBUG] [pool-1-thread-1 08:16:32] (ServerObjectFactory.java:validate:62) server passed validation
[DEBUG] [pool-1-thread-1 08:16:32] (AbstractPool.java:poolCleaner:63) HC: validating com.highcharts.export.server.Serverlistening to port: 8083
[DEBUG] [pool-1-thread-1 08:16:32] (ServerObjectFactory.java:validate:62) server passed validation
[DEBUG] [pool-1-thread-1 08:16:32] (AbstractPool.java:poolCleaner:63) HC: validating com.highcharts.export.server.Serverlistening to port: 8084
[DEBUG] [pool-1-thread-1 08:16:32] (ServerObjectFactory.java:validate:62) server passed validation
[DEBUG] [pool-1-thread-1 08:16:32] (AbstractPool.java:poolCleaner:63) HC: validating com.highcharts.export.server.Serverlistening to port: 8085
[DEBUG] [pool-1-thread-1 08:16:32] (ServerObjectFactory.java:validate:62) server passed validation
[DEBUG] [pool-1-thread-1 08:16:32] (AbstractPool.java:poolCleaner:63) HC: validating com.highcharts.export.server.Serverlistening to port: 8086
[DEBUG] [pool-1-thread-1 08:16:32] (ServerObjectFactory.java:validate:62) server passed validation
[DEBUG] [pool-1-thread-1 08:16:32] (AbstractPool.java:poolCleaner:63) HC: validating com.highcharts.export.server.Serverlistening to port: 8087
[DEBUG] [pool-1-thread-1 08:16:32] (ServerObjectFactory.java:validate:62) server passed validation
[DEBUG] [pool-1-thread-1 08:16:32] (AbstractPool.java:poolCleaner:63) HC: validating com.highcharts.export.server.Serverlistening to port: 8088
[DEBUG] [pool-1-thread-1 08:16:32] (ServerObjectFactory.java:validate:62) server passed validation
[DEBUG] [pool-1-thread-1 08:16:32] (AbstractPool.java:poolCleaner:63) HC: validating com.highcharts.export.server.Serverlistening to port: 8089
[DEBUG] [pool-1-thread-1 08:16:32] (ServerObjectFactory.java:validate:62) server passed validation
[DEBUG] [pool-1-thread-1 08:16:32] (AbstractPool.java:poolCleaner:74) in cleanpool, the surplus or shortage is: 0
[DEBUG] [pool-1-thread-1 08:17:32] (AbstractPool.java:poolCleaner:53) HC: queue size: 10 poolSize 10
[DEBUG] [pool-1-thread-1 08:17:32] (AbstractPool.java:poolCleaner:63) HC: validating com.highcharts.export.server.Serverlistening to port: 8080
[DEBUG] [pool-1-thread-1 08:17:32] (ServerObjectFactory.java:validate:62) server passed validation
[DEBUG] [pool-1-thread-1 08:17:32] (AbstractPool.java:poolCleaner:63) HC: validating com.highcharts.export.server.Serverlistening to port: 8081
[DEBUG] [pool-1-thread-1 08:17:32] (ServerObjectFactory.java:validate:62) server passed validation
[DEBUG] [pool-1-thread-1 08:17:32] (AbstractPool.java:poolCleaner:63) HC: validating com.highcharts.export.server.Serverlistening to port: 8082
[DEBUG] [pool-1-thread-1 08:17:32] (ServerObjectFactory.java:validate:62) server passed validation
[DEBUG] [pool-1-thread-1 08:17:32] (AbstractPool.java:poolCleaner:63) HC: validating com.highcharts.export.server.Serverlistening to port: 8083
[DEBUG] [pool-1-thread-1 08:17:32] (ServerObjectFactory.java:validate:62) server passed validation
[DEBUG] [pool-1-thread-1 08:17:32] (AbstractPool.java:poolCleaner:63) HC: validating com.highcharts.export.server.Serverlistening to port: 8084
[DEBUG] [pool-1-thread-1 08:17:32] (ServerObjectFactory.java:validate:62) server passed validation
[DEBUG] [pool-1-thread-1 08:17:32] (AbstractPool.java:poolCleaner:63) HC: validating com.highcharts.export.server.Serverlistening to port: 8085
[DEBUG] [pool-1-thread-1 08:17:32] (ServerObjectFactory.java:validate:62) server passed validation
[DEBUG] [pool-1-thread-1 08:17:32] (AbstractPool.java:poolCleaner:63) HC: validating com.highcharts.export.server.Serverlistening to port: 8086
[DEBUG] [pool-1-thread-1 08:17:32] (ServerObjectFactory.java:validate:62) server passed validation
[DEBUG] [pool-1-thread-1 08:17:32] (AbstractPool.java:poolCleaner:63) HC: validating com.highcharts.export.server.Serverlistening to port: 8087
[DEBUG] [pool-1-thread-1 08:17:32] (ServerObjectFactory.java:validate:62) server passed validation
[DEBUG] [pool-1-thread-1 08:17:32] (AbstractPool.java:poolCleaner:63) HC: validating com.highcharts.export.server.Serverlistening to port: 8088
[DEBUG] [pool-1-thread-1 08:17:32] (ServerObjectFactory.java:validate:62) server passed validation
[DEBUG] [pool-1-thread-1 08:17:32] (AbstractPool.java:poolCleaner:63) HC: validating com.highcharts.export.server.Serverlistening to port: 8089
[DEBUG] [pool-1-thread-1 08:17:32] (ServerObjectFactory.java:validate:62) server passed validation
[DEBUG] [pool-1-thread-1 08:17:32] (AbstractPool.java:poolCleaner:74) in cleanpool, the surplus or shortage is: 0