Request to http://localhost:4502/crx/packmgr/service.jsp failed, response=Unauthorized

Avatar

Avatar
Boost 3
Level 2
vsharm3
Level 2

Likes

3 likes

Total Posts

19 posts

Correct reply

2 solutions
Top badges earned
Boost 3
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Boost 3
Level 2
vsharm3
Level 2

Likes

3 likes

Total Posts

19 posts

Correct reply

2 solutions
Top badges earned
Boost 3
Validate 1
Boost 1
Affirm 1
View profile
vsharm3
Level 2

15-10-2015

I have created a different user and password instead of using default admin/admin credentials for building the project bundle and deploying the package. I have given all the permission to this new user account which the admin user has. Also, I am able to deploy the OSGi java bundle successfully using the maven script.

However, when I am trying to deploy the content package i.e. vault using maven, I am getting the following error. If I manually login to http://localhost:4502/crx/packmgr using the new credentials and try to deploy the package manually then it works.

Can someone help me to understand what am I missing?

[INFO] --- content-package-maven-plugin:0.0.16:install (default-cli) @ [project]-vault ---
[INFO] Installing [project]-vault (/Users/[my_user]/[my project]/[project]-vault/target/[project]-vault-0.0.1.zip) to http://localhost:4502/crx/packmgr/service.jsp
[INFO] AuthChallengeProcessor - basic authentication scheme selected
[INFO] HttpMethodDirector - Failure authenticating with BASIC 'Sling (Development)'@localhost:4502
[ERROR] Request to http://localhost:4502/crx/packmgr/service.jsp failed, response=Unauthorized
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

[ERROR] Failed to execute goal com.day.jcr.vault:content-package-maven-plugin:0.0.16:install (default-cli) on project [project]-vault: Error while installing package. Check log for details. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.day.jcr.vault:content-package-maven-plugin:0.0.16:install (default-cli) on project [project]-vault: Error while installing package. Check log for details.

Caused by: org.apache.maven.plugin.MojoFailureException: Error while installing package. Check log for details.
    at com.day.jcr.vault.maven.mgr.PackageInstallMojo.uploadPackage(PackageInstallMojo.java:281)
    at com.day.jcr.vault.maven.mgr.PackageInstallMojo.execute(PackageInstallMojo.java:200)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 3
Level 2
vsharm3
Level 2

Likes

3 likes

Total Posts

19 posts

Correct reply

2 solutions
Top badges earned
Boost 3
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Boost 3
Level 2
vsharm3
Level 2

Likes

3 likes

Total Posts

19 posts

Correct reply

2 solutions
Top badges earned
Boost 3
Validate 1
Boost 1
Affirm 1
View profile
vsharm3
Level 2

15-10-2015

This issue has been resolved :). I was using <user> which is not applicable for goal package and instead should be using <userId> as per the maven documenation.

http://dev.day.com/docs/en/cq/5-5/core/how_to/how_to_use_the_vlttool/vlt-mavenplugin.html

<plugin>
                <groupId>com.day.jcr.vault</groupId>
                <artifactId>content-package-maven-plugin</artifactId>
                <version>0.0.18</version>
                <configuration>
                    <name>${project.artifactId}</name>
                    <failOnError>true</failOnError>
                    <filterSource>src/main/content/META-INF/vault/filter.xml</filterSource>
                    <builtContentDirectory>src/main/content/jcr_root</builtContentDirectory>
                    <packageFile>target/${project.artifactId}-${project.version}.zip</packageFile>
                    <targetURL>${crx_url}/crx/packmgr/service.jsp</targetURL>
                    <!--  <user>${crx_user}</user> -->
                    <userId>${crx_user}</userId>
                    <password>${crx_password}</password>
                    <verbose>true</verbose>
                    <useProxy>false</useProxy>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>package</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

Answers (3)

Answers (3)

Avatar

Avatar
Boost 1
Level 2
smitakagwade
Level 2

Likes

5 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 2
smitakagwade
Level 2

Likes

5 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
smitakagwade
Level 2

13-07-2021

