Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

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

vsharm3
Level 2
Level 2

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

1 Accepted Solution
vsharm3
Correct answer by
Level 2
Level 2

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>

View solution in original post

4 Replies
vsharm3
Correct answer by
Level 2
Level 2

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>

View solution in original post

kennyhank
Level 3
Level 3

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.

snbaem
Community Advisor
Community Advisor

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

smitakagwade
Level 2
Level 2

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>