-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: JSR-303 file locations
PostPosted: Sun Feb 12, 2012 12:51 pm 
Newbie

Joined: Tue Nov 30, 2010 2:48 pm
Posts: 4
I am using XML configuration of Hibernate Validator. I figured out that the validation.xml has to be in a META-INF directory (by the way, your documentation says "If this file exists in the classpath its configuration will be applied", which is not true - if it isn't in a META-INF subdirectory off the classpath, it won't be found, which is right according to the spec).

However, I'm trying to refer to other configuration files and the Validator is failing. My physical setup is:

WEB-INF
|
|---classes
|
|---META-INF
|---validation.xml
|---SystemProperty-constraints.xml
...

In validation.xml, I am using:

<validation-config xmlns="http://jboss.org/xml/ns/javax/validation/configuration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/configuration">
<constraint-mapping>META-INF/SystemProperty-constraints.xml</constraint-mapping>
</validation-config>

I have tried:

SystemProperty-constraints.xml
/SystemProperty-constraints.xml
META-INF/SystemProperty-constraints.xml
/META-INF/SystemProperty-constraints.xml
WEB-INF/classes/META-INF/SystemProperty-constraints.xml

all to no avail. I get the same error each time:

Caused by: javax.validation.ValidationException: Unable to open input stream for mapping file META-INF/SystemProperty-constraints.xml.
at org.hibernate.validator.xml.ValidationXmlParser.setMappingStreamsFromXml(ValidationXmlParser.java:118)
at org.hibernate.validator.xml.ValidationXmlParser.parseValidationXml(ValidationXmlParser.java:67)
at org.hibernate.validator.engine.ConfigurationImpl.parseValidationXml(ConfigurationImpl.java:261)
at org.hibernate.validator.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:148)
at org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.afterPropertiesSet(LocalValidatorFactoryBean.java:219)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
... 20 more

I'm using Tomcat 7.0.11 with an exploded WAR file and Java 6.

Anyone have any ideas about what I am missing? Does this simply not work?

Best wishes to everyone and thanks in advance for any help you might be able to give me.


Top
 Profile  
 
 Post subject: Re: JSR-303 file locations
PostPosted: Sun Feb 12, 2012 12:53 pm 
Newbie

Joined: Tue Nov 30, 2010 2:48 pm
Posts: 4
I see I entered the details wrong about the physical location:

Code:
WEB-INF
|
|---classes
      |
      |---META-INF
            |---validation.xml
            |---SystemProperty-constraints.xml


Wasn't quite sure how to use the "Code" button.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.