{"record":{"id":"3cef6c428f6bf400","repo":"nathanmarz/storm","slug":"found-multiple-name-resources-you-re-probably-bundling-the","errorCode":null,"errorMessage":"Found multiple ${name} resources. You're probably bundling the Storm jars with your topology jar. ${resources}","messagePattern":"Found multiple (.+?) resources\\. You're probably bundling the Storm jars with your topology jar\\. (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"storm-core/src/jvm/backtype/storm/utils/Utils.java","lineNumber":133,"sourceCode":"            List<URL> ret = new ArrayList<URL>();\n            while(resources.hasMoreElements()) {\n                ret.add(resources.nextElement());\n            }\n            return ret;\n        } catch(IOException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    public static Map findAndReadConfigFile(String name, boolean mustExist) {\n        try {\n            HashSet<URL> resources = new HashSet<URL>(findResources(name));\n            if(resources.isEmpty()) {\n                if(mustExist) throw new RuntimeException(\"Could not find config file on classpath \" + name);\n                else return new HashMap();\n            }\n            if(resources.size() > 1) {\n                throw new RuntimeException(\"Found multiple \" + name + \" resources. You're probably bundling the Storm jars with your topology jar. \"\n                  + resources);\n            }\n            URL resource = resources.iterator().next();\n            Yaml yaml = new Yaml();\n            Map ret = (Map) yaml.load(new InputStreamReader(resource.openStream()));\n            if(ret==null) ret = new HashMap();\n            \n\n            return new HashMap(ret);\n            \n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    public static Map findAndReadConfigFile(String name) {\n       return findAndReadConfigFile(name, true);\n    }","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/nathanmarz/storm/blob/cdb116e942666973bc4eaa0df098d5bab82739e7/storm-core/src/jvm/backtype/storm/utils/Utils.java#L115-L151","documentation":"findAndReadConfigFile throws this RuntimeException when the classpath search for the named config resource returns more than one URL. Storm refuses to guess which copy to load because duplicate Storm jars (or stray config resources) on the classpath make the effective configuration ambiguous.","triggerScenarios":"Utils.findAndReadConfigFile(name, ...) (or readDefaultConfig/readStormConfig) invoked while the classpath contains the same config resource (e.g. storm.yaml or defaults.yaml) in two or more locations — typically because the user's topology uber-jar bundles Storm's classes and resources alongside the Storm installation jars.","commonSituations":"Building an uber/fat jar with maven-shade that includes storm-core's defaults.yaml/storm.yaml; adding storm-core as a non-provided dependency in a topology project; manually copying storm jars into the topology lib directory; duplicate config files in multiple jar entries.","solutions":["Mark storm-core as <scope>provided</scope> (or exclude it) in your topology build so Storm's own jars supply the config resources exactly once.","Inspect the resource list printed in the exception message and remove the offending jar(s) from the classpath (e.g. delete the bundled copy from your topology jar).","Rebuild the uber jar with exclusion filters (maven-shade <excludes> or Gradle 'exclude group') that drop *.yaml from Storm packages.","As a last resort, keep a single canonical copy of the config resource in your jar and remove the duplicate elsewhere."],"exampleFix":"<!-- before: bundles Storm and its configs -->\n<dependency>\n  <groupId>org.apache.storm</groupId>\n  <artifactId>storm-core</artifactId>\n</dependency>\n<!-- after -->\n<dependency>\n  <groupId>org.apache.storm</groupId>\n  <artifactId>storm-core</artifactId>\n  <scope>provided</scope>\n</dependency>","handlingStrategy":"validation","validationCode":"Set<URL> hits = Utils.findResources(\"storm.yaml\");\nif (hits.size() > 1) {\n    throw new IllegalStateException(\"Duplicate storm.yaml on classpath: \" + hits + \" — unshade your topology jar\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    conf = Utils.readStormConfig();\n} catch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"Found multiple\")) {\n        throw new IllegalStateException(\"Uber jar bundles Storm resources; set storm-core to provided scope\", e);\n    }\n    throw e;\n}","preventionTips":["Always declare storm-core with provided scope in topology builds.","Configure maven-shade/Gradle to exclude Storm's defaults.yaml and storm.yaml from fat jars.","Run `jar tf mytopology.jar | grep -E '(storm|defaults)\\.yaml'` before deploying to catch duplicates.","Keep config resources in exactly one location — the Storm distribution, not application jars."],"tags":["classpath","configuration","jar-packaging","storm"],"backgroundTag":"conflicting-config-options","analyzedSha":"cdb116e942666973bc4eaa0df098d5bab82739e7","analyzedAt":"2026-09-12T14:30:00.714Z","contentChangedAt":"2026-09-12T14:30:00.714Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}