为什么我无法访问Kie存储库?

时间:2017-03-21 16:10:00

标签: java drools kie

我是Kie workbench的新手,我想远程访问java中的kie存储库进行测试。但是在运行代码时失败了,这是例外:

Exception in thread "main" java.io.FileNotFoundException: http://localhost:8080/kie-drools-wb/maven2/com.my.test/test-project/1.0/test-project-1.0.jar
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1836)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at org.drools.core.io.impl.UrlResource.grabStream(UrlResource.java:259)
at org.drools.core.io.impl.UrlResource.getInputStream(UrlResource.java:176)
at com.my.test.Test.main(Test.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

我甚至无法从浏览器下载它,任何人都可以帮我解决这个问题吗?这是我的java代码:

String url = "http://localhost:8080/kie-drools-wb/maven2/com.my.test/test-project/1.0/test-project-1.0.jar";

    KieServices kservice = KieServices.Factory.get();
    KieRepository kr = kservice.getRepository();
    UrlResource urlResource = (UrlResource) ks.getResources()
            .newUrlResource(url);
    urlResource.setUsername("admin");
    urlResource.setPassword("p@ssw0rd");
    urlResource.setBasicAuthentication("enabled");
    InputStream is = urlResource.getInputStream();
    KieModule kModule = kr.addKieModule(ks.getResources()
            .newInputStreamResource(is));

    KieContainer kContainer = ks.newKieContainer(kModule.getReleaseId());

0 个答案:

没有答案