{"record":{"id":"e8889c98d0fb40c0","repo":"mybatis/mybatis-3","slug":"the-properties-element-cannot-specify-both-a-url-a","errorCode":null,"errorMessage":"The properties element cannot specify both a URL and a resource based property file reference.  Please specify one or the other.","messagePattern":"The properties element cannot specify both a URL and a resource based property file reference\\.  Please specify one or the other\\.","errorType":"validation","errorClass":"BuilderException","httpStatus":null,"severity":"error","filePath":"src/main/java/org/apache/ibatis/builder/xml/XMLConfigBuilder.java","lineNumber":245,"sourceCode":"  }\n\n  private void reflectorFactoryElement(XNode context) throws Exception {\n    if (context != null) {\n      String type = context.getStringAttribute(\"type\");\n      ReflectorFactory factory = (ReflectorFactory) resolveClass(type).getDeclaredConstructor().newInstance();\n      configuration.setReflectorFactory(factory);\n    }\n  }\n\n  private void propertiesElement(XNode context) throws Exception {\n    if (context == null) {\n      return;\n    }\n    Properties defaults = context.getChildrenAsProperties();\n    String resource = context.getStringAttribute(\"resource\");\n    String url = context.getStringAttribute(\"url\");\n    if (resource != null && url != null) {\n      throw new BuilderException(\n          \"The properties element cannot specify both a URL and a resource based property file reference.  Please specify one or the other.\");\n    }\n    if (resource != null) {\n      defaults.putAll(Resources.getResourceAsProperties(resource));\n    } else if (url != null) {\n      defaults.putAll(Resources.getUrlAsProperties(url));\n    }\n    Properties vars = configuration.getVariables();\n    if (vars != null) {\n      defaults.putAll(vars);\n    }\n    parser.setVariables(defaults);\n    configuration.setVariables(defaults);\n  }\n\n  private void settingsElement(Properties props) {\n    configuration\n        .setAutoMappingBehavior(AutoMappingBehavior.valueOf(props.getProperty(\"autoMappingBehavior\", \"PARTIAL\")));","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/mybatis/mybatis-3/blob/008069adb1b089579b5dcba87ee591908b263274/src/main/java/org/apache/ibatis/builder/xml/XMLConfigBuilder.java#L227-L263","documentation":"Error \"The properties element cannot specify both a URL and a resource based property file reference.  Please specify one or the other.\" thrown in mybatis/mybatis-3.","triggerScenarios":"Thrown at src/main/java/org/apache/ibatis/builder/xml/XMLConfigBuilder.java:245 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Keep only one of the url or resource attributes on the <properties> element and remove the other.","Move external properties into a single file referenced by either resource (classpath) or url (file system/URL)."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"008069adb1b089579b5dcba87ee591908b263274","analyzedAt":"2026-08-14T13:07:10.264Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}