Skip to content

Instantly share code, notes, and snippets.

@jgraglia
Created March 25, 2013 07:57
Show Gist options
  • Save jgraglia/5235552 to your computer and use it in GitHub Desktop.
Save jgraglia/5235552 to your computer and use it in GitHub Desktop.
Can't configure port of ldap-server of security namespace with a property : xml schema require a "xs:positiveInteger"
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:c="http://www.springframework.org/schema/c"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<context:property-placeholder location="classpath:ldap-test-server.properties" ignore-resource-not-found="true" />
<bean id="ldapPortBean" class="java.lang.Integer"><constructor-arg><value>${ldap.port:9389}</value></constructor-arg></bean>
<security:ldap-server root="o=mojo" ldif="classpath:test.ldif"
manager-dn="cn=manager" manager-password="netc"
port="${ldap.port}"/>
</beans>
@jgraglia
Copy link
Author

the port="${ldap.port}" is not allowed by xml schema as it require port to be an type="xs:positiveInteger"

@jgraglia
Copy link
Author

Error thrown :
Caused by: org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.1 : '${ldap.port}' n'est pas une valeur valide pour 'integer'.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198) ~[na:1.7.0_07]
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134) ~[na:1.7.0_07]
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437) ~[na:1.7.0_07]
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368) ~[na:1.7.0_07]
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325) ~[na:1.7.0_07]
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:453) ~[na:1.7.0_07]
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3232) ~[na:1.7.0_07]
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processOneAttribute(XMLSchemaValidator.java:2827) ~[na:1.7.0_07]
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processAttributes(XMLSchemaValidator.java:2764) ~[na:1.7.0_07]
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:2051) ~[na:1.7.0_07]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment