kie-web internal maven2 access gives Unauthorized 401 error when KieContainer used to retieve artifacts
singhalamitkr Jun 9, 2014 3:55 AMHi,
I am using KieContainer to get the deployed modules from the kie-web console installed on by local machine. Below listed is the code used:
KieServices kieServices = KieServices.Factory.get();
ReleaseId releaseId = kieServices.newReleaseId( "org.jbpm", "Evaluation", "1.0" );
KieContainer kContainer = kieServices.newKieContainer( releaseId );
KieScanner kScanner = kieServices.newKieScanner( kContainer );
// Start the KieScanner polling the Maven repository every 10 seconds
kScanner.start( 10000L );
KieBase kieBase = kContainer.getKieBase();
System.out.println(kieBase.getKiePackages().size());
But, it gives the HTTP/1.1 401 Unauthorized access error while accessing the kie-web internal maven repository. Below listed are the logs:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2014-06-09 11:43:02,761 INFO com.ning.http.client.providers.netty.NettyAsyncHttpProvider - Number of application's worked threads is 8
2014-06-09 11:43:02,768 DEBUG com.ning.http.client.providers.netty.NettyAsyncHttpProvider -
Non cached request
DefaultHttpRequest(chunked: false)
GET /kie-wb-distribution-wars-6.0.1.Final-tomcat7/maven2/org/jbpm/Evaluation/1.0/Evaluation-1.0.jar HTTP/1.1
Host: localhost:9000
Pragma: no-cache
Cache-Control: no-cache, no-store
Accept-Encoding: gzip
Connection: keep-alive
Accept: */*
User-Agent: Aether
using Channel
[id: 0x01516197]
2014-06-09 11:43:02,803 DEBUG com.ning.http.client.providers.netty.NettyAsyncHttpProvider -
Request DefaultHttpRequest(chunked: false)
GET /kie-wb-distribution-wars-6.0.1.Final-tomcat7/maven2/org/jbpm/Evaluation/1.0/Evaluation-1.0.jar HTTP/1.1
Host: localhost:9000
Pragma: no-cache
Cache-Control: no-cache, no-store
Accept-Encoding: gzip
Connection: keep-alive
Accept: */*
User-Agent: Aether
Response DefaultHttpResponse(chunked: false)
HTTP/1.1 401 Unauthorized
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=957E95D531F15F39A8492947FC410CC4; Path=/kie-wb-distribution-wars-6.0.1.Final-tomcat7
Content-Type: text/html;charset=utf-8
Content-Length: 1005
Date: Mon, 09 Jun 2014 06:13:02 GMTk
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This is my setting.xml file for maven repository
<servers>
<server>
<id>remote</id>
<username>admin</username>
<password>admin</password>
</server>
<server>
<id>guvnor-m2-repo</id>
<username>admin</username>
<password>admin</password>
</server>
</servers>
<profile>
<id>remote-repository</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>remote</id>
<name>JBoss Public Maven Repository Group</name>
<url>http://localhost:9000/kie-wb-distribution-wars-6.0.1.Final-tomcat7/maven2/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>