Skip to main content

Debug AP on remote node without Control Server

Debug AP on remote node without Control Server

Sometimes RPA developer can start implementation earlier than EasyRPA Control Server and infrastructure are prepared. It's possible to run Automation Process on remote node. Node runs Automation Process as separate java process, so we can use standard Java debugging approach for this.

1. Build "uber" jar of the automation process project, for example using "shade" plugin:

pom.xml
<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-shade-plugin</artifactId>
	<configuration>
		<filters>
			<filter>
				<artifact>*:*</artifact>
				<excludes>
					<exclude>module-info.class</exclude>
					<exclude>META-INF/*.SF</exclude>
					<exclude>META-INF/*.DSA</exclude>
					<exclude>META-INF/*.RSA</exclude>
				</excludes>
			</filter>
		</filters>
		<transformers>
			<transformer 
				implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
				<mainClass>eu.ibagroup.easyrpa.engine.boot.ApModuleRunner</mainClass>
			</transformer>
		</transformers>
	</configuration>
	<executions>
		<execution>
		<goals>
			<goal>shade</goal>
		</goals>
		<configuration>
			<shadedArtifactAttached>true</shadedArtifactAttached>
			<shadedClassifierName>full</shadedClassifierName>
			<transformers>
				<transformer 
					implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
				</transformer>
			</transformers>
		</configuration>
		</execution>
	</executions>
</plugin>

2. Upload the jar to remote machine. In the example below it was uploaded to Linux Node Agent using ssh:

3. Install JRE on the remote machine.

4. Launch the Automation Process jar as remote server specifying debug flag:

Command
java -jar -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=0.0.0.0:5005 ibaRPA-0.0.8-full.jar -m org.example.ap.Module

where "-m" - module to launch

As result, you should see message "Listening for transport dt_socket at address : 5005":

5. On local machine in Intellij IDEA add breakpoint in a Task:

6. Create new Run Configuration → Remote JVM Debug:

Select "Attach to remote JVM " option under "Debugger mode";

Specify Host address and Port.

7.Launch the Run Configuration and wait until debugger is connected / suspend on the first break point:

Reference links:

Intellij IDEA Tutorial: Remote debug