简体   繁体   English

Vertx.io从Java服务器启动JS Verticle

[英]Vertx.io start JS Verticle from Java server

Working with vertx.io 3.0.0 and Java 1.8.0_60 使用vertx.io 3.0.0和Java 1.8.0_60

I'm trying to start a javascript verticle from JAVA. 我正在尝试从JAVA启动javascript verticle。 I found the following documentation here that shows how to do it. 我在这里找到了以下文档,显示了如何进行操作。 But it actually goes not work in my current context. 但是在我当前的背景下,它实际上不起作用。

//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")

In this context the java vertical (first three) are started correctly, when the JS verticle is call I have the following error java.lang.ClassNotFoundException 在这种情况下,java垂直(前三个)已正确启动,当调用JS verticle时,我遇到以下错误java.lang.ClassNotFoundException

  • The path to the file is correct. 文件的路径正确。
  • Tried prefixing the path with js: to call the correct loader without any chances. 尝试在路径前面加上js:来调用正确的加载器,没有任何机会。

Any ideas on how to do that? 关于如何做到这一点的任何想法?

I asked the question on the google group for Vertx.io . 我在Google网上论坛上询问了Vertx.io的问题 Here is the answer that fixed by issue. 这是由问题确定的答案。

If you use Maven: 如果您使用Maven:

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

Gradle: 摇篮:

io.vertx:vertx-lang-js:3.0.0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM