有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

javascript Vertx。io从Java服务器启动JS Verticle

与vertx合作。io 3.0.0和Java 1.8.0_60

我正在尝试从JAVA启动一个javascript垂直页面。我发现了下面的文档here展示了如何做到这一点。但在我目前的环境下,它实际上不起作用

//main class
vertx.deployVerticle("com.mycompany.services.DiscountServices");
vertx.deployVerticle("com.mycompanyservices.SupplierServices");
vertx.deployVerticle("com.mycompany.services.ReportTypeServices");
vertx.deployVerticle("RELATIVE_PATH_TO_FILE/verticle.js");

//verticle.js
// from the example: http://vertx.io/docs/vertx-core/js/#_writing_verticles
declare var vertx;    
var eb = new vertx.EventBus()
eb.consumer("cbweb.validation", (message:any) => {
    console.log(message);
});
console.log("Validation.js ready")

在此上下文中,java垂直(前三个)正确启动,当调用JS垂直时,我有以下错误java.lang.ClassNotFoundException

  • 文件的路径是正确的
  • 尝试在路径前面加上js:来调用正确的加载程序,但没有任何机会

有什么办法吗


共 (1) 个答案

  1. # 1 楼答案

    我问了关于google group for Vertx.io的问题。以下是问题解决的答案

    如果使用Maven:

    <dependency>
        <groupId>io.vertx</groupId>
        <artifactId>vertx-lang-js</artifactId>
        <version>3.0.0</version>
    </dependency>
    

    格雷德尔:

    io.vertx:vertx-lang-js:3.0.0