Request to http://localhost:4502/crx/packmgr/service.jsp failed, response=Unauthorized | Community
Skip to main content
New Participant
October 16, 2015
Solved

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

  • October 16, 2015
  • 5 replies
  • 18878 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by vsharm3

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>

5 replies

New Participant
March 19, 2024

These packages uses the variables ${vault.user} and ${vault.password} by default.If we created a new credentials we have to update it in the pom.xml.

In the parent pom.xml replace the <vault.user> and <vault.password> with the new username and password you have created...

smitakagwade
New Participant
July 13, 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>

 

 

New Participant
June 13, 2024

thank you. it rellay works.

Shubham_borole
New Participant
February 10, 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

kennyhank
New Participant
December 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.

vsharm3AuthorAccepted solution
New Participant
October 16, 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>