Skip to main content
Question

Trying to connect to box connector from mule using JWT, getting error org.mule.runtime.api.connection.ConnectionException: Could not create connection

  • May 22, 2025
  • 1 reply
  • 33 views

Forum|alt.badge.img

Followed below steps

1. Created an box developer account. 

2. Created a JWT app

3. on Mule created a BOX configuration. Below is the code. 

<box:config name="Box_Connector_Config" doc:name="Box Connector Config" doc:id="d724a8b4-ee6d-457c-8f1b-9113a19f0d41" >
        <box:connection clientID="93b2rsg2i9w11t8pg917qan***********" clientSecret="PKyWjpnuLNnBklqVtFhO4*******" publicKeyId="0a9zoabc" entityId="873274456" boxSubType="ENTERPRISE" algorithm="RS256" keystore="C:\Users\td\eisai1_keystore.jks" keystoreType="JKS" storePassword="Hello@123" keyAlias="tania" keyPassword="Hello@123" maxConnections="10"/>
    </box:config>

4. Using Keystore explorer created a .jks file. 

5. copied the public key from that .jks file.

6. Added that public key to the app I had created into Box developer console. Public key id generated, 

7. Now in Box connector given client_id and client_secret and public key id copied from box dev console. Further from Dev console general settings copied enterpriseid and used that as EntityID and Enterprise as Sub type. 

8. Finally added the keystore which I had created using keystore explorer. Given proper password and alias (used during .jks file creation.)

 

After all these getting bellow error. 

 

INFO  2022-02-09 13:16:38,789 [[MuleRuntime].uber.02: [jwt_poc].uber@org.mule.runtime.core.internal.connection.DefaultConnectivityTesterFactory$1.testConnectivity:81 @1a18fa90] [processor: ; event: ] org.mule.runtime.core.internal.connection.DefaultConnectivityTesterFactory: Connectivity test failed for config 'Box_Connector_Config'. Application deployment will continue. Error was: Could not create connection
org.mule.runtime.api.connection.ConnectionException: Could not create connection
Caused by: java.lang.NullPointerException
    at com.mulesoft.connectors.box.internal.connection.custom.provider.Oauth2JwtConnectionProvider.createConnection(Oauth2JwtConnectionProvider.java:189) ~[mule-box-connector-5.1.5-mule-plugin.jar:?]
    at com.mulesoft.connectivity.rest.commons.api.connection.BaseConnectionProvider.connect(BaseConnectionProvider.java:265) ~[rest-sdk-commons-0.1.5.jar:?]

 

Any help will be highly appreciated. 

1 reply

Forum|alt.badge.img

Hello, found the solution. JWT app needs to be authorized and enabled. From Dev console-> APP-> Authorization submit authorization request.  From Admin Console one of the admin then can authorize that app. Then connector will work for the given client_id and client_secret.