3 Replies Latest reply on Jun 11, 2014 9:09 AM by swiderski.maciej

    kie-web internal maven2 access gives Unauthorized 401 error when KieContainer used to retieve artifacts

    singhalamitkr

      Hi,

       

      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>

        • 1. Re: kie-web internal maven2 access gives Unauthorized 401 error when KieContainer used to retieve artifacts
          swiderski.maciej

          configure server in settings.xml according to this example, you need to issue preemptive authentication to successfully connect to maven repo on kie-wb

           

          HTH

          • 2. Re: Re: kie-web internal maven2 access gives Unauthorized 401 error when KieContainer used to retieve artifacts
            singhalamitkr

            Hi,

             

            I have added the configuration part in settings.xml file as listed below.

             

            <server>

                  <id>remote</id>

              <configuration>

                    <httpConfiguration>

                      <all>

                        <params>

                          <param>

                            <name>http.authentication.preemptive</name>

                            <value>%b,true</value>

                          </param>

                        </params>

                      </all>

                    </httpConfiguration>

                  </configuration>

                  <username>admin</username>

                  <password>admin</password>

                </server>

             

            But, still I am getting Unauthorized error http respose as listed below

             

            Request DefaultHttpRequest(chunked: false)

            GET /kie-wb-distribution-wars-6.0.1.Final-tomcat7/maven2/com/emeter/provisioning/1.0/provisioning-1.0.jar HTTP/1.1

            Host: ind-lnxapp77.emeter.com:8081

            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=0C4526C4EBE99949316441D3FBDB2E4B; Path=/kie-wb-distribution-wars-6.0.1.Final-tomcat7/; HttpOnly

            Content-Type: text/html;charset=utf-8

            Content-Length: 985

            Date: Wed, 11 Jun 2014 06:15:00 GMT

            • 3. Re: Re: Re: kie-web internal maven2 access gives Unauthorized 401 error when KieContainer used to retieve artifacts
              swiderski.maciej

              ok, then it might have been fixed after 6.0.x release as I tried it like day or two ago and that worked so in worse case scenario it will be out soon with 6.1. In mean time you could try one of the beta releases or cry available in nexus.

               

              alternatively try another configuration to enable preemptive authentication:

              <servers>
                <server>
                <id>guvnor-m2-repo</id>
                <username>user</username>
                <password>password</password>
                <configuration>
                <wagonProvider>httpclient</wagonProvider>
                <httpConfiguration>
                <all>
                <usePreemptive>true</usePreemptive>
                </all>
                </httpConfiguration>
                </configuration>
                </server>
               </servers>
              

              HTH