{"record":{"id":"79008a4c46ffa87c","repo":"quarkusio/quarkus","slug":"more-than-one-application-class-jakartarestappl","errorCode":null,"errorMessage":"More than one Application class: ${jakartaRestApplicationClasses}","messagePattern":"More than one Application class: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/resteasy-classic/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java","lineNumber":233,"sourceCode":"        final Set<String> excludedClasses;\n        if (resteasyConfig.buildTimeConditionAware()) {\n            excludedClasses = getExcludedClasses(buildTimeConditions);\n        } else {\n            excludedClasses = Collections.emptySet();\n        }\n        final Set<String> allowedClasses;\n        final String appClass;\n        if (resteasyConfig.ignoreApplicationClasses()) {\n            applicationPath = null;\n            allowedClasses = Collections.emptySet();\n            appClass = null;\n        } else {\n            Collection<ClassInfo> jakartaRestApplicationClasses = index.getAllKnownSubclasses(ResteasyDotNames.APPLICATION)\n                    .stream()\n                    .filter(ci -> !ci.isAbstract()).collect(\n                            Collectors.toSet());\n            if (jakartaRestApplicationClasses.size() > 1) {\n                throw new RuntimeException(\"More than one Application class: \" + jakartaRestApplicationClasses);\n            }\n            if (jakartaRestApplicationClasses.isEmpty()) {\n                applicationPath = null;\n                allowedClasses = Collections.emptySet();\n                appClass = null;\n            } else {\n                ClassInfo jakartaRestApplicationClass = jakartaRestApplicationClasses.iterator().next();\n                applicationPath = jakartaRestApplicationClass.annotation(ResteasyDotNames.APPLICATION_PATH);\n                allowedClasses = getAllowedClasses(jakartaRestApplicationClass);\n                appClass = jakartaRestApplicationClass.name().toString();\n            }\n\n            jaxrsProvidersToRegisterBuildItem = getFilteredJaxrsProvidersToRegisterBuildItem(\n                    jaxrsProvidersToRegisterBuildItem, allowedClasses, excludedClasses);\n        }\n\n        boolean filterClasses = !allowedClasses.isEmpty() || !excludedClasses.isEmpty();\n","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/resteasy-classic/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java#L215-L251","documentation":"During deployment, ResteasyServerCommonProcessor scans the application index for concrete subclasses of jakarta.ws.rs.core.Application to determine the application path and which classes that Application selects. JAX-RS allows at most one Application subclass, so when more than one non-abstract Application class is found the build fails with this RuntimeException.","triggerScenarios":"Declaring two or more non-abstract classes extending jakarta.ws.rs.core.Application (with or without @ApplicationPath) in the same Quarkus application or its dependency JARs, triggering deployment build of the RESTEasy Classic server extension.","commonSituations":"Copy-pasting an Application class from another app; adding a library that itself ships an Application subclass; refactoring renamed Application classes leaving the old one behind.","solutions":["Delete or make abstract all but one jakarta.ws.rs.core.Application subclass in your project.","Exclude the dependency JAR containing the extra Application class, or override/shade it out.","If you need multiple paths, use a single Application with @ApplicationPath and split resources by path annotations, or migrate to Quarkus REST (RESTEasy Reactive) which doesn't require Application classes."],"exampleFix":"// before\n@ApplicationPath(\"/api\")\npublic class App1 extends Application {}\n@ApplicationPath(\"/v2\")\npublic class App2 extends Application {} // build fails\n\n// after\n@ApplicationPath(\"/api\")\npublic class App extends Application {}","handlingStrategy":"validation","validationCode":"long count = Stream.concat(Arrays.stream(MyApplicationClasses.class.getDeclaredClasses()),\n        // plus scan your dependencies\n        Arrays.stream(knownAppClasses))\n    .filter(c -> !Modifier.isAbstract(c.getModifiers()))\n    .filter(jakarta.ws.rs.core.Application.class::isAssignableFrom)\n    .count();\nif (count > 1) throw new IllegalStateException(\"Only one concrete Application class is allowed: found \" + count);","typeGuard":"static boolean isConcreteApplication(Class<?> c) {\n    return jakarta.ws.rs.core.Application.class.isAssignableFrom(c) && !Modifier.isAbstract(c.getModifiers());\n}","tryCatchPattern":"// This fails during Quarkus deployment (augmentation), so it cannot be caught at runtime.\n// Guard instead in a build-time check or CI test:\n// fail the build if more than one concrete Application subclass is on the classpath.","preventionTips":["Keep exactly one jakarta.ws.rs.core.Application subclass per application","Search dependency JARs (jdeps / archunit test) for classes extending Application before adding them","Delete unused/renamed Application classes instead of leaving them in place"],"tags":["jaxrs","deployment","resteasy","build-time"],"backgroundTag":"multiple-application-classes","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}