Java Error on Robot Execution

Hi, I'm trying to execute a robotic process that open and close Outlook, but I receive this message [ERROR] 2020-06-16 15:58:20 - - java.lang.reflect.InvocationTargetException

Anyone know what could be due to it? I attach my short code here:

Java class:



package com.novayre.jidoka.robot.test;

import com.novayre.jidoka.client.api.IJidokaServer;
import com.novayre.jidoka.client.api.IRobot;
import com.novayre.jidoka.client.api.JidokaFactory;
import com.novayre.jidoka.client.api.annotations.Robot;
import com.novayre.jidoka.client.api.exceptions.JidokaFatalException;
import com.novayre.jidoka.client.api.multios.IClient;
import com.novayre.jidoka.outlook.api.IJidokaOutlook;
import com.novayre.jidoka.outlook.api.exception.JidokaMsOutlookException;


/**
 * The Class OutlookTestRobot.
 */
@Robot
public class OutlookTestRobot implements IRobot {


	/**
	 * Pause between interactions imitating the human behavior.
	 */
	private static final int PAUSE = 5000;

	/** The server. */
	private IJidokaServer< ? > server;
	
	/** The client. */
	private IClient client;

	IJidokaOutlook outlook;

	/**
	 * Initialize the modules
	 */
	@Override
	public boolean startUp() throws Exception {
		try {
			// Initialization of the robot components

			server = JidokaFactory.getServer();
			client = IClient.getInstance(this);
			outlook = IJidokaOutlook.getInstance(this);

			return IRobot.super.startUp();
		} catch (Exception e) {
			throw new JidokaFatalException("Error startUp");
		}
	}

	@Override
	public String[] cleanUp() throws Exception {
		try {

			client.killAllProcesses("outlook.exe", 1000);
			return new String[0];
		} catch (Exception e) {
			throw new JidokaFatalException("Error cleanUp");
		}
	}

	/**
	 * Initial action 'Init'.
	 */
	public void init() {
		try {
			// Default pause after typing or using the mouse

			client.pause(PAUSE);

		} catch (Exception e) {
			throw new JidokaFatalException("Error initializing");
		}
	}

	public void openOutlook() throws Exception {
		try {
			outlook.open();
			client.pause(PAUSE);
		} catch (JidokaMsOutlookException e) {
			throw new JidokaFatalException("Error opening Outlook");
		}
	}

	public void closeOutlook() {
		try {
			client.pause(PAUSE);
			outlook.close();
		} catch (JidokaMsOutlookException e) {
			throw new JidokaFatalException("Error closing Outlook");
		}
	}

	/**
	 * End.
	 */
	public void end() {
		server.debug("Robot finished!");
	}

}

pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.novayre.jidoka.robot.test</groupId>
	<artifactId>OutlookTest</artifactId>
	<packaging>jar</packaging>
	<version>0.0.1</version>

	<name>Outlook Test Robot</name>

	<properties>
		<jidoka.version>7.0.0</jidoka.version>
	</properties>

	<parent>
		<groupId>com.novayre.jidoka.robot</groupId>
		<artifactId>jidoka-robot-parent</artifactId>
		<version>7.0.0</version> <!-- VC -->
	</parent>

	<profiles>
		<profile>
			<id>jidoka-repo</id>

			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>

			<repositories>
				<repository>
					<id>jidoka</id>
					<url>https://domain.appiancloud.com/rpa-repo/repository/jidoka/</url>
					<releases>
					</releases>
					<snapshots>
					</snapshots>
				</repository>
			</repositories>

			<pluginRepositories>
				<pluginRepository>
					<id>jidoka</id>
					<url>https://domain.appiancloud.com/rpa-repo/repository/jidoka/</url>
					<releases>
					</releases>
					<snapshots>
					</snapshots>
				</pluginRepository>
			</pluginRepositories>
			<distributionManagement>
				<repository>
					<id>jidoka</id>
					<url>https://domain.appiancloud.com/rpa-repo/repository/jidoka/</url>
					<layout>default</layout>
				</repository>
			</distributionManagement>
		</profile>
	</profiles>

	<dependencies>
		<dependency>
			<groupId>com.novayre.jidoka.module</groupId>
			<artifactId>jidoka-msoutlook-api</artifactId>
			<version>${jidoka.version}</version>
		</dependency>

	</dependencies>
