Search code examples
javaconfigurationebxml

IBM AS4 client (com.ibm.b2b.as4.client) - how to set proxy host?


I'm trying to run the ATO AS4/ebXML "reference" application, which under the hood uses the IBM AS4 client to post messages to the ATO.

When I run it, I'm getting a NullPointerException from inside the AS4 client. It appears this is due to the HttpDestination map having an "HttpProxyHost" key with a null value.

Given this is a shrink-wrapped library, how can I either remove this key from the map, or assign a value to it? If it is a configuration item, where is it configured?

FWIW I'm not running through a proxy and I would hope the AS4 client can support this.

com.ibm.b2b.as4.client.AS4ClientException: BCKAS4010E
        at com.ibm.b2b.as4.client.internal.RequestImpl.sendBDO(RequestImpl.java:279)
        at com.ibm.b2b.as4.client.internal.RequestImpl.send(RequestImpl.java:226)
        at au.gov.sbr.sdk.embeddedClient.ReferenceClient.main(ReferenceClient.java:375)
Caused by: com.ibm.b2b.apiint.exception.B2BException: java.lang.NullPointerException
        at com.ibm.b2b.comms.as4.core.service.impl.AS4OutboundTargetService.invokeService(AS4OutboundTargetService.java:403)
        at com.ibm.b2b.as4.client.internal.RequestImpl.invokeAS4targetService(RequestImpl.java:311)
        at com.ibm.b2b.as4.client.internal.RequestImpl.sendBDO(RequestImpl.java:246)
        ... 2 more
Caused by: java.lang.NullPointerException
        at java.util.concurrent.ConcurrentHashMap.putVal(Unknown Source)
        at java.util.concurrent.ConcurrentHashMap.putAll(Unknown Source)
        at com.ibm.b2b.comms.common.util.EbMSContext.setAllProperties(EbMSContext.java:153)
        at com.ibm.b2b.as4.client.internal.AS4ConfigLookupUnitImpl.doHTTPDestinationLookup(AS4ConfigLookupUnitImpl.java:340)
        at com.ibm.b2b.comms.as4.core.service.impl.AS4OutboundTargetService.getAptDestination(AS4OutboundTargetService.java:1393)
        at com.ibm.b2b.comms.as4.core.service.impl.AS4OutboundTargetService.initEbMSContext(AS4OutboundTargetService.java:1184)
        at com.ibm.b2b.comms.as4.core.service.impl.AS4OutboundTargetService.invokeService(AS4OutboundTargetService.java:292)
        ... 4 more
Feb 06, 2019 10:37:22 AM au.gov.sbr.sdk.embeddedClient.ReferenceClient main
SEVERE: Message Send Failed.


Solution

  • I have identified the fault. The IBM AS4 EmbeddedClient was unable to open the keystore (mainKeyStore.jks), but instead of throwing an exception it continued on. Downstream this resulted in a NullPointerException with nothing to link it to the original keystore issue.

    I would humbly suggest to every developer on this planet that decent error messages actually matter. This was by no means an isolated incident. We could save our industry $billions every year (and ourselves a LOT of pain) by producing clear, relevant error messages that would allow people to resolve issues immediately instead of wasting days or months hunting them down.