Original Message:
Sent: Thu March 07, 2024 03:40 AM
From: Muhammad Uzair Arif
Subject: User defined Connector - ClassCastException
Hi Francois,
Thanks for following up, I am using the below documentation link to develop the connector:
https://www.ibm.com/docs/en/app-connect/12.0?topic=connectors-developing-connector-app-connect-enterprise-runtime-environment
With respect to the implementation, I have just implemented the method with respect to the input connector for the AbstractConnectorFactory and the AbstractInputConnector. However, the AbstractConnectorFactory has methods for output and request connector, For them since they aren't part of my use case I just left their implementation as is and just returned null. Do you think that would be causing an issue ?
Also, parallely I'll do some logging to the sys logs in the code and let's see if I can figure something out by doing that.
------------------------------
Muhammad Uzair Arif
Original Message:
Sent: Thu March 07, 2024 12:54 AM
From: Francois Brandelik
Subject: User defined Connector - ClassCastException
So you have 2 classes that are meant to be the implementors of a connection factory and of an input connector.
You showed the class names but not the class content. I believe that you are not satisfying the contract of implementing a concrete method where one is needed?
You say you follow the documentation, can you please provide the URL to the documentation you followed?
------------------------------
Francois Brandelik
Original Message:
Sent: Thu March 07, 2024 12:03 AM
From: Muhammad Uzair Arif
Subject: User defined Connector - ClassCastException
Hi Francois,
I was thinking in the same direction that it'll be a very simple configuration issue, and I am sure it'll be something like hey you missed out that and it'll start workling.
So basically I re-made the connector following the docs and below are the java files that I am using:
@Ben, @Francois, Can you guys give the below details a quick look and let me know if you find any issue
Connector Factory class:
package: com.connector.rabbit
class: RabbitMQConnectorFactory extends AbstractConnectorFactory
Input Connector class:
package: com.connector.rabbit
class: RabbitMQInputConnector extends AbstractInputConnector
connector.xml file contents:
<?xml version="1.0" encoding="UTF-8"?>
<connectorProvider name="RabbitMQConnector">
<connectorFactory className="com.connector.rabbit.RabbitMQConnectorFactory">
<properties>
<property name="name1" value="value1"/>
</properties>
</connectorFactory>
</connectorProvider>
Below is the configuration done in the node.conf.yaml file for it to pick the connector:
ConnectorProviders:
RabbitMQConnector:
connectorClassName: 'com.connector.rabbitmq.RabbitMQConnectorFactory'
jarsURL: '/var/mqsi/connectors/RabbitMQConnector2/' # absolute path
nativeLibs: 'dafault_Path' # absolute path or special value "default_Path"
------------------------------
Muhammad Uzair Arif
Original Message:
Sent: Wed March 06, 2024 03:01 AM
From: Francois Brandelik
Subject: User defined Connector - ClassCastException
Somewhere in your class definition, you must have forgotten an implements or an extends...
This is why the class cast can't happen.
Hope it helps
------------------------------
Francois Brandelik
Original Message:
Sent: Mon March 04, 2024 07:46 AM
From: Muhammad Uzair Arif
Subject: User defined Connector - ClassCastException
Hi,
I am working on creating a user defined connector using java. I have followed the steps as per the documentation, but I am getting the below error trace when I started the node after installing the connector:
Mar 4 17:33:08 ibmace ACE[4995]: IBM App Connect Enterprise v120110 (DEV01.DEV01) [Thread 4995] (Msg 1/3) BIP3849E: Failed to load the Connector 'TestConnector'.
Mar 4 17:33:08 ibmace ACE[4995]: IBM App Connect Enterprise v120110 (DEV01.DEV01) [Thread 4995] (Msg 2/3) BIP3850E: Unexpected java exception thrown from the Connector method 'ConnectorLoader::loadMessageConnector'.
Mar 4 17:33:08 ibmace ACE[4995]: IBM App Connect Enterprise v120110 (DEV01.DEV01) [Thread 4995] (Msg 3/3) BIP4395E: Java exception: 'java.lang.ClassCastException'; thrown from class name: 'com.ibm.broker.connector.ProviderLoader', method name: 'loadConnector', file: 'ProviderLoader.java', line: '66'
After a quick search I identified that this is when the code has attempted to cast an object to a subclass of which it is not an instance. Although I have rechecked the steps as per the documentation, but couldn't figure it out. Since this Provider Loader class is packaged with in IBM product, I am unable to identify and debug what could be causing this issue.
Any leads or assistance to resolve this will be highly appreciated.
------------------------------
Muhammad Uzair Arif
------------------------------