在Windows 7上设置Highcharts和PhantomJS .JSON字符串解析错误

时间:2014-09-28 22:55:50

标签: highcharts phantomjs

我是Highcharts的新手。我正在尝试根据http://www.highcharts.com/docs/export-module/setting-up-the-server设置本地highcharts导出服务器。我似乎无法让它发挥作用。

我正在使用Java版本。

这是我做的:

  1. 我从Github下载了PhantomJS和Highcharts导出服务器。我将它们提取到两个文件夹中,如下所示:

    d:\工具\ highcharts.com主

    d:\工具\ phantomjs-1.9.7窗口

  2. 我在Windows PATH中放了D:\ Tools \ phantomjs-1.9.7-windows

  3. 在DOS shell中,我选择了

    d:\工具\ highcharts.com主\出口服务器\ phantomjs

  4. 作为工作目录,因为highcharts-convert.js在此目录中

    1. 我运行了这个命令

      phantomjs highcharts-convert.js -host 127.0.0.1 -port 7777

    2. 我收到了以下回复:

      OK, PhantomJS is ready.
      
      1. 我跑了
      2. mvn install

        in

        d:\工具\ highcharts.com主\出口服务器\的java \ highcharts出口

        mvn clean package

        in

        d:\工具\ highcharts.com主\出口服务器\的java \ highcharts出口\ highcharts出口幅

        我在这两方面都取得了成功。

        1. 打开另一个DOS提示符,然后切换到

          d:\工具\ highcharts.com主\出口服务器\的java \ highcharts出口\ highcharts出口幅

        2. 然后运行

          mvn jetty:run
          

          并启动Web服务器。请注意,我有

          host = 127.0.0.1
          port = 7777
          exec = phantomjs.exe
          

          下的app-convert.properties文件中

          d:\工具\ highcharts.com主\出口服务器\的java \ highcharts出口\ highcharts出口的web \ SRC \主\ web应用\ WEB-INF \弹簧

          1. 现在在我的图表中,我有以下内容:

                exporting: {
                    enabled: true,
                    url:'http://127.0.0.1:8080/export'
                }
            
          2. 但是,当我选择JPEG等下载选项之一时,我收到以下错误:

            Failed rendering: 
            SyntaxError: Unable to parse JSON string
            

            我被困在这里。我找了相关的帖子,但没找到。

            提前感谢任何输入!

            ---------------更新----------

            根据Pawel的建议将所有端口更改为8080并停止手动启动phantomjs后,我的成功有限。大多数时候我收到相同的错误消息。偶尔,我在服务器启动过程中只获得了一两次成功(这意味着我点击了下拉菜单,并在Web服务器(jetty)启动时选择了一个下载选项)。以下是我在服务器启动期间和之后的情况(根据HC文档启用了调试)。任何人都可以看错吗?

            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 SelectChannelConnector@0.0.0.0: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
            

1 个答案:

答案 0 :(得分:0)

我终于开始工作了。这是如何:

通过使用highcharts下载在Eclipse中重建高级图项目(2个项目)。在此之后,在Jetty中运行highcharts-export-web或运行命令行:

mvn jetty:运行

d:\工具\ highcharts.com主\出口服务器\的java \ highcharts出口\ highcharts出口幅

希望这有帮助。