Can't select custom connector in process diagram

Hi,

I am having problems using a custom connector I just developed in Bonita Studio Community 2021.2.

I developed a custom connector using the connector maven archetype and I can successfully build it using 'mvn clean package'.

I imported it into bonita studio  using New->Extension->Add a custom extension and selecting the .jar file built in the previous step. It appears correctly in the Extensions Overview of my project.

However, when I try to select it for a service task in my process using  "Execution" -> "Connectors In" -> "Add", it doesn't appear as an option in the pop-up window "Select a connector definition".

What am I missing?

Oriol

Hi,

You can check that a connector definition has been found in your extension by clicking on the connector extension in the Project Overview.

If no definition is listed, then there is something wrong with your custom extension:

  • Check that there is a matching implementation for a connector definition (*.impl file)
  • Check that there is no typo in descriptors (ids, class names…)

You may run the following maven command line to check if the Bonita project analysis detect your extension properly:

(Maven installation required !)
From the root of your Bonita project, execute:
mvn bonita-project:analyze

It should output something like this:

[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------------< com.company:my-project >-----------------------
[INFO] Building My project 0.0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- bonita-project-maven-plugin:0.0.5:analyze (default-cli) @ my-project ---
[INFO] === 2 Connector definitions found ===
[INFO] email-1.2.0 in org.bonitasoft.connectors:bonita-connector-email:1.3.0
[INFO] ldap-1.1.0 in org.bonitasoft.connectors:bonita-connector-ldap:1.2.1
[INFO] === 2 Connector implementations found ===
[INFO] email-impl-1.3.0 for email-1.2.0 in org.bonitasoft.connectors:bonita-connector-email:1.3.0
[INFO] ldap-1.2.1 for ldap-1.1.0 in org.bonitasoft.connectors:bonita-connector-ldap:1.2.1
[INFO] === 1 Actor filter definitions found ===
[INFO] bonita-actorfilter-single-user-1.0.0 in org.bonitasoft.actorfilter:bonita-actorfilter-single-user:1.0.0
[INFO] === 1 Actor filter implementations found ===
[INFO] bonita-actorfilter-single-user-impl-1.0.0 for bonita-actorfilter-single-user-1.0.0 in org.bonitasoft.actorfilter:bonita-actorfilter-single-user:1.0.0
[INFO] === 0 Pages found ===
[INFO] === 0 Forms found
[INFO] === 0 Rest API Extensions found ===
[INFO] === 0 Themes found ===
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.103 s
[INFO] Finished at: 2022-03-23T10:24:35+01:00
[INFO] ------------------------------------------------------------------------

UPDATE: In this case it was an invalid .def xml file.

HTH
Romain

Hi!

Thanks for your answer. I tried using the command you provided and I can see that bonita doesn't find any connector implementation in my project.

$ mvn org.bonitasoft.maven:bonita-project-maven-plugin:analyze
[INFO] Scanning for projects...
[INFO] === 0 Connector implementations found ===
[INFO] === 0 Actor filter definitions found ===
[INFO] === 0 Actor filter implementations found ===
[INFO] === 0 Pages found ===
[INFO] === 0 Forms found
[INFO] === 0 Rest API Extensions found ===
[INFO] === 0 Themes found ===
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.067 s
[INFO] Finished at: 2022-03-25T12:42:30+01:00
[INFO] ------------------------------------------------------------------------
 

I find this weird as I do have a .def file and a matching .impl file:

./src/main/resources-filtered:
mqtt-publish-ij.def  mqtt-publish-ij.impl  mqtt-publish-ij.properties

I checked names, inputs/outpus, classnames, ... for typos but everything looks right to me.

Cheers,

Oriol

 

 

Can you double-check the content of the produced jar file ? You should have the descriptors (*.def and *.impl) files at the root of the jar.

If you are developing an open source connector, I’m willing to take a look at the project to help you.

I do have the descriptors (*.def and *.impl) files at the root of the jar.

Right now it's just a rough test, I may open source it if I actually develop a nicely finished connector and my company is ok with it. I have no problem in sending you the source files if you want them.

 

Can you share the .def and .impl content ? (the ones built in the jar file)

Hi!

mqtt-publish-ij.def:

<?xml version="1.0" encoding="UTF-8"?>
<definition:ConnectorDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:definition="http://www.bonitasoft.org/ns/connector/definition/6.1">
    <id>mqtt-publish-ij</id> <!-- Id of the definition -->
    <version>1.0.0</version> <!-- Version of the definition -->
    <icon>connector.png</icon> <!-- The icon used in the Studio for this definition -->
    <category icon="connector.png" id="Custom"/> <!-- The category of this definition, used in the Studio (e.g: http, script ...) -->

    <!-- Connector inputs -->
    <input mandatory="true" name="brokerHost" type="java.lang.String"/>
    <input mandatory="true" name="brokerPort" type="java.lang.Integer"/>
    <input mandatory="true" name="topic" type="java.lang.String"/>
    <input mandatory="true" name="qos" type="java.lang.String" />
    <input mandatory="true" name="message" type="java.lang.Integer" />

    <!-- Connector outputs -->
    <output name="result" type="java.lang.String"/>

    <!--
       Pages and widgets to use the connector in the Bonita Studio.
       - Each widget must be bound to an input
       - Page titles must be defined in the properties files
       - Widget labels must be defined in the properties files
       - Page and widget descriptions can be defined in the properties files (optional)
    -->
    <page id="mqttPublishPage">
        <widget xsi:type="definition:Text" id="brokerHostWidget" inputName="brokerHost"/>
        <widget xsi:type="definition:Text" id="brokerPortWidget" inputName="brokerPort"/>
        <widget xsi:type="definition:Text" id="topicWidget" inputName="topic"/>
        <widget xsi:type="definition:Select" id="qosWidget" inputName="qos">
            <items>0</items>
            <items>1</items>
            <items>2</items>
        <widget xsi:type="definition:Text" id="messageWidget" inputName="message"/>
    </page>

</definition:ConnectorDefinition>

mqtt-publish-ij.impl:

 

<?xml version="1.0" encoding="UTF-8"?>
<implementation:connectorImplementation xmlns:implementation="http://www.bonitasoft.org/ns/connector/implementation/6.0">
  <implementationId>mqtt-publish-ij-impl</implementationId> <!-- Id of the implementation -->
  <implementationVersion>1.0-SNAPSHOT</implementationVersion> <!-- Version of the implementation -->
  <definitionId>mqtt-publish-ij</definitionId> <!-- Id of the definition implemented -->
  <definitionVersion>1.0.0</definitionVersion> <!-- Version of the definition implemented -->
  <implementationClassname>eu.gtd.MqttPublishConnector</implementationClassname> <!-- Path to the main implementation class -->
  <description>Default mqtt-publish-ij implementation</description>

<!-- retrieved from the pom.xml at build time -->
<jarDependencies>
  <jarDependency>mqtt-publish-ij-1.0-SNAPSHOT.jar</jarDependency>
</jarDependencies>

</implementation:connectorImplementation>

Can you double check that ‘eu.gtd.MqttPublishConnector’ class file is present in the built jar file ?

Yes, it is there:

OPG@ORIOL-NEW MINGW64 ~/intelij workspace/mqtt-publish-ij/target/mqtt-publish-ij-1.0-SNAPSHOT/eu/gtd (master)
$ ls
MqttPublishConnector.class

:confused:

Weird… can you send me the jar file ?
You may use a service like WeTransfer

Thanks

I uploaded the jar file here:

https://we.tl/t-UvKcT0sSjh

I can also upload the whole project if you want to take a look at it.

The issue comes from the .def files.
A closing </widget> tag is missing at line 33.

Thanks so much! This solved my issue and the connector appears now correctly in Bonita Studio.