{"record":{"id":"ade8a2d58b79de26","repo":"flowable/flowable-engine","slug":"several-jaxb-binding-definitions-found-for-flowabl","errorCode":null,"errorMessage":"Several JAXB binding definitions found for flowable-cxf: \" + JAXB_BINDINGS_RESOURCE","messagePattern":"Several JAXB binding definitions found for flowable-cxf: \" \\+ JAXB_BINDINGS_RESOURCE","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cxf/src/main/java/org/flowable/engine/impl/webservice/CxfWSDLImporter.java","lineNumber":121,"sourceCode":"\n    protected URIResolver createUriResolver(String sourceSystemId, Import theImport) throws IOException {\n        return new URIResolver(sourceSystemId, theImport.getLocation());\n    }\n\n    public void importFrom(String url) {\n        this.wsServices.clear();\n        this.wsOperations.clear();\n        this.structures.clear();\n\n        this.wsdlLocation = url;\n\n        try {\n            Bus bus = BusFactory.getDefaultBus();\n            final Enumeration<URL> xjcBindingUrls = Thread.currentThread().getContextClassLoader().getResources(JAXB_BINDINGS_RESOURCE);\n            if (xjcBindingUrls.hasMoreElements()) {\n                final URL xjcBindingUrl = xjcBindingUrls.nextElement();\n                if (xjcBindingUrls.hasMoreElements()) {\n                    throw new FlowableException(\"Several JAXB binding definitions found for flowable-cxf: \" + JAXB_BINDINGS_RESOURCE);\n                }\n                DynamicClientFactory.newInstance(bus).createClient(url, Arrays.asList(new String[] { xjcBindingUrl.toString() }));\n                WSDLManager wsdlManager = bus.getExtension(WSDLManager.class);\n                Definition def = wsdlManager.getDefinition(url);\n                WSDLServiceBuilder builder = new WSDLServiceBuilder(bus);\n                List<ServiceInfo> services = builder.buildServices(def);\n\n                for (ServiceInfo service : services) {\n                    WSService wsService = this.importService(service);\n                    this.wsServices.put(this.namespace + wsService.getName(), wsService);\n                }\n\n                if (def != null && def.getTypes() != null) {\n                    this.importTypes(def.getTypes());\n                }\n            } else {\n                throw new FlowableException(\"The JAXB binding definitions are not found for flowable-cxf: \" + JAXB_BINDINGS_RESOURCE);\n            }","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cxf/src/main/java/org/flowable/engine/impl/webservice/CxfWSDLImporter.java#L103-L139","documentation":"When building a CXF dynamic client, the importer locates a JAXB binding customization file (JAXB_BINDINGS_RESOURCE) on the context classpath. If more than one resource exists under that name, the generated classes would be ambiguous, so it throws FlowableException 'Several JAXB binding definitions found for flowable-cxf'.","triggerScenarios":"Two or more JAXB binding files with the same classpath name (e.g. bundled by different jars or duplicated in the app's resources) present when Thread.currentThread().getContextClassLoader().getResources(...) returns multiple URLs during importFrom.","commonSituations":"Shading/uber-jars duplicating the binding resource; multiple flowable-cxf versions on the classpath; application code accidentally shipping a file at the same resource path; fat-jar build including resources twice.","solutions":["Find the duplicate jars with ClassLoader.getResources (print the enumeration) and remove/shade-exclude the extra copy.","Ensure only one flowable-cxf version is on the classpath (mvn dependency:tree / gradle dependencies).","Rename or relocate your own binding files so they don't collide with the flowable-cxf resource name."],"exampleFix":"<!-- before -->\n<dependency>org.flowable:flowable-cxf:6.7.2</dependency>\n<dependency>org.flowable:flowable-cxf:5.23.0</dependency>\n<!-- after: keep a single version -->\n<dependency>org.flowable:flowable-cxf:6.7.2</dependency>","handlingStrategy":"validation","validationCode":"Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(\"jaxb-bindings.xml\");\nList<URL> list = new ArrayList<>();\nwhile (urls.hasMoreElements()) list.add(urls.nextElement());\nif (list.size() > 1) throw new IllegalStateException(\"Duplicate JAXB binding resources: \" + list);","typeGuard":null,"tryCatchPattern":"try {\n    importer.importFrom(wsdlUrl);\n} catch (FlowableException e) {\n    if (e.getMessage().contains(\"Several JAXB binding definitions\")) {\n        // inspect classpath for duplicate jars\n    }\n}","preventionTips":["Run mvn dependency:tree to catch duplicate/conflicting flowable-cxf versions.","Exclude duplicate resources in shade/assembly configs.","Never ship your own file at the flowable-cxf binding resource path."],"tags":["cxf","jaxb","classpath","duplicate-resource"],"backgroundTag":"conflicting-config-options","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}