Windows下的Highcharts-Export Server 2.0.1错误 [英] Highcharts-Export Server 2.0.1 Errors Under Windows

查看:259
本文介绍了Windows下的Highcharts-Export Server 2.0.1错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑:解决方案是将所有与phatomJS相关的脚本放入脚本目录中,并确保所有项目对于Windows都是只读的。
我的脚本和phantomjs.exe都存在于这里: C:\jetty-distribution-9.0.0.M3\webapps\ROOT\Scripts\phantomjs $ b

app.properties 文件具有以下配置:

 #phantomjs可执行文件的位置,例如可能是/ usr / local / bin / phantomjs 
exec = C:/jetty-distribution-9.0.0。 M3 / webapps / ROOT / Scripts / phantomjs / phantomjs.exe
#phantomjs使用的转换脚本的位置,可选用于将脚本属性保留为空,而不是使用位于以下位置的脚本:/ WEB-INF / phantomjs / highcharts -convert.js。这在TOMCAT中进行了测试,但是如果资源加载不与类加载器一起工作(使用Jetty服务器),则指定一个路径,script = a / path / to / my / phantomjs-script.js
script = C: /jetty-distribution-9.0.0.M3/webapps/ROOT/Scripts/phantomjs/highcharts-convert.js

现在我可以通过这里加载的演示 http:// localhost:8080 / highcharts-export / demo 导出,也可以通过我们的网站使用 url:'http:// localhost:8080 / highcharts-export /'

编辑: em>
有没有人可以在Windows和Jetty下工作的app.properties文件?

我已经解决了其中一些问题通过对app.properties进行此修改,可能会出现以下问题:

 #phantomjs可执行文件的位置,例如/ usr / local / bin / phantomjs 
exec =C:\\jetty-distribution-9.0.0.M3\\webapps\\ROOT\\Scripts\\ph antomjs\\\\\\\\'\\\\\\\\\\\\'''

$ phantomjs使用的转换脚本的位置,可选用于保留脚本属性为空,而不是使用位于以下位置的脚本:/ WEB-INF / phantomjs / highcharts -convert.js。这在TOMCAT中进行了测试,但是如果资源加载不与类加载器一起工作(使用Jetty服务器),则指定一个路径,script = a / path / to / my / phantomjs-script.js
script = / WEB -INF / phantomjs / highcharts-convert.js



exec 值的结果相同:

  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

现在我可以在 http:// localhost:8080 / highcharts-export / demo 但在jetty的输出中,我充斥着诸如此类的东西:

  [错误] [pool-1-thread -1 02:55:19](TaskUtils.java:handleError:95)意外的错误发生编辑在sche 
失明的任务。
java.lang.RuntimeException:Error,PhantomJS can not 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.De legatingErrorHandlingRunnable.run(DelegatingErro
rHandlingRunnable.java:53)$ java.util.concurrent.Executors中的
$ RunnableAdapter.call(未知源)$ b $ java.util.concurrent.FutureTask $同步。 $ java.util.concurrent.FutureTask.runAndReset
(未知源)$ java.util.concurrent.ScheduledThreadPoolExecutor
$ ScheduledFutureTask.access $ 301(Unknown S
ource)$在java.util.concurrent.ScheduledThreadPoolExecutor上的b $ b $ ScheduledFutureTask.run(未知源)$ b $在java.util.concurrent.ThreadPoolExecutor.runWorker(未知源)
在java.util.concurrent.ThreadPoolExecutor $ Worker.run(Unknown Source)
在java.lang.Thread.run(Unknown Source)



<下面的原始问题:
这是一个后续这个问题。我现在可以成功(至少根据maven)构建最新的highcharts-export服务器。我只修改了app.properties文件,如下所示:

 #phantomjs可执行文件的位置,例如/ usr / local / bin / phantomjs 
exec = C:/jetty-distribution-9.0.0.M3/webapps/ROOT/Scripts/phantomjs

无论phatomjs的位置如何配置,我都会得到下面列出的错误。



然而,当我将它加载到码头

  C:\ hc-exporter> mvn jetty:run 
