Re: Caused by: org.apache.maven.wagon.authorization.AuthorizationException: Not authorized , ReasonPhrase:Unauthorized.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Caused by: org.apache.maven.wagon.authorization.AuthorizationException: Not authorized , ReasonPhrase:Unauthorized.

Peter Lynch-2
I would try test your expected user name and password using curl, without using Maven.

curl -u user:password http://localhost:8080/nexus/content/groups/public/org/springframework/spring-aspects/3.2.7.RELEASE/spring-aspects-3.2.7.RELEASE.pom

If it works, then focus on Maven, the Maven wagon versions in use locally and on CI, and the settings.xml and profiles being used. Use mvn -X to see what the wagon is doing on CI. If you want to be absolutely sure, possibly enable detailed Maven wagon logging.

If the authorization fails with curl, then the research can start with Nexus. Change the root logging to DEBUG in Nexus and send your request again. Examine the nexus.log file, looking for your requested path and the denial. 

There is no direct downgrade option. You can use the same Nexus version you were using previously, with a backed up sonatype-work/nexus/conf configuration from that old version if the upgrade is the cause of the problem.

More advanced nexus logging tips are in this article.

-Peter





On Wed, Jan 29, 2014 at 4:41 PM, jaybytez <[hidden email]> wrote:
I ran into some issues with a build, after I had done an upgrade from about
2.6.4 - 2.7.1.

So I added my new dependency version and tried to do a build and received
this error:

Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Could not
transfer artifact org.springframework:spring-aspects:pom:3.2.7.RELEASE
from/to nexus (http://localhost:8080/nexus/content/groups/public): Not
authorized , ReasonPhrase:Unauthorized.
at
org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:951)
at
org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:941)
at
org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:669)
at
org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.apache.maven.wagon.authorization.AuthorizationException: Not
authorized , ReasonPhrase:Unauthorized.
at
org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:932)
at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
at
org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:601)
... 4 more

Now I removed all related jars in my local maven, and did a mvn install from
my Eclipse environment. The mvn install from Eclipse was able to
successfully pull the dependency jars without error through the Nexus
Repository:

For example:

Downloading:
http://localhost:8080/nexus/content/groups/public/org/springframework/spring-aspects/3.2.7.RELEASE/spring-aspects-3.2.7.RELEASE.pom
Downloaded:
http://localhost:8080/nexus/content/groups/public/org/springframework/spring-aspects/3.2.7.RELEASE/spring-aspects-3.2.7.RELEASE.pom
(3 KB at 4.6 KB/sec)
Downloading:
http://localhost:8080/nexus/content/groups/public/org/springframework/spring-instrument/3.2.7.RELEASE/spring-instrument-3.2.7.RELEASE.pom
Downloaded:
http://localhost:8080/nexus/content/groups/public/org/springframework/spring-instrument/3.2.7.RELEASE/spring-instrument-3.2.7.RELEASE.pom
(2 KB at 12.2 KB/sec)
Downloading:
http://localhost:8080/nexus/content/groups/public/org/springframework/spring-oxm/3.2.7.RELEASE/spring-oxm-3.2.7.RELEASE.pom
Downloaded:
http://localhost:8080/nexus/content/groups/public/org/springframework/spring-oxm/3.2.7.RELEASE/spring-oxm-3.2.7.RELEASE.pom
(3 KB at 24.1 KB/sec)

But when I go back into my Hudson instance, and run an equivalent mvn
install, I get the error like this:

[INFO]
[INFO]
------------------------------------------------------------------------
[INFO] Building Spring Full Jar 3.2.7-SNAPSHOT
[INFO]
------------------------------------------------------------------------
Downloading:
http://localhost:8080/nexus/content/groups/public/org/springframework/spring-aspects/3.2.7.RELEASE/spring-aspects-3.2.7.RELEASE.pom
Downloading:
http://localhost:8080/nexus/content/groups/public/org/springframework/spring-instrument/3.2.7.RELEASE/spring-instrument-3.2.7.RELEASE.pom
Downloading:
http://localhost:8080/nexus/content/groups/public/org/springframework/spring-oxm/3.2.7.RELEASE/spring-oxm-3.2.7.RELEASE.pom
Downloading:
http://localhost:8080/nexus/content/groups/public/org/springframework/spring-orm/3.2.7.RELEASE/spring-orm-3.2.7.RELEASE.pom
Downloading:
http://localhost:8080/nexus/content/groups/public/org/springframework/spring-jms/3.2.7.RELEASE/spring-jms-3.2.7.RELEASE.pom
Downloading:
http://localhost:8080/nexus/content/groups/public/org/springframework/spring-web/3.2.7.RELEASE/spring-web-3.2.7.RELEASE.pom
Downloading:
http://localhost:8080/nexus/content/groups/public/org/springframework/spring-test/3.2.7.RELEASE/spring-test-3.2.7.RELEASE.pom
[INFO]
------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Web Core POM ...................................... SUCCESS [0.865s]
[INFO] Web Full Java Jars ................................ SUCCESS [0.242s]
[INFO] Spring Full Jar ................................... FAILURE [0.183s]
[INFO] Spring Integration Full Jar ....................... SKIPPED
[INFO] Hibernate Full Jar ................................ SKIPPED
[INFO] Web Java POM ...................................... SKIPPED
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 1.874s
[INFO] Finished at: Wed Jan 29 12:05:32 PST 2014

