我想在简单的客户端java web项目中从远程存储库加载kjar运行时。
为此,我按照以下步骤 -
1.我们下载了kie-drools-wb-distribution-wars-6.3.0.Final-wildfly8.war(在野生蝇上以kie-drools-6.3.0的形式部署为jboss)。我创建了项目'Test1'&成功建立&部署。
2.在“Artifact Repository”中,我可以看到我的项目jar“Test1-LATEST.jar”&即使我可以像下载一样下载
http://localhost:8081/kie-drools-6.3.0/maven2/com/eno/Test1/LATEST/Test1-LATEST.jar
3.现在我尝试从客户端简单的java项目加载jar,但它失败了以下异常
11:12:33,961 INFO [org.drools.compiler.kie.builder.impl.KieRepositoryImpl] (default task-95) KieModule was added: MemoryKieModule[releaseId=com.eno:Test1:LATEST]
11:12:33,961 INFO [stdout] (default task-95) KieModule ReleaseId:com.eno:Test1:LATEST
11:12:33,962 WARN [org.kie.scanner.MavenRepository] (default task-95) Unable to resolve artifact: com.eno:Test1:LATEST
11:12:33,963 WARN [org.kie.scanner.MavenRepository] (default task-95) Unable to resolve artifact: com.eno:Test1:pom:LATEST
11:12:33,963 ERROR [stderr] (default task-95) java.lang.RuntimeException: Cannot find KieModule: com.eno:Test1:LATEST
11:12:33,963 ERROR [stderr] (default task-95) at org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:117)
11:12:33,963 ERROR [stderr] (default task-95) at org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:111)
11:12:33,963 ERROR [stderr] (default task-95) at com.eno.testweb.TestDrool6.doPost(TestDrool6.java:59)
11:12:33,963 ERROR [stderr] (default task-95) at com.eno.testweb.TestDrool6.doGet(TestDrool6.java:38)
11:12:33,963 ERROR [stderr] (default task-95) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
11:12:33,964 ERROR [stderr] (default task-95) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
11:12:33,964 ERROR [stderr] (default task-95) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
11:12:33,964 ERROR [stderr] (default task-95) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61)
11:12:33,964 ERROR [stderr] (default task-95) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
11:12:33,964 ERROR [stderr] (default task-95) at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
11:12:33,964 ERROR [stderr] (default task-95) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
11:12:33,964 ERROR [stderr] (default task-95) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
11:12:33,964 ERROR [stderr] (default task-95) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56)
11:12:33,964 ERROR [stderr] (default task-95) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
11:12:33,964 ERROR [stderr] (default task-95) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45)
11:12:33,964 ERROR [stderr] (default task-95) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:63)
11:12:33,964 ERROR [stderr] (default task-95) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
11:12:33,965 ERROR [stderr] (default task-95) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70)
11:12:33,965 ERROR [stderr] (default task-95) at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
11:12:33,965 ERROR [stderr] (default task-95) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
11:12:33,965 ERROR [stderr] (default task-95) at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
11:12:33,965 ERROR [stderr] (default task-95) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
11:12:33,965 ERROR [stderr] (default task-95) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
11:12:33,965 ERROR [stderr] (default task-95) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:261)
11:12:33,965 ERROR [stderr] (default task-95) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:247)
11:12:33,965 ERROR [stderr] (default task-95) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:76)
11:12:33,965 ERROR [stderr] (default task-95) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:166)
11:12:33,965 ERROR [stderr] (default task-95) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197)
11:12:33,965 ERROR [stderr] (default task-95) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:759)
11:12:33,965 ERROR [stderr] (default task-95) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
11:12:33,966 ERROR [stderr] (default task-95) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
11:12:33,966 ERROR [stderr] (default task-95) at java.lang.Thread.run(Thread.java:745)
我使用下面的代码。还包括项目中的所有6.3.0.Final分配罐:
String url = "http://localhost:8081/kie-drools-6.3.0/maven2/com/eno/Test1/LATEST/Test1-LATEST.jar";
KieServices ks = KieServices.Factory.get();
KieRepository kr = ks.getRepository();
System.out.println(kr.getDefaultReleaseId());
UrlResource urlResource = (UrlResource) ks.getResources().newUrlResource(url);
urlResource.setUsername("app-admin");
urlResource.setPassword("app-password");
urlResource.setBasicAuthentication("enabled");
InputStream is = urlResource.getInputStream();
KieModule kModule = kr.addKieModule(ks.getResources().newInputStreamResource(is));
System.out.println(kModule.getReleaseId());
KieContainer kContainer = ks.newKieContainer(kModule.getReleaseId()); //Failed at this line
Test1-LATEST.jar中的pom.xml文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.eno</groupId>
<artifactId>Test1</artifactId>
<version>LATEST</version>
<name>Test1</name>
<dependencies>
<dependency>
<groupId>com.eno</groupId>
<artifactId>pojo</artifactId>
<version>26.9.15</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.kie</groupId>
<artifactId>kie-maven-plugin</artifactId>
<version>6.3.0.Final</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
setting.xml:添加了系统属性kie.maven.settings.custom = / home / krunal / devtool / drool6 / settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<server>
<id>uf-playground</id>
<username>app-admin</username>
<password>app-password</password>
<configuration>
<wagonProvider>httpclient</wagonProvider>
<httpConfiguration>
<all>
<usePreemptive>true</usePreemptive>
</all>
</httpConfiguration>
</configuration>
</server>
<profiles>
<profile>
<id>profile-1</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>uf-playground</id>
<name>Drools workbench</name>
<url>http://localhost:8081/kie-drools-6.3/maven2</url>
</repository>
</repositories>
</profile>
</profiles>
</settings>
请帮我解决这个问题。
在此先感谢:)