[INFO]扫描项目...
[警告]
[警告]构建com.highcharts.expor
t的高效模型时遇到了一些问题:highcharts-export: war:2.0.1
[WARNING]'build.plugins.plugin.version'for org.apache.maven.plugins:maven-eclipse-plugin错过
g。 @ line 150,column 12
[警告]
[警告]强烈建议您修复这些问题,因为它们威胁到
构建的稳定性。
[警告]
[警告]出于这个原因,未来的Maven版本可能不再支持构建这种格式不正确的pro
ject。
[警告]
[信息]
[信息] ----------------------------- -------------------------------------------
[信息] Building highcharts-export 2.0.1
[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]使用'UTF-8'编码来复制过滤的资源。
[INFO]复制2资源
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile(default-compile)@ highcharts-export ---
[INFO] Nothing to compile - 所有类都是最新的
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources(default-testResources)@ highcharts -export ---
[debug]执行contextualize
[INFO]使用'UTF-8'编码来复制过滤的资源。
[INFO]跳过不存在的资源目录C:\ hc-exporter \src\test\resources
[信息]
[信息] --- maven-compiler-plugin: 2.5.1:testCompile(default-testCompile)@ highcharts-export ---
[INFO]没有源编译
[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] Jetty for project:highcharts-export
[INFO] webAppSourceDirectory C:\hc-exporter\src\main\webapp不存在。默认为C:\ hc-expo
rter\src\main\webapp
[信息]重新加载机制:手动
[信息]类= C:\ hc-exporter \target\classes
[INFO]添加额外扫描目标:C:\ hc-exporter \src\main\webapp\WEB-INF\pages
[信息]已添加额外扫描目标:C:\ hc-exporter \ src\main\webapp\resources
[INFO]上下文路径= / export
[INFO] Tmp目录= C:\ hc -exporter\target\tmp
[INFO] Web默认值= org / eclipse / jetty / webapp / webdefault.xml
[信息] Web覆盖=无
[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:信息:oejs.Server:jetty-8.1.2.v20120308
2013-05-21 09:00:07.987:信息:oejpw.PlusConfiguration:没有交易经理发现 - 如果您的Web应用程序r
需要一个,请配置一个。
2013-05-21 09:00:09.162:信息:/ export:没有在类路径中检测到Spring WebApplicationInitializer类型

2013-05-21 09:00:09.477:INFO:oejsh。 ContextHandler:启动omjpJettyWebAppContext {/ 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 omjpJettyWebAppContext {/ 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 omjpJettyWebAppContext {/ 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根WebApplicationContext
[错误] [main 09:00:10](ContextLoader.java:initWebApplicationContext:307)上下文初始化fa

org.springframework.beans.factory.BeanCreationException:Error创建名为'serverObject
Factory'的bean:调用i nit方法失败;嵌套异常是java.lang.NullPointerException
at ...


解决方案 div>

因为@PostConstruct afterBeanInit方法失败,所以你得到了一个Beancreation异常。

当您将app.properties文件中的'script'属性留空时,它会尝试使用ClassLoader加载highcharts-convert文件。 请参阅此处

正如app.properties文件所述,这只在Tomcat中测试过。很明显,这对于Jetty来说并不适用。也许,因为ClassLoader是不同的,或者你必须将应用程序部署为爆炸性战争?



但是,简单的方法是指定'脚本'属性app.properties文件。请注意,highcharts-convert.js脚本使用的必需文件也必须存在于同一个文件夹中。



代码属性文件示例,由我在windows下使用与Jetty。

  #### phantomjs属性#### 

#主机和端口phantomjs监听
host = 127.0.0.1
port = 7777

#phantomjs可执行文件的位置,例如/ usr / local / bin / phantomjs
exec = phantomjs

#phantomjs使用的转换脚本的位置,可选用于将脚本属性留空,而不是使用位于/WEB-INF/phantomjs/highcharts-convert.js中的脚本。这在TOMCAT中进行了测试,但是如果资源加载不与类加载器一起工作(使用Jetty服务器),则指定一个路径,script = a / path / to / my / phantomjs-script.js
script = C: /Users/gert/SRC/highcharts.com/exporting-server/java/highcharts-export/target/highcharts-export/WEB-INF/phantomjs/highcharts-convert.js

在我更改app.properties文件后,我用 mvn clean package



并将war文件复制到Jetty webapps文件夹。它的工作。


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...

解决方案

You're getting a Beancreation exception because the @PostConstruct afterBeanInit method is failing.

When you leave the 'script' property in the app.properties file empty, it tries to load the highcharts-convert file with the ClassLoader. See here.

As stated in the app.properties file, this is only tested in Tomcat. Clearly this isn't working out of the box for Jetty. Perhaps, because the ClassLoader is different, or maybe you have to deploy the application as an exploded war?

But the easy way, is to specify the 'script' property in the app.properties file. Note that the mandatory files used by the highcharts-convert.js script must also be present in the same folder.

Code Sample of the property file, used by me under windows with Jetty.

#### 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 = phantomjs

# 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:/Users/gert/SRC/highcharts.com/exporting-server/java/highcharts-export/target/highcharts-export/WEB-INF/phantomjs/highcharts-convert.js

After I changed the app.properties file, I build the war with mvn clean package

and copied the war file to the Jetty webapps folder. and it worked.

这篇关于Windows下的Highcharts-Export Server 2.0.1错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