Bug 1059584

Summary: Cannot access to remote business-central maven repository
Product: [Retired] JBoss BRMS Platform 6 Reporter: Toshiya Kobayashi <tkobayas>
Component: Business CentralAssignee: manstis
Status: CLOSED NOTABUG QA Contact: Jiri Locker <jlocker>
Severity: medium Docs Contact:
Priority: high    
Version: 6.0.0CC: kverlaen, mfusco, rrajasek, spagop
Target Milestone: ER1   
Target Release: 6.0.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-02-27 19:03:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Toshiya Kobayashi 2014-01-30 08:49:37 UTC
Description of problem:

Reproduced in 6.0.0.Beta and 6.0.0.CR2.

- Start BRMS binding a specific IP (e.g. $ standalone.sh -b 10.10.10.10)
- Run maven in a remote machine with the pom.xml like this

<repository>
  <id>guvnor-m2-repo</id>
  <name>Guvnor M2 Repo</name>
  <url>http://10.10.10.10:8080/business-central/maven2/</url>
</repository>

Also having username/password in ~/.m2/settings.xml

  <servers>
    <server>
      <id>guvnor-m2-repo</id>
      <username>admin</username>
      <password>password1!</password>
    </server>
  </servers>

- 'mvn clean install' fails with the following message

[ERROR] Failed to execute goal on project TestApp: Could not resolve dependencies for project com.sample:TestApp:jar:1.0.0: Failed to collect dependencies at org.kie.example:project1:jar:1.0.0-SNAPSHOT: Failed to read artifact descriptor for org.kie.example:project1:jar:1.0.0-SNAPSHOT: Could not transfer artifact org.kie.example:project1:pom:1.0.0-SNAPSHOT from/to guvnor-m2-repo (http://10.10.10.10:8080/business-central/maven2/): Not authorized , ReasonPhrase:Unauthorized. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project TestApp: Could not resolve dependencies for project com.sample:TestApp:jar:1.0.0: Failed to collect dependencies at org.kie.example:project1:jar:1.0.0-SNAPSHOT
    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:220)
    . . . 
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project com.sample:TestApp:jar:1.0.0: Failed to collect dependencies at org.kie.example:project1:jar:1.0.0-SNAPSHOT
    at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:167)
    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:195)
    ... 22 more
Caused by: org.eclipse.aether.collection.DependencyCollectionException: Failed to collect dependencies at org.kie.example:project1:jar:1.0.0-SNAPSHOT
    at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:292)
    ...
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.kie.example:project1:jar:1.0.0-SNAPSHOT
    ...
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.kie.example:project1:pom:1.0.0-SNAPSHOT from/to guvnor-m2-repo (http://10.10.10.10:8080/business-central/maven2/): Not authorized , ReasonPhrase:Unauthorized.
    ...

Interestingly, this works without error if BRMS and maven client exist in the same machine (even if BRMS binds a specific IP instead of localhost).

Steps to Reproduce:

See above.

Actual results:

maven fails.

Expected results:

maven successfully build.

Additional info:

You can workaround this by modifying business-central.war/WEB-INF/classes/url_filter.yaml file.
===
filter:
   - pattern: /rest/**
   - pattern: /org.kie.workbench.drools.KIEDroolsWebapp/**

exclude:
   - /*.ico
   - /org.kie.workbench.drools.KIEDroolsWebapp/images/**
   - /org.kie.workbench.drools.KIEDroolsWebapp/css/**
   - /css/**
   - /images/**
   - /maven2/**
===

I filed this BZ for the case where users still want authentication.

Comment 4 Jiri Locker 2014-02-27 19:03:56 UTC
This is not a bug in the product. The workarounds suggested by Michael were verified for 6.0.0.GA and 6.0.1.ER1. To summarize:

It is either needed to turn on pre-emptive authentication for the repository server by

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

or set Authorization HTTP header with Base64 encoded credentials

    <server>
      <id>guvnor-m2-repo</id>
      <configuration>
        <httpHeaders>
          <property>
            <name>Authorization</name>
            <!-- Base64-encoded "admin:admin" -->
            <value>Basic YWRtaW46YWRtaW4=</value>
          </property>
        </httpHeaders>
      </configuration>
    </server>

This should be documented.

Comment 5 JBoss JIRA Server 2014-03-24 11:37:15 UTC
Mario Fusco <mario.fusco> updated the status of jira DROOLS-436 to Resolved

Comment 6 Jiri Svitak 2014-04-22 11:34:02 UTC
*** Bug 1074986 has been marked as a duplicate of this bug. ***