This can be due to if you are using different passwords for AEM author instance 
You need to change your pom.xml file and replace the default password with your password that you are using for the Author instance

 

 

    <properties>
        <aem.host>localhost</aem.host>
        <aem.port>4502</aem.port>
        <aem.publish.host>localhost</aem.publish.host>
        <aem.publish.port>4503</aem.publish.port>
        <sling.user>admin</sling.user>
        <sling.password>your_password</sling.password>
        <vault.user>admin</vault.user>
        <vault.password>your_password</vault.password>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>

 

 

Avatar

Avatar
Boost 100
Level 6
snbaem
Level 6

Likes

119 likes

Total Posts

249 posts

Correct reply

38 solutions
Top badges earned
Boost 100
Springboard
Establish
Validate 25
Validate 10
View profile

Avatar
Boost 100
Level 6
snbaem
Level 6

Likes

119 likes

Total Posts

249 posts

Correct reply

38 solutions
Top badges earned
Boost 100
Springboard
Establish
Validate 25
Validate 10
View profile
snbaem
Level 6

10-02-2017

vsharm3 wrote...

I have created a different user and password instead of using default admin/admin credentials for building the project bundle and deploying the package. I have given all the permission to this new user account which the admin user has. Also, I am able to deploy the OSGi java bundle successfully using the maven script.

However, when I am trying to deploy the content package i.e. vault using maven, I am getting the following error. If I manually login to http://localhost:4502/crx/packmgr using the new credentials and try to deploy the package manually then it works.

Can someone help me to understand what am I missing?

[INFO] --- content-package-maven-plugin:0.0.16:install (default-cli) @ [project]-vault ---
[INFO] Installing [project]-vault (/Users/[my_user]/[my project]/[project]-vault/target/[project]-vault-0.0.1.zip) to http://localhost:4502/crx/packmgr/service.jsp
[INFO] AuthChallengeProcessor - basic authentication scheme selected
[INFO] HttpMethodDirector - Failure authenticating with BASIC 'Sling (Development)'@localhost:4502
[ERROR] Request to http://localhost:4502/crx/packmgr/service.jsp failed, response=Unauthorized
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

[ERROR] Failed to execute goal com.day.jcr.vault:content-package-maven-plugin:0.0.16:install (default-cli) on project [project]-vault: Error while installing package. Check log for details. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.day.jcr.vault:content-package-maven-plugin:0.0.16:install (default-cli) on project [project]-vault: Error while installing package. Check log for details.

Caused by: org.apache.maven.plugin.MojoFailureException: Error while installing package. Check log for details.
    at com.day.jcr.vault.maven.mgr.PackageInstallMojo.uploadPackage(PackageInstallMojo.java:281)
    at com.day.jcr.vault.maven.mgr.PackageInstallMojo.execute(PackageInstallMojo.java:200)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more

 

Really appreciate the update

Avatar

Avatar
Validate 1
Level 2
kennyhank
Level 2

Likes

11 likes

Total Posts

36 posts

Correct reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 2
kennyhank
Level 2

Likes

11 likes

Total Posts

36 posts

Correct reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
kennyhank
Level 2

12-12-2016

vsharm3 wrote...

This issue has been resolved :). I was using <user> which is not applicable for goal package and instead should be using <userId> as per the maven documenation.

http://dev.day.com/docs/en/cq/5-5/core/how_to/how_to_use_the_vlttool/vlt-mavenplugin.html

<plugin>
                <groupId>com.day.jcr.vault</groupId>
                <artifactId>content-package-maven-plugin</artifactId>
                <version>0.0.18</version>
                <configuration>
                    <name>${project.artifactId}</name>
                    <failOnError>true</failOnError>
                    <filterSource>src/main/content/META-INF/vault/filter.xml</filterSource>
                    <builtContentDirectory>src/main/content/jcr_root</builtContentDirectory>
                    <packageFile>target/${project.artifactId}-${project.version}.zip</packageFile>
                    <targetURL>${crx_url}/crx/packmgr/service.jsp</targetURL>
                    <!--  <user>${crx_user}</user> -->
                    <userId>${crx_user}</userId>
                    <password>${crx_password}</password>
                    <verbose>true</verbose>
                    <useProxy>false</useProxy>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>package</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

 

It was very useful this thread, same issue happen to me.