当前位置: 首页 > 知识库问答 >
问题:

Windows下的Highcharts Export Server 2.0.1错误

阮梓
2023-03-14

编辑:解决方案是将所有与phatomJS相关的脚本放在scripts目录中,并确保没有任何项对于Windows是只读的。我的脚本和幻影。exe都存在于此处:C:\jetty-distribution-9.0.0.M3\webapps\ROOT\Scripts\phantomjs

应用程序。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 进行此修改解决了下面列出的一些问题:

# 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导出服务器。我只修改了应用程序。属性文件如下:

# 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的位置进行何种配置,我都会得到下面列出的错误。

然而,当我将其加载到jetty时,我得到了以下错误,无法解决此问题。

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

共有2个答案

湛鸿雪
2023-03-14

上面的第一个示例表明您正在配置指向jetty 9.0.0.M3(9.0.3.v20130506是最新的),但第二个示例显示您使用的是jetty maven插件8.1.2(8.1.10.v20130312是最新版本),它不使用任何jetty分发版,而是使用一个嵌入的jetty实例,它连接并通过maven plugin启动。

您需要决定如何通过发行版(您的第一个示例)或通过maven插件(org.eclipse.jetty:jetty-maven-plugin: 9.0.3. v20130506可能是您应该使用的)运行jetty,并相应地配置您的'exec='属性。

戚令秋
2023-03-14

您收到一个Beancreate异常,因为BeanInit方法之后的@PostConstruct失败了。

当您将app.properties文件中的“script”属性留空时,它会尝试使用类加载器加载highcharts-convert文件。看这里。

如应用程序中所述。属性文件,这仅在Tomcat中测试。显然,这对Jetty来说并不是开箱即用的。也许,因为ClassLoader不同,或者您必须将应用程序部署为一场爆发式的战争?

但简单的方法是在 app.properties 文件中指定“脚本”属性。请注意,高图表转换.js脚本使用的必需文件也必须存在于同一文件夹中。

我在带有Jetty的windows下使用的属性文件的代码示例。

#### 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 干净软件包构建了战争

并将war文件复制到Jetty webapps文件夹。它起作用了。

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

  • 问题内容: 编辑: 解决方案是将所有与phatomJS相关的脚本放入Scripts目录中,并确保所有项目都不是Windows只读的。我的脚本和phantomjs.exe都在这里存在:。 该文件具有以下配置: 我现在可以通过此处加载的演示导出,也可以通过使用我们的网站来调用它 编辑: 有没有人在Windows和Jetty下获得可工作的app.properties文件? 通过对app.properti

  • SRS不支持直接在windows上运行,但你可以用docker镜像ossrs/srs:dev编译和调试, 以及ossrs/srs:3运行。 srs-librtmp支持Windows,参考https://www.wenjiangs.com/doc/srs-SrsLibrtmp.

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

  • 我是新的在MQTT所以可以有人帮助我连接MQTT与蚊子使用javascript我正在使用这段代码,但它给错误······

  • 我正在尝试使用maven protoc插件和我在Cygwin中构建的protoc可执行文件编译协议缓冲区代码。我无法从Cygwin或Windows命令行执行此操作。下面是我在Windows中运行它时得到的输出,但从Cygwin运行时的错误是相同的。我觉得这很奇怪,因为如果问题是路径转换,那么我希望其中一个可以工作。这个可执行文件是用Cygwin的g构建的,这可能会影响到事情吗?(显而易见,该目录确