需要在单个应用程序中部署java verticle和scala verticle的输入。
我已经用java和scala编写了verticle,但是运行胖jar时没有部署scala verticle。
我的项目基于gradle,并且在运行内置jar时遇到类未发现异常。
严重:com.stats.restservice.application.ScalaMLVertice java.lang.ClassNotFoundException:com.stats.restservice.application.ScalaMLVertice 在java.net.URLClassLoader.findClass(URLClassLoader.java:382)
你能帮我吗?
项目结构-Scala,基于Java插件的gradle项目,具有 src / main / scala 具有相应文件的src / main / java文件夹。
import com.stats.restverticle.PeriodicCleanerVerticle;
import com.stats.restverticle.RestAPIVerticle;
import com.stats.restverticle.RestVerticleApplicationStarter;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Vertx;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
/**
* Stand Alone java class with main method to run the application from IDE directly
*/
public class RestVerticleStandAlone extends AbstractVerticle {
public static void main(String[] args) {
Vertx vertx = Vertx.vertx();
Logger logger = LoggerFactory.getLogger(RestVerticleApplicationStarter.class);
RestAPIVerticle restVerticle = new RestAPIVerticle();
logger.info("deploying RestAPIVerticle - Event loop initiating...");
PeriodicCleanerVerticle cleanerVerticle = new PeriodicCleanerVerticle();
logger.info("deploying PeriodicCleanerVerticle - Periodic Event loop initiating...");
vertx.deployVerticle(restVerticle);
vertx.deployVerticle(cleanerVerticle);
//Deploying scala verticle with simple hello world vertx.deployVerticle("scala:com.stats.restservice.application.ScalaMLVertice");
logger.info("Successfully deployed all verticles at localhost:8080");
}
}
我希望所有顶点都能成功部署,但无法部署所有顶点。
任何帮助将不胜感激。谢谢