perwendel/spark · error · NotSupportedException

' ' doesn't support

Error message

'${clazz}' doesn't support '${feature}'

What it means

NotSupportedException.raise(clazz, feature) is a convenience factory for Spark's NotSupportedException, whose message is '"' + clazz + "' doesn't support '" + feature + "'". It is thrown when an embedded server implementation does not implement a requested capability (e.g. a server that cannot handle a specific handler/feature Spark asked of it).

Solutions

  1. Use the Jetty embedded server (the default), which supports all Spark features.
  2. If using a custom embedded server, implement the requested feature/handler capability in it.
  3. Remove the code path requesting the unsupported feature (e.g. avoid multiple WebSocket handlers on servers that don't support them).

Example fix

// before
EmbeddedServers.add(EmbeddedServers.Identifiers.RAW, (r, s, e, m) -> new RawServer(r, s)); // RawServer lacks multipleHandlers support
// after
// don't register the RAW identifier; Spark uses Jetty which supports all features
Defensive patterns

Strategy: try-catch

Validate before calling

// only request features your embedded server supports
if (serverSupportsFeature(myServer, "multipleHandlers")) {
    registerWebSockets();
}

Try / catch

try {
    sparkBootstrap();
} catch (spark.embeddedserver.NotSupportedException e) {
    LOG.error("Embedded server {} lacks feature; falling back to Jetty", e.getMessage());
    // re-bootstrap with default Jetty
}

Prevention

When it happens

Trigger: Calling NotSupportedException.raise("SomeServer", "featureName") directly, or indirectly when a custom EmbeddedServerFactory returns a server that cannot support a feature Spark requires (e.g. multiple WebSocket handlers).

Common situations: Implementing a custom EmbeddedServer that lacks a capability Jetty has; swapping embedded servers via embeddedServerIdentifier and hitting an unsupported feature at runtime.

Related errors


AI-assisted analysis of perwendel/spark@1973e402f5 (2026-09-10). Data as JSON: /api/errors/7aab4a172e86aa48. Report an issue: GitHub.

Appendix: source

Thrown at src/main/java/spark/embeddedserver/NotSupportedException.java:33

 * limitations under the License.
 */
package spark.embeddedserver;

/**
 * Used to indicate that a feature is not supported for the specific embedded server.
 */
public class NotSupportedException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    /**
     * Raises a NotSupportedException for the provided class name and feature name.
     *
     * @param clazz   the class name
     * @param feature the feature name
     */
    public static void raise(String clazz, String feature) {
        throw new NotSupportedException(clazz, feature);
    }

    private NotSupportedException(String clazz, String feature) {
        super("'" + clazz + "' doesn't support '" + feature + "'");

    }

}

View on GitHub (pinned to 1973e402f5)