App Connect

App Connect

Join this online user group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#Applicationintegration
#App Connect
#AppConnect
 View Only
  • 1.  User defined Connector - ClassCastException

    Posted Mon March 04, 2024 07:47 AM

    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
    ------------------------------


  • 2.  RE: User defined Connector - ClassCastException

    Posted Tue March 05, 2024 04:02 AM

    Hi Muhammad, in order to better assist, could you please post your code, or cut-down parts of it which exhibit the error as this may help us figure out what is causing the exception.  Cheers, Ben



    ------------------------------
    Ben Thompson
    IBM UK
    ------------------------------



  • 3.  RE: User defined Connector - ClassCastException

    Posted Wed March 06, 2024 03:02 AM

    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
    ------------------------------



  • 4.  RE: User defined Connector - ClassCastException

    Posted Thu March 07, 2024 12:03 AM
    Edited by Muhammad Uzair Arif Thu March 07, 2024 12:06 AM

    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
    ------------------------------



  • 5.  RE: User defined Connector - ClassCastException

    Posted Thu March 07, 2024 12:55 AM

    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
    ------------------------------



  • 6.  RE: User defined Connector - ClassCastException

    Posted Thu March 07, 2024 03:40 AM

    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
    ------------------------------



  • 7.  RE: User defined Connector - ClassCastException

    Posted Thu March 14, 2024 05:28 AM

    Hi All,

    Quick update: I was able to resolve the issue, The node.conf.yaml configuration isn't required, and it was causing issues. I was just using it because I assumed that ovewriting the directory would work if I override it in the node.conf.yaml file. but well placing it in the default directory works.

    Regards,

    Uzair



    ------------------------------
    Muhammad Uzair Arif
    ------------------------------