Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

AEM6.3 POM related Deployment issues

Avatar

Level 4

I have successfully deploying the code in local. When it comes to dev environment my deployment team say they want clean install. I suggested to have profiles of each server in pom. But they are looking for clean install. I am getting connection refused error. Can some one help me in this?

I/O exception (java.net.ConnectException) caught when processing request: Connection refused: connect

[INFO] Retrying request

This is my ui-apps pom profiles

<profiles>

        <profile>

            <id>autoInstallPackage</id>

            <build>

                <plugins>

                    <plugin>

                        <groupId>com.day.jcr.vault</groupId>

                        <artifactId>content-package-maven-plugin</artifactId>

                        <executions>

                            <execution>

                                <id>install-content-package</id>

                                <phase>install</phase>

                                <goals>

                                    <goal>install</goal>

                                </goals>

                                <configuration>

                                    <targetURL>http://${aem.host}:${aem.port}/crx/packmgr/service.jsp</targetURL>

                                    <serviceURL>http://${aem.host}:${aem.port}/crx/packmgr/service.json</serviceURL>

                                    <userId>${sling.user}</userId>

                                    <username>${sling.user}</username>

                                    <password>${sling.password}</password>

                                    <relaxedSSLCheck>true</relaxedSSLCheck>

                                </configuration>

                            </execution>

                        </executions>

                    </plugin>

                </plugins>

            </build>

        </profile>

        <profile>

            <id>autoInstallPackagePublish</id>

            <build>

                <plugins>

                    <plugin>

                        <groupId>com.day.jcr.vault</groupId>

                        <artifactId>content-package-maven-plugin</artifactId>

                        <executions>

                            <execution>

                                <id>install-content-package-publish</id>

                                <phase>install</phase>

                                <goals>

                                    <goal>install</goal>

                                </goals>

                                <configuration>

                                    <targetURL>http://${aem.publish.host}:${aem.publish.port}/crx/packmgr/service.jsp</targetURL>

                                    <serviceURL>http://$aem.publish.host}:${aem.publish.port}/crx/packmgr/service/.json</serviceURL>

                                    <username>${sling.user}</username>

                                    <userId>${sling.user}</userId>

                                    <password>${sling.password}</password>

                                </configuration>

                            </execution>

                        </executions>

                    </plugin>

                </plugins>

            </build>

        </profile>

    </profiles>

18 Replies

Avatar

Employee Advisor

"Connection refused" means that on the specific combination of hostname and port no application is listening. Is the AEM instance started and ready? Are your variables "aem.host"/"aem.port" or "aem.publish.host"/"aem.publish.port" set correctly?

Kind regards,

Jörg

Avatar

Level 4

Aem Instance is started and it is ready.

Please find below variables.

<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>admin</sling.password>

        <vault.user>admin</vault.user>

        <vault.password>admin</vault.password>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    </properties>

Avatar

Employee Advisor

Can you please also provide the complete error?

"Connection refused" in your case could mean, that the CI server tries to deploy to "localhost:4502", where very likely no AEM instance is running.

Jörg

Avatar

Community Advisor

As per your query

You are trying to deploy your code to DEV? The properties configured in your POM.xml point to your local. As Jörg Hoh​ said, when you are trying to run and deploying to server, it is actually trying to install to localhost . Try changing your dev details . There could be a possibility that your server firewall may restrict you from doing so.

One suggestion :- I will not recommend  to add server specific details to your POM.xml because the code usually will be checked into some version control systems and the POM will be shared across. When you are going to deploy this to STAGE or QA , again you may have to change the details. Moreover this won't do any help unless you are doing a manual deployment. If your project has DEV ops in place, deployment to the exact servers should be handled internally.

Avatar

Employee

you can specify -Daem.host=http://your-other-server and -Daem.port=4384 when running the maven command.

Avatar

Level 4

This also could happen when you have some communication issue with the AEM Instance or it's still down. Normally, this error appears when you are running your CI process(deployment) from Jenkins or other servers, it's resolved triggering one more time because you have too many job running concurrency.

Below Thre  is a simple example to test this scenario;  We only have to build and deploy thru maven our app with AEM down and result will be the image attached as you have it above.

Screen Shot 2017-09-11 at 5.55.21 PM.png

Avatar

Level 4

I passing this command mvn -Daem.host=localhost -Daem.port=8080 clean install -PautoInstallPackage but the error says autoInstallPackage doesn't exist.

Avatar

Level 4

It got resolved and working fine now. I have run the command at parent level.

Avatar

Level 4

<profiles>

        <profile>

            <id>autoInstallBundle</id>

            <build>

                <plugins>

                    <plugin>

                        <groupId>org.apache.sling</groupId>

                        <artifactId>maven-sling-plugin</artifactId>

                        <executions>

                            <execution>

                                <id>install-bundle</id>

                                <goals>

                                    <goal>install</goal>

                                </goals>

                            </execution>

                        </executions>

                    </plugin>

                </plugins>

            </build>

        </profile>

    </profiles>

  <modules>

    <module>bundle</module>

    <module>content</module>

  </modules>

Instead of running a maven command how can we deploy code from build machine? Is there any use in main pom having this autoinstallBundle in parent?

Avatar

Level 4

Failed to execute goal com.day.jcr.vault:content-package-maven-plugin:0.0.24:install (install-content-package) on project amicacom.ui.apps: Execution install-content-package of goal com.day.jcr.vault:content-package-maven-plugin:0.0.24:install failed: Invalid uri '${crx.protocol}://${crx.host}:${crx.port}/crx/packmgr/service.jsp'

Avatar

Community Advisor

do you have mentioned this protocol host and port in your pom.xml ?

Avatar

Level 4

<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>admin</sling.password>

        <vault.user>admin</vault.user>

        <vault.password>admin</vault.password>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    </properties>    Is this causing the issue?

Avatar

Level 4

<id>autoInstallPackage</id>

            <build>

                <plugins>

                    <plugin>

                        <groupId>com.day.jcr.vault</groupId>

                        <artifactId>content-package-maven-plugin</artifactId>

                        <executions>

                            <execution>

                                <id>install-content-package</id>

                                <phase>install</phase>

                                <goals>

                                    <goal>install</goal>

                                </goals>

                                <configuration>

                                    <targetURL>${crx.protocol}://${crx.host}:${crx.port}/crx/packmgr/service.jsp</targetURL>

                                    <serviceURL>${crx.protocol}://${crx.host}:${crx.port}/crx/packmgr/service.json</serviceURL>

                                    <userId>${crx.username}</userId>

                                    <username>${crx.username}</username>

                                    <password>${crx.password}</password>

                                    <relaxedSSLCheck>true</relaxedSSLCheck>

                                </configuration>

                            </execution>

                        </executions>

                    </plugin>

                </plugins>

            </build>

        </profile>

There is a mismatch in both. Is this really matters?My deployment team are not updating build profile names. We are upgrading from 5.6 to 6.3

Avatar

Community Advisor

If my understanding is correct here you have aem.host and in your autoinstall profile you are calling crx.host . I not sure though

Avatar

Employee Advisor

You already have "crx.host" and "crx.port" in use; so if you want to modify only properties instead of dealing with the details of the POM, use the "crx.*" properties. If you are fine with writing POMs, rewrite the configuration of the content-package-maven-plugin and make it use the "aem.*" properties.

Jörg

Avatar

Level 4

Thanks Jorg and Veena for your help. Issue resolved.