Re: [rules-users] KIE Internal M2 Repository Access Denied
KieScanner behaves the same with SNAPSHOT versions. Maybe I'm doing something wrong -- View this message in context: http://drools.46999.n3.nabble.com/KIE-Internal-M2-Repository-Access-Denied-tp4027058p4027074.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] KIE Internal M2 Repository Access Denied
You can work around this now by having a wrapper project. All to does is have a single maven dependency on the target project, and in that you specify your maven version ranges. Mark On 3 Dec 2013, at 14:30, Mario Fusco wrote: > Hi, > > the problem with the last code you pasted is that you're passing to the > KieContainer a ReleaseId with a fixed non-snapshot version. Version 1.0.0 > can be installed only once in a maven repository so the KieScanner assumes > there's no need to do a further scan. To overcome this problem you should > use a SNAPSHOT version like in: > >KieContainer kContainer = > ks.newKieContainer(ks.newReleaseId( >"com.masterit.labs", "my-rules", > "1.0.0-SNAPSHOT")); > > I also made it possible to pass range versions to the KieContainer like in: > >KieContainer kContainer = > ks.newKieContainer(ks.newReleaseId( >"com.masterit.labs", "my-rules", > "[1.0.0,)")); > > but unfortunately I didn't developed this improvement fast enough to have it > included in the final release. It will be part of the next minor release, > but of course in order to use this you will have to increase the version > number of your project before to deploy the new kjar. > > I hope this helps, > Mario > > > > > > -- > View this message in context: > http://drools.46999.n3.nabble.com/KIE-Internal-M2-Repository-Access-Denied-tp4027058p4027068.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] KIE Internal M2 Repository Access Denied
Hi, the problem with the last code you pasted is that you're passing to the KieContainer a ReleaseId with a fixed non-snapshot version. Version 1.0.0 can be installed only once in a maven repository so the KieScanner assumes there's no need to do a further scan. To overcome this problem you should use a SNAPSHOT version like in: KieContainer kContainer = ks.newKieContainer(ks.newReleaseId( "com.masterit.labs", "my-rules", "1.0.0-SNAPSHOT")); I also made it possible to pass range versions to the KieContainer like in: KieContainer kContainer = ks.newKieContainer(ks.newReleaseId( "com.masterit.labs", "my-rules", "[1.0.0,)")); but unfortunately I didn't developed this improvement fast enough to have it included in the final release. It will be part of the next minor release, but of course in order to use this you will have to increase the version number of your project before to deploy the new kjar. I hope this helps, Mario -- View this message in context: http://drools.46999.n3.nabble.com/KIE-Internal-M2-Repository-Access-Denied-tp4027058p4027068.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] KIE Internal M2 Repository Access Denied
Thank you. It works now with the security exclusion applied. Let's move on. The documentation says that KieScanner can scan local and remote repositories. However I can't get it works. Consider this simple program that tries to dynamically load rules jar that is not referenced in the project's pom: import java.util.Scanner; import org.kie.api.KieServices; import org.kie.api.builder.KieScanner; import org.kie.api.runtime.KieContainer; import org.kie.api.runtime.StatelessKieSession; import com.interworks.labs.domain.Employee; public class TestMyModel { public static void main(String[] args) throws Throwable { KieServices ks = KieServices.Factory.get(); KieContainer kContainer = ks.newKieContainer(ks.newReleaseId( "com.masterit.labs", "my-rules", "1.0.0")); KieScanner kScanner = ks.newKieScanner(kContainer); kScanner.start(1L); Scanner scanner = new Scanner(System.in); while (true) { runRule(kContainer); System.out .println("Press enter in order to run the test again"); scanner.nextLine(); } } private static void runRule(KieContainer kieKontainer) { StatelessKieSession kSession = kieKontainer .newStatelessKieSession("my-session"); Employee employee = new Employee("John", "Smith", 30); kSession.setGlobal("out", System.out); kSession.execute(employee); } } I'm running the program with this command line: mvn -gs ./settings.xml exec:java -Dexec.mainClass="TestMyModel" -Dkie.maven.settings.custom=D:/Projects/Java/Drools/my-mod el-test/settings.xml Everything is ok when the program starts, the rules artifact is loaded from the KIE WB and successfully executed. However if I change the rules in the Guvnor, build and deploy the change is not visible. I must stop the program, delete the my-rules artifact and restart the program after that. Any idea? -- View this message in context: http://drools.46999.n3.nabble.com/KIE-Internal-M2-Repository-Access-Denied-tp4027058p4027067.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] KIE Internal M2 Repository Access Denied
Hi, I've looked into what you report; and it does indeed appear we have a small issue ;) For now you can amend the /WEB-INF/classes/url_filter.yaml file in the WAR to remove the Maven Repository from authentication (see the exclusion below):- filter: - pattern: /rest/** exclude: - /*.ico - /org.drools.workbench.DroolsWorkbench/images/** - /org.drools.workbench.DroolsWorkbench/css/** - /css/** - /images/** * - /maven2/*** With kind regards, Mike On 3 December 2013 08:22, marjan.sterjev wrote: > I have installed drools-wb-6.0.0.Final-tomcat7.0 on Tomcat 7.0 with all > default settings. The OS platform is windows 7. > > I’m trying to access the internal KIE M2-Repository in order to dynamically > load (re-load with KieScanner) Kie Modules. The repository is defined in > the > POM the following way: > > > kie-wb > > http://kie-server:8080/drools-wb-6.0.0.Final-tomcat7.0/maven2/ > > > The maven build fails with Unauthorized error: > > Could not transfer artifact com.masterit.labs:my-model:pom:0.0.1-SNAPSHOT > from/to kie-wb > (http://kie-server:8080/drools-wb-6.0.0.Final-tomcat7.0/maven2): Not > authorized , ReasonPhrase:Unauthorized. -> [Help 1] > > If I access the maven2 repository directly in the browser the error is: > > java.io.FileNotFoundException: repositories\kie (Access is denied) > java.io.RandomAccessFile.open(Native Method) > java.io.RandomAccessFile.(RandomAccessFile.java:216) > > > org.guvnor.m2repo.backend.server.FileDownloadServlet.serveResource(FileDownloadServlet.java:166) > > > org.guvnor.m2repo.backend.server.FileDownloadServlet.doGet(FileDownloadServlet.java:65) > javax.servlet.http.HttpServlet.service(HttpServlet.java:621) > javax.servlet.http.HttpServlet.service(HttpServlet.java:728) > > > org.uberfire.security.server.UberFireSecurityFilter.doFilter(UberFireSecurityFilter.java:266) > > However, manually I can always type the path to some M2 resource in the > browser and get the result. For example the URL below returns the required > artifact: > > > http://kie-server:8080/drools-wb-6.0.0.Final-tomcat7.0/maven2/com/interworks/labs/my-model/0.0.1-SNAPSHOT/maven-metadata.xml > > > > > > > > > -- > View this message in context: > http://drools.46999.n3.nabble.com/KIE-Internal-M2-Repository-Access-Denied-tp4027058.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] KIE Internal M2 Repository Access Denied
I have installed drools-wb-6.0.0.Final-tomcat7.0 on Tomcat 7.0 with all default settings. The OS platform is windows 7. I’m trying to access the internal KIE M2-Repository in order to dynamically load (re-load with KieScanner) Kie Modules. The repository is defined in the POM the following way: kie-wb http://kie-server:8080/drools-wb-6.0.0.Final-tomcat7.0/maven2/ The maven build fails with Unauthorized error: Could not transfer artifact com.masterit.labs:my-model:pom:0.0.1-SNAPSHOT from/to kie-wb (http://kie-server:8080/drools-wb-6.0.0.Final-tomcat7.0/maven2): Not authorized , ReasonPhrase:Unauthorized. -> [Help 1] If I access the maven2 repository directly in the browser the error is: java.io.FileNotFoundException: repositories\kie (Access is denied) java.io.RandomAccessFile.open(Native Method) java.io.RandomAccessFile.(RandomAccessFile.java:216) org.guvnor.m2repo.backend.server.FileDownloadServlet.serveResource(FileDownloadServlet.java:166) org.guvnor.m2repo.backend.server.FileDownloadServlet.doGet(FileDownloadServlet.java:65) javax.servlet.http.HttpServlet.service(HttpServlet.java:621) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.uberfire.security.server.UberFireSecurityFilter.doFilter(UberFireSecurityFilter.java:266) However, manually I can always type the path to some M2 resource in the browser and get the result. For example the URL below returns the required artifact: http://kie-server:8080/drools-wb-6.0.0.Final-tomcat7.0/maven2/com/interworks/labs/my-model/0.0.1-SNAPSHOT/maven-metadata.xml -- View this message in context: http://drools.46999.n3.nabble.com/KIE-Internal-M2-Repository-Access-Denied-tp4027058.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users