Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning: Error parsing validation.xml when jax-rs #1087

Closed
anhdv1 opened this issue Sep 8, 2016 · 4 comments
Closed

Warning: Error parsing validation.xml when jax-rs #1087

anhdv1 opened this issue Sep 8, 2016 · 4 comments
Assignees

Comments

@anhdv1
Copy link

anhdv1 commented Sep 8, 2016

i create web app with : Bean validation ( use hibernateValidator 5.1.0) and Jax-RS , JEE7
when i display data the first .
it return Exception and it is only occured at the first. ( the scecond and more don't display this Exception)

Error parsing validation.xml the async way
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: URI is not hierarchical
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    at org.eclipse.persistence.jaxb.BeanValidationHelper.getConstraintsMap(BeanValidationHelper.java:139)
    at org.eclipse.persistence.jaxb.BeanValidationHelper.isConstrained(BeanValidationHelper.java:120)
    at org.eclipse.persistence.jaxb.JAXBBeanValidator.isConstrainedObject(JAXBBeanValidator.java:255)
    at org.eclipse.persistence.jaxb.JAXBBeanValidator.shouldValidate(JAXBBeanValidator.java:206)
    at org.eclipse.persistence.jaxb.JAXBMarshaller.validateAndTransformIfNeeded(JAXBMarshaller.java:587)
    at org.eclipse.persistence.jaxb.JAXBMarshaller.marshal(JAXBMarshaller.java:481)
    at org.eclipse.persistence.jaxb.rs.MOXyJsonProvider.writeTo(MOXyJsonProvider.java:957)
    at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265)

Caused by: java.lang.IllegalArgumentException: URI is not hierarchical
    at java.io.File.<init>(File.java:418)
    at org.eclipse.persistence.jaxb.ValidationXMLReader.parseValidationXML(ValidationXMLReader.java:152)
    at org.eclipse.persistence.jaxb.ValidationXMLReader.call(ValidationXMLReader.java:70)
    at org.eclipse.persistence.jaxb.ValidationXMLReader.call(ValidationXMLReader.java:1)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)

file validation.xml

<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 validation-configuration-1.1.xsd" version="1.1">
    <message-interpolator>com.util.ResourceMessageInterpolator</message-interpolator>
</validation-config>

i copy lib hibernate into payara_home/glassfish/lib

activation-1.1.jar
hibernate-jpa-2.1-api-1.0.0.Final.jar
hibernate-core-5.1.0.Final.jar
jboss-logging-3.3.0.Final.jar
javassist-3.20.0-GA.jar
antlr-2.7.7.jar
geronimo-jta_1.1_spec-1.1.1.jar
jandex-2.0.0.Final.jar
classmate-1.3.0.jar
dom4j-1.6.1.jar
xml-apis-1.0.b2.jar
hibernate-commons-annotations-5.0.1.Final.jar
hibernate-entitymanager-5.1.0.Final.jar
hibernate-validator-5.1.0.Final.jar
validation-api-1.1.0.Final.jar

Rest Application file

@ApplicationPath("/rest-api")
public class WSApplication extends Application{

    @Override
    public Set<Class<?>> getClasses() {
        Set<Class<?>> resources = new java.util.HashSet<>();
        // Add all needed 
        resources.add(UserWs.class);
        resources.add(UserSearchWs.class);
        return resources;
    }

    @Override
    public Set<Object> getSingletons() {
        final Set<Object> instances = new HashSet<Object>();
        return instances;
    }
}

i think that the cause is i am using HibernateValidator but in Payara 4.1.1.163, default is Eclipselink.
Thanks you.

@anhdv1 anhdv1 changed the title Warning: Error parsing validation.xml the async way java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: URI is not hierarchical at java.util.concurrent.FutureTask.report(FutureTask.java:122) Warning: Error parsing validation.xml when jax-rs Sep 13, 2016
@anaelcarvalho
Copy link

I'm not sure, but I think it's complaining about the schemaLocation in your validation.xml file... I'd try changing it to http://jboss.org/xml/ns/javax/validation/configuration/validation-configuration-1.1.xsd and check if it makes a difference.

@mikecroft mikecroft self-assigned this Oct 18, 2016
@mikecroft
Copy link
Contributor

As @anaelcarvalho said, it looks to be complaining about the URL in your XML file. In the sample you posted, there is a space in the URL. You also look to have tried to specify the file itself, which I don't think you should do based on the example in the docs.

Try changing from:

<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 validation-configuration-1.1.xsd" version="1.1">

to

<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" version="1.1">

@mikecroft
Copy link
Contributor

Hi @anhdv1 - have you tried with the corrected URL?

@mikecroft
Copy link
Contributor

Closing this as resolved. Please reopen if there's still a problem after making the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants