当前位置: 首页 > 面试题库 >

Windows下Highcharts-Export Server 2.0.1错误

柯骏
2023-03-14
问题内容

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

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 = 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/'

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

通过对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

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但看着码头的输出,我到处都是:

        [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)

以下原始问题:
这是此问题的后续措施。现在,我可以成功(至少根据maven的要求)构建最新的highcharts-
export服务器。我只修改了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

无论phatomjs的位置如何配置,我都会收到以下错误。

但是,当我将其加载到码头时,出现以下错误,并且无法解决此问题。

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

问题答案:

您正在获取Beancreation异常,因为@PostConstruct afterBeanInit方法失败。

当您将app.properties文件中的’script’属性保留为空时,它将尝试使用ClassLoader加载highcharts-
convert文件。看这里。

如app.properties文件中所述,这仅在Tomcat中进行了测试。显然,这对于Jetty来说不是开箱即用的。也许是因为ClassLoader是不同的,还是您不得不将应用程序html" target="_blank">部署成爆炸式战争?

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

属性文件的代码样本,我在Windows下使用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

更改app.properties文件后,我将与 mvn clean package

并将war文件复制到Jetty webapps文件夹。而且有效。



 类似资料:
  • 编辑:解决方案是将所有与phatomJS相关的脚本放在scripts目录中,并确保没有任何项对于Windows是只读的。我的脚本和幻影。exe都存在于此处:。 文件具有以下配置: 我现在可以通过此处加载的演示 导出,也可以使用url通过我们的网站调用它 编辑:有人有一个工作应用程序吗。用于在Windows和Jetty下工作的属性文件? 我已通过对 app.properties 进行此修改解决了下面

  • 问题内容: 我一直在我的angularjs项目中使用highcharts- ng。一切都做得不错,但是现在我需要使用一些钻取来详细说明我的信息,并且无法使用drilldown.js正常工作。我遵循了在highcharts的向下钻取小提琴上给出的示例,但似乎与angular- ng无关。如您在我的向下钻探复制中所见,原始的Highchart示例不适用于angular- ng 。有什么问题的想法吗?

  • 问题内容: 以下代码 在Windows下的Java控制台上,在“开始”和“结束”之间产生一个空行,但是在运行MacOS或Linux时可以正常工作。写入文件而不是使用sysout时同样如此。我试过多台Windows机器。我是通过eclipse还是通过cmd执行该方法都没有关系。 当您将“ 1234”更改为“ 1234”或“ 12g4”时,或者运行次数大于/小于936时,它将在所有OS上正常工作。 任

  • Highcharts 饼图 以下实例演示了向下钻取饼图。 我们在前面的章节已经了解了 Highcharts 基本配置语法。接下来让我们来看下其他的配置。 配置 drilldown 配置 drilldown 用于向下钻取数据,通过点击某项深入到其中的具体数据。 drilldown: { series: drilldownSeries } 实例 文件名:highcharts_pie_dril

  • Highcharts 是一个制作图表的纯 Javascript 类库,主要特性如下: 兼容性:兼容当今所有的浏览器,包括 iPhone、IE 和火狐等等; 对个人用户完全免费; 纯 JS,无 BS; 支持大部分的图表类型:直线图,曲线图、区域图、区域曲线图、柱状图、饼状图、散布图; 跨语言:不管是 PHP、Asp.net 还是 Java 都可以使用,它只需要三个文件:一个是 Highcharts

  • 本文向大家介绍Windows下MySql错误代码1045的解决方法,包括了Windows下MySql错误代码1045的解决方法的使用技巧和注意事项,需要的朋友参考一下 解决办法是重新设置root用户密码,在Windows平台下操作步骤如下: 1、以系统管理员身份登录到系统; 2、如果MySQL服务器正在运行,停止它。       如果是作为Windows服务运行的服务器,进入服务管理器:开始菜单-