[INFO] Final Memory: 8M/116M
[INFO]
------------------------------------------------------------------------
[INFO] o.h.m.e.h.MavenExecutionResultHandler - Build failed with
exception(s)
[INFO] o.h.m.e.h.MavenExecutionResultHandler - [1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
goal on project spring-full: Could not resolve dependencies for project
org.springframework:spring-full:jar:3.2.7-SNAPSHOT: Failed to collect
dependencies for [org.springframework:spring-aspects:jar:3.2.7.RELEASE
(compile), org.springframework:spring-instrument:jar:3.2.7.RELEASE
(compile), org.springframework:spring-oxm:jar:3.2.7.RELEASE (compile),
org.springframework:spring-orm:jar:3.2.7.RELEASE (compile),
org.springframework:spring-jms:jar:3.2.7.RELEASE (compile),
org.springframework:spring-web:jar:3.2.7.RELEASE (compile),
org.springframework:spring-test:jar:3.2.7.RELEASE (provided)]
[DEBUG] Closing connection to remote
[ERROR] Failed to execute goal on project spring-full: Could not resolve
dependencies for project org.springframework:spring-full:jar:3.2.7-SNAPSHOT:
Failed to collect dependencies for
[org.springframework:spring-aspects:jar:3.2.7.RELEASE (compile),
org.springframework:spring-instrument:jar:3.2.7.RELEASE (compile),
org.springframework:spring-oxm:jar:3.2.7.RELEASE (compile),
org.springframework:spring-orm:jar:3.2.7.RELEASE (compile),
org.springframework:spring-jms:jar:3.2.7.RELEASE (compile),
org.springframework:spring-web:jar:3.2.7.RELEASE (compile),
org.springframework:spring-test:jar:3.2.7.RELEASE (provided)]: Failed to
read artifact descriptor for
org.springframework:spring-aspects:jar:3.2.7.RELEASE: Could not transfer
artifact org.springframework:spring-aspects:pom:3.2.7.RELEASE from/to nexus
(http://localhost:8080/nexus/content/groups/public): Not authorized ,
ReasonPhrase:Unauthorized. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
goal on project spring-full: Could not resolve dependencies for project
org.springframework:spring-full:jar:3.2.7-SNAPSHOT: Failed to collect
dependencies for [org.springframework:spring-aspects:jar:3.2.7.RELEASE
(compile), org.springframework:spring-instrument:jar:3.2.7.RELEASE
(compile), org.springframework:spring-oxm:jar:3.2.7.RELEASE (compile),
org.springframework:spring-orm:jar:3.2.7.RELEASE (compile),
org.springframework:spring-jms:jar:3.2.7.RELEASE (compile),
org.springframework:spring-web:jar:3.2.7.RELEASE (compile),
org.springframework:spring-test:jar:3.2.7.RELEASE (provided)]
at
org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:210)
at
org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:117)
at
org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:258)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:201)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.project.DependencyResolutionException: Could not
resolve dependencies for project
org.springframework:spring-full:jar:3.2.7-SNAPSHOT: Failed to collect
dependencies for [org.springframework:spring-aspects:jar:3.2.7.RELEASE
(compile), org.springframework:spring-instrument:jar:3.2.7.RELEASE
(compile), org.springframework:spring-oxm:jar:3.2.7.RELEASE (compile),
org.springframework:spring-orm:jar:3.2.7.RELEASE (compile),
org.springframework:spring-jms:jar:3.2.7.RELEASE (compile),
org.springframework:spring-web:jar:3.2.7.RELEASE (compile),
org.springframework:spring-test:jar:3.2.7.RELEASE (provided)]
at
org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:158)
at
org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:185)
... 22 more
Caused by: org.sonatype.aether.collection.DependencyCollectionException:
Failed to collect dependencies for
[org.springframework:spring-aspects:jar:3.2.7.RELEASE (compile),
org.springframework:spring-instrument:jar:3.2.7.RELEASE (compile),
org.springframework:spring-oxm:jar:3.2.7.RELEASE (compile),
org.springframework:spring-orm:jar:3.2.7.RELEASE (compile),
org.springframework:spring-jms:jar:3.2.7.RELEASE (compile),
org.springframework:spring-web:jar:3.2.7.RELEASE (compile),
org.springframework:spring-test:jar:3.2.7.RELEASE (provided)]
at
org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:258)
at
org.sonatype.aether.impl.internal.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:308)
at
org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:150)
... 23 more
Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException:
Failed to read artifact descriptor for
org.springframework:spring-aspects:jar:3.2.7.RELEASE
at
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:296)
at
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186)
at
org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:412)
at
org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:240)
... 25 more
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could
not transfer artifact org.springframework:spring-aspects:pom:3.2.7.RELEASE
from/to nexus (http://localhost:8080/nexus/content/groups/public): Not
authorized , ReasonPhrase:Unauthorized.
at
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
at
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
at
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)
at
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:281)
... 28 more
Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Could not
transfer artifact org.springframework:spring-aspects:pom:3.2.7.RELEASE
from/to nexus (http://localhost:8080/nexus/content/groups/public): Not
authorized , ReasonPhrase:Unauthorized.
at
org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:951)
at
org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:941)
at
org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:669)
at
org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.apache.maven.wagon.authorization.AuthorizationException: Not
authorized , ReasonPhrase:Unauthorized.
at
org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:932)
at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
at
org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:601)
... 4 more

One more item, I did enable anonymous and I also have the username/password
in my settings.xml file that Hudson uses to communicate with Nexus.

The problem is elevated because all of this was working and I am on a high
profile prototype, and now it is failing and I can't build anything post my
upgrade to 2.7.1. I was running successfully this morning.

Is there a way to fix this or successfully downgrade?




--
View this message in context: http://maven.40175.n5.nabble.com/Caused-by-org-apache-maven-wagon-authorization-AuthorizationException-Not-authorized-ReasonPhrase-Un-tp5782784.html
Sent from the Nexus Maven Repository Manager Users List mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]