EDIT: Solution was to place all phatomJS related scripts into the Scripts directory and make sure none of the items are read-only for Windows.
My scripts and phantomjs.exe all exist here: C:\jetty-distribution-9.0.0.M3\webapps\ROOT\Scripts\phantomjs
.
The app.properties
file has this config:
# location of the phantomjs executable, could be for example /usr/local/bin/phantomjs
exec = C:/jetty-distribution-9.0.0.M3/webapps/ROOT/Scripts/phantomjs/phantomjs.exe
# location of convert script used by phantomjs, optional to leave the script property empty, than it's using the script located in: /WEB-INF/phantomjs/highcharts-convert.js. This is tested in TOMCAT, but specify a path if resource loading isn't working with the classloader (f.e. with Jetty server), script = a/path/to/my/phantomjs-script.js
script = C:/jetty-distribution-9.0.0.M3/webapps/ROOT/Scripts/phantomjs/highcharts-convert.js
I can now export via the demo loaded here http://localhost:8080/highcharts-export/demo
and also call to it via our web site by using url: 'http://localhost:8080/highcharts-export/'
EDIT: Has anyone got a working app.properties file for working under Windows and Jetty?
I have resolved some of these issues listed below by making this modification to app.properties:
# location of the phantomjs executable, could be for example /usr/local/bin/phantomjs
exec = "C:\\jetty-distribution-9.0.0.M3\\webapps\\ROOT\\Scripts\\phantomjs\\phantomjs.exe"
# location of convert script used by phantomjs, optional to leave the script property empty, than it's using the script located in: /WEB-INF/phantomjs/highcharts-convert.js. This is tested in TOMCAT, but specify a path if resource loading isn't working with the classloader (f.e. with Jetty server), script = a/path/to/my/phantomjs-script.js
script = /WEB-INF/phantomjs/highcharts-convert.js
Other variants of the exec
value with the same results:
C:\\jetty-distribution-9.0.0.M3\\webapps\\ROOT\\Scripts\\phantomjs\\phantomjs.exe
C:/jetty-distribution-9.0.0.M3/webapps/ROOT/Scripts/phantomjs/phantomjs.exe
C:\jetty-distribution-9.0.0.M3\webapps\ROOT\Scripts\phantomjs\phantomjs.exe
I can now get the demo up at http://localhost:8080/highcharts-export/demo
butlooking at the output of jetty I am flooded with things like:
[ERROR] [pool-1-thread-1 02:55:19] (TaskUtils.java:handleError:95) Unexpected error occurred in sche
duled task.
java.lang.RuntimeException: Error, PhantomJS couldnot start
at com.highcharts.export.server.Server.<init>(Server.java:56)
at com.highcharts.export.pool.ServerObjectFactory.create(ServerObjectFactory.java:36)
at com.highcharts.export.pool.ServerObjectFactory.create(ServerObjectFactory.java:14)
at com.highcharts.export.pool.AbstractPool.createObject(AbstractPool.java:26)
at com.highcharts.export.pool.AbstractPool.poolCleaner(AbstractPool.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnabl
e.java:64)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErro
rHandlingRunnable.java:53)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown S
ource)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Original question below: This is a follow up to this question. I can now successfully (according to maven at least) build the latest highcharts-export server. I have only modified the app.properties file like this:
# location of the phantomjs executable, could be for example /usr/local/bin/phantomjs
exec = C:/jetty-distribution-9.0.0.M3/webapps/ROOT/Scripts/phantomjs
Regardless of the configuration to the location of the phatomjs I get the error listed below.
However, when I load it into jetty I get the following error and am unable to work around this.
C:\hc-exporter>mvn jetty:run
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.highcharts.expor
t:highcharts-export:war:2.0.1
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-eclipse-plugin is missin
g. @ line 150, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your
build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed pro
jects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building highcharts-export 2.0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> jetty-maven-plugin:8.1.2.v20120308:run (default-cli) @ highcharts-export >>>
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ highcharts-export ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ highcharts-export ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ highcharts-export ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\hc-exporter\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ highcharts-export ---
[INFO] No sources to compile
[INFO]
[INFO] <<< jetty-maven-plugin:8.1.2.v20120308:run (default-cli) @ highcharts-export <<<
[INFO]
[INFO] --- jetty-maven-plugin:8.1.2.v20120308:run (default-cli) @ highcharts-export ---
[INFO] Configuring Jetty for project: highcharts-export
[INFO] webAppSourceDirectory C:\hc-exporter\src\main\webapp does not exist. Defaulting to C:\hc-expo
rter\src\main\webapp
[INFO] Reload Mechanic: manual
[INFO] Classes = C:\hc-exporter\target\classes
[INFO] Added extra scan target:C:\hc-exporter\src\main\webapp\WEB-INF\pages
[INFO] Added extra scan target:C:\hc-exporter\src\main\webapp\resources
[INFO] Context path = /export
[INFO] Tmp directory = C:\hc-exporter\target\tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides = none
[INFO] web.xml file = file:/C:/hc-exporter/src/main/webapp/WEB-INF/web.xml
[INFO] Webapp directory = C:\hc-exporter\src\main\webapp
2013-05-21 09:00:07.656:INFO:oejs.Server:jetty-8.1.2.v20120308
2013-05-21 09:00:07.987:INFO:oejpw.PlusConfiguration:No Transaction manager found - if your webapp r
equires one, please configure one.
2013-05-21 09:00:09.162:INFO:/export:No Spring WebApplicationInitializer types detected on classpath
2013-05-21 09:00:09.477:INFO:oejsh.ContextHandler:started o.m.j.p.JettyWebAppContext{/export,file:/C
:/hc-exporter/src/main/webapp/},file:/C:/hc-exporter/src/main/webapp/
2013-05-21 09:00:09.478:INFO:oejsh.ContextHandler:started o.m.j.p.JettyWebAppContext{/export,file:/C
:/hc-exporter/src/main/webapp/},file:/C:/hc-exporter/src/main/webapp/
2013-05-21 09:00:09.482:INFO:oejsh.ContextHandler:started o.m.j.p.JettyWebAppContext{/export,file:/C
:/hc-exporter/src/main/webapp/},file:/C:/hc-exporter/src/main/webapp/
2013-05-21 09:00:09.532:INFO:/export:Initializing Spring root WebApplicationContext
[ERROR] [main 09:00:10] (ContextLoader.java:initWebApplicationContext:307) Context initialization fa
iled
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serverObject
Factory': Invocation of init method failed; nested exception is java.lang.NullPointerException
at...