nathanmarz/storm · error · RuntimeException

Fail to construct messaging plugin from plugin

Error message

Fail to construct messaging plugin from plugin ${transport_plugin_klassName}

What it means

TransportFactory.makeContext instantiates the configured messaging transport plugin (Config.STORM_MESSAGING_TRANSPORT) either as an IContext or via a makeContext(Map) method. Any exception during class loading, casting, or reflective invocation is wrapped in a RuntimeException naming the plugin class.

Solutions

  1. Check the wrapped cause 'Caused by' to find the real failure (ClassNotFound, NoSuchMethod, inner exception).
  2. Verify Config.STORM_MESSAGING_TRANSPORT is the correct fully-qualified class (default backtype.storm.messaging.netty.Context).
  3. Ensure the plugin jar is on the classpath of every process (nimbus, supervisors, workers).
  4. Confirm the plugin implements IContext or has public static/non-static makeContext(Map) returning IContext.
  5. Check plugin initialization requirements (ports free, netty version compatible).

Example fix

// before
conf.put(Config.STORM_MESSAGING_TRANSPORT, "com.me.MyTransportCtx"); // class not on classpath
// after
conf.put(Config.STORM_MESSAGING_TRANSPORT, "backtype.storm.messaging.netty.Context");
// or ship the custom plugin jar with the topology / into storm's lib directory
Defensive patterns

Strategy: try-catch

Validate before calling

// preflight: load and instantiate the plugin before running the topology
String cls = (String) conf.get(Config.STORM_MESSAGING_TRANSPORT);
Class.forName(cls).getDeclaredConstructor().newInstance(); // throws early with a clear error

Try / catch

try {
    IContext ctx = TransportFactory.makeContext(stormConf);
} catch (RuntimeException e) {
    log.error("Transport plugin " + stormConf.get(Config.STORM_MESSAGING_TRANSPORT)
        + " failed to initialize; check cause", e.getCause());
    throw e;
}

Prevention

When it happens

Trigger: Config.STORM_MESSAGING_TRANSPORT pointing to a class that doesn't exist, isn't on the classpath, doesn't implement IContext or expose makeContext(Map), whose constructor fails, or whose returned object isn't IContext (bad cast).

Common situations: Typos in the fully-qualified class name; custom transport plugin jar missing from supervisor/nimbus classpath; plugin written for a different Storm version (method signature change); plugin's makeContext throwing internally (e.g. failed to bind port).

Related errors


AI-assisted analysis of nathanmarz/storm@cdb116e942 (2026-09-12). Data as JSON: /api/errors/1dd69bfbc78a1768. Report an issue: GitHub.

Appendix: source

Thrown at storm-core/src/jvm/backtype/storm/messaging/TransportFactory.java:53

        IContext transport = null;
        try {
            //create a factory class
            Class klass = Class.forName(transport_plugin_klassName);
            //obtain a context object
            Object obj = klass.newInstance();
            if (obj instanceof IContext) {
                //case 1: plugin is a IContext class
                transport = (IContext)obj;
                //initialize with storm configuration
                transport.prepare(storm_conf);
            } else {
                //case 2: Non-IContext plugin must have a makeContext(storm_conf) method that returns IContext object
                Method method = klass.getMethod("makeContext", Map.class);
                LOG.debug("object:"+obj+" method:"+method);
                transport = (IContext) method.invoke(obj, storm_conf);
            }
        } catch(Exception e) {
            throw new RuntimeException("Fail to construct messaging plugin from plugin "+transport_plugin_klassName, e);
        } 
        return transport;
    }
}

View on GitHub (pinned to cdb116e942)