{"record":{"id":"7aab4a172e86aa48","repo":"perwendel/spark","slug":"clazz-doesn-t-support-feature","errorCode":null,"errorMessage":"'${clazz}' doesn't support '${feature}'","messagePattern":"'(.+?)' doesn't support '(.+?)'","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/main/java/spark/embeddedserver/NotSupportedException.java","lineNumber":33,"sourceCode":" * limitations under the License.\n */\npackage spark.embeddedserver;\n\n/**\n * Used to indicate that a feature is not supported for the specific embedded server.\n */\npublic class NotSupportedException extends RuntimeException {\n\n    private static final long serialVersionUID = 1L;\n\n    /**\n     * Raises a NotSupportedException for the provided class name and feature name.\n     *\n     * @param clazz   the class name\n     * @param feature the feature name\n     */\n    public static void raise(String clazz, String feature) {\n        throw new NotSupportedException(clazz, feature);\n    }\n\n    private NotSupportedException(String clazz, String feature) {\n        super(\"'\" + clazz + \"' doesn't support '\" + feature + \"'\");\n\n    }\n\n}\n","sourceCodeStart":15,"sourceCodeEnd":42,"githubUrl":"https://github.com/perwendel/spark/blob/1973e402f5d4c1442ad34a1d38ed0758079f7773/src/main/java/spark/embeddedserver/NotSupportedException.java#L15-L42","documentation":"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).","triggerScenarios":"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).","commonSituations":"Implementing a custom EmbeddedServer that lacks a capability Jetty has; swapping embedded servers via embeddedServerIdentifier and hitting an unsupported feature at runtime.","solutions":["Use the Jetty embedded server (the default), which supports all Spark features.","If using a custom embedded server, implement the requested feature/handler capability in it.","Remove the code path requesting the unsupported feature (e.g. avoid multiple WebSocket handlers on servers that don't support them)."],"exampleFix":"// before\nEmbeddedServers.add(EmbeddedServers.Identifiers.RAW, (r, s, e, m) -> new RawServer(r, s)); // RawServer lacks multipleHandlers support\n// after\n// don't register the RAW identifier; Spark uses Jetty which supports all features","handlingStrategy":"try-catch","validationCode":"// only request features your embedded server supports\nif (serverSupportsFeature(myServer, \"multipleHandlers\")) {\n    registerWebSockets();\n}","typeGuard":null,"tryCatchPattern":"try {\n    sparkBootstrap();\n} catch (spark.embeddedserver.NotSupportedException e) {\n    LOG.error(\"Embedded server {} lacks feature; falling back to Jetty\", e.getMessage());\n    // re-bootstrap with default Jetty\n}","preventionTips":["Implement all feature interfaces Spark may request in custom EmbeddedServer implementations.","Test custom embedded servers against the full Spark feature set.","Fall back to the default Jetty server when unsure."],"tags":["java","embedded-server","unsupported-feature"],"backgroundTag":"operation-not-supported","analyzedSha":"1973e402f5d4c1442ad34a1d38ed0758079f7773","analyzedAt":"2026-09-10T14:38:22.866Z","contentChangedAt":"2026-09-10T14:38:22.866Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}