</project>

The Error:

  Discussion posts and replies are publicly visible

  • This problem sometimes happens when the actions in the workflow are not corrected linked to the code.  Maybe the name of a method has been changed.

    Do you see at the end of your exception something similar to ?

    "Caused by: java.lang.NoSuchMethodException:"

    If not, can you paste the whole exception?

  • The Exception is Caused by java.lang.NoClassDefFoundError: Could not initialize class com.jacob.activeX.ActiveXComponent

    but I put the dll in the folder C: \ AppianRPA, where there is also the agent. I also tried to insert it in the Support files of the robotic process.

    [INFO] 2020-06-16 16:51:34 - - Robot 'OutlookTest' (5ee88089e4b0a11cc6ffa5c7), execution #20, technology JAVA, start method NODE , log level TRACE, testing mode is OFF, external workflow is OFF, preferred node is VMW10N1 (5eb1ce3ae4b0a11cc6ffa539#1)
    [INFO] 2020-06-16 16:51:34 - - Robot without instructions
    [INFO] 2020-06-16 16:51:34 - - Robot without environment variables
    [INFO] 2020-06-16 16:51:34 - - Waiting for VMW10N1 (5eb1ce3ae4b0a11cc6ffa539#1) node
    [INFO] 2020-06-16 16:51:35 - - Node selected was VMW10N1 (5eb1ce3ae4b0a11cc6ffa539#1), permissions: test
    [INFO] 2020-06-16 16:51:35 - - Agent version 7.0.0, revision 20040307
    [INFO] 2020-06-16 16:51:35 - - Memory: free 13.252Mb, reserved 25.23Mb (10%), limit 247.5Mb, maximum 247.5Mb
    [INFO] 2020-06-16 16:51:35 - - Disk: free 12.812Gb (26%), total 49.046Gb
    [INFO] 2020-06-16 16:51:36 - - Processing libraries
    [INFO] 2020-06-16 16:51:36 - - Checking #73 libraries
    [INFO] 2020-06-16 16:51:36 - - Sending #1 of #1 libraries
    [INFO] 2020-06-16 16:51:36 - - Assembling class com.novayre.jidoka.robot.test.OutlookTestRobot version 0.0.1
    [INFO] 2020-06-16 16:51:37 - - Processing support files
    [INFO] 2020-06-16 16:51:37 - - Processing support file 'jacob-1.19-x64.dll'
    [ERROR] 2020-06-16 16:51:38 - - java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.novayre.jidoka.client.RobotClientExecutor.invokeMethod(RobotClientExecutor.java:1537)
    at com.novayre.jidoka.client.RobotClientExecutor.robotStartUp(RobotClientExecutor.java:442)
    at com.novayre.jidoka.client.ETechnologyClient.internalRunJava(ETechnologyClient.java:392)
    at com.novayre.jidoka.client.ETechnologyClient.runJava(ETechnologyClient.java:375)
    at com.novayre.jidoka.client.ETechnologyClient.lambda$static$1(ETechnologyClient.java:40)
    at com.novayre.jidoka.client.ETechnologyClient.run(ETechnologyClient.java:117)
    at com.novayre.jidoka.client.RobotClientExecutor.tryExecute(RobotClientExecutor.java:354)
    at com.novayre.jidoka.client.RobotClientExecutor.execute(RobotClientExecutor.java:184)
    at com.novayre.jidoka.client.ResponseHandler.execute(ResponseHandler.java:292)
    at com.novayre.jidoka.client.ResponseHandler.robotDeclaredResponse(ResponseHandler.java:248)
    at com.novayre.jidoka.client.ResponseHandler.onMessage(ResponseHandler.java:145)
    at com.novayre.jidoka.client.ClientManager.processResponse(ClientManager.java:1519)
    at com.novayre.jidoka.client.ClientManager.internalSendCommandRetry(ClientManager.java:1297)
    at com.novayre.jidoka.client.ClientManager.internalSendCommand(ClientManager.java:1172)
    at com.novayre.jidoka.client.ClientManager.sendCommand(ClientManager.java:1013)
    at com.novayre.jidoka.client.ClientManager.sendCommand(ClientManager.java:999)
    at com.novayre.jidoka.client.ClientManager.loop(ClientManager.java:988)
    at com.novayre.jidoka.client.ClientManager.realConnectToServer(ClientManager.java:872)
    at com.novayre.jidoka.client.ClientManager.connectToServer(ClientManager.java:830)
    at com.novayre.jidoka.client.JidokaClient.connect(JidokaClient.java:948)
    at com.novayre.jidoka.client.JidokaClient.mainLoop(JidokaClient.java:532)
    at com.novayre.jidoka.client.JidokaClient.run(JidokaClient.java:518)
    at com.novayre.jidoka.client.JidokaClient.main(JidokaClient.java:363)
    Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.jacob.activeX.ActiveXComponent
    at com.novayre.jidoka.outlook.impl.manager.OutlookApplication.<init>(OutlookApplication.java:67)
    at com.novayre.jidoka.outlook.impl.JidokaOutlook.<init>(JidokaOutlook.java:43)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at com.novayre.jidoka.client.api.JidokaFactory.getInstance(JidokaFactory.java:197)
    at com.novayre.jidoka.client.api.JidokaFactory.getFreshInstance(JidokaFactory.java:151)
    at com.novayre.jidoka.client.api.JidokaFactory.getFreshInstance(JidokaFactory.java:107)
    at com.novayre.jidoka.outlook.api.IJidokaOutlook.getInstance(IJidokaOutlook.java:45)
    at com.novayre.jidoka.robot.test.OutlookTestRobot.startUp(OutlookTestRobot.java:46)
    ... 27 more

    [INFO] 2020-06-16 16:51:38 - - Start of libraries cleanup
    [INFO] 2020-06-16 16:51:38 - - End of libraries cleanup
    [INFO] 2020-06-16 16:51:38 - - Start of robot cleanup
    [INFO] 2020-06-16 16:51:41 - - End of robot cleanup
    [INFO] 2020-06-16 16:51:42 - - Memory: free 17.978Mb, reserved 25.23Mb (10%), limit 247.5Mb, maximum 247.5Mb
    [INFO] 2020-06-16 16:51:42 - - Disk: free 12.812Gb (26%), total 49.046Gb
    [INFO] 2020-06-16 16:51:42 - - Memory difference: free 4.727Mb, reserved 0b (0%)
    [INFO] 2020-06-16 16:51:42 - - Disk difference: free -276Kb (0%)
    [INFO] 2020-06-16 16:51:42 - -
    ****************************************************************************************************
    Total&#160;number&#160;of&#160;items:&#160;#0
    Result&#160;&#160;&#160;&#160;#Items
    ----------------------------------------------------------------------------------------------------
    Result&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Duration&#160;#Index&#160;Item&#160;Key&#160;(Detail)&#160;[Properties]
    ****************************************************************************************************

  • Have you tried adding the files:

    jacob-1.14.3-x64.dll and jacob-1.14.3-x84.dll (in case the jacob version is 14)

    inside the folders

    /Java/jdk/jre/bin and /Java/jdk/jre/lib/ext

    Please do that, and then restart the resource in administrator mode.

    Another point to keep in mind is to use the 64bit version of Jacob DLL with the 64bit version of Java, ideally on 64bit Windows.