# Testing plugin actions via transport client results in an NPE, 2.0.0.rc1

**URL:** <https://discuss.elastic.co/t/testing-plugin-actions-via-transport-client-results-in-an-npe-2-0-0-rc1/32094>\
**Category:** Elasticsearch\
**Created:** [October 13, 2015, 2:30pm UTC](https://discuss.elastic.co/t/testing-plugin-actions-via-transport-client-results-in-an-npe-2-0-0-rc1/32094 "2015-10-13T14:30:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dawid\_Weiss](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dawid_weiss/32/1643_2.png) [@Dawid\_Weiss](https://discuss.elastic.co/u/Dawid_Weiss)\
**Post date:** [October 13, 2015, 2:30pm UTC](https://discuss.elastic.co/t/testing-plugin-actions-via-transport-client-results-in-an-npe-2-0-0-rc1/32094/1 "2015-10-13T14:30:34Z")

</div>

I'm a bit stuck when porting the clustering plugin to 2.0.0.rc1. Here  
is the problem:

- For integration tests ESIntegTestCase's client() returns a transport  
client (even if @ClusterScope's transportClientRatio is set to zero,  
which kind of makes sense since it's communicating with an external  
node). But when one develops custom plugins (with actions) it can be  
quite surprising to receive an NPE as follows:

Throwable #1: java.lang.NullPointerException

> at org.elasticsearch.client.transport.support.TransportProxyClient$1.doWithNode(TransportProxyClient.java:58)  
> at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:202)  
> at org.elasticsearch.client.transport.support.TransportProxyClient.execute(TransportProxyClient.java:55)  
> at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:272)  
> at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:347)  
> at org.elasticsearch.client.FilterClient.doExecute(FilterClient.java:52)  
> at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:347)  
> at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:85)  
> at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:59)  
> at org.elasticsearch.action.ActionRequestBuilder.get(ActionRequestBuilder.java:67)

this essentially means the action (plugin) wasn't registered in  
TransportClient. There are mentions of this requirement on the mailing  
list, but they're buried under tons of other stuff. I think an  
exception could be improved here (essentially "action unknown").

- I can't figure out how to set up the transport client properly for  
ESIntegTestCase. I passed an appropriate "plugin.types" property to  
node settings in

protected Settings nodeSettings(int nodeOrdinal)

and it took me a longer while to realize that ESIntegTestCase has  
_two_ methods to initialize the settings, the other one being:

protected Settings transportClientSettings()

the thing is... even if I set plugin.types in transportClientSettings  
I still get the NPE above. And this method doesn't seem to be invoked  
at all.

What am I missing here?

[spent a few minutes looking at the code]

Oh, there is a _third_ method to set up settings:

protected Settings externalClusterClientSettings()

And this one finally worked!

Could somebody who knows the code clarify what these methods actually  
do and when to use which one? 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:45pm UTC](https://discuss.elastic.co/t/testing-plugin-actions-via-transport-client-results-in-an-npe-2-0-0-rc1/32094/2 "2017-07-05T23:45:04Z")

</div>


