On May 27, 2008, at 2:42 AM, jfougere wrote:


I would like to know what exactly is done when schema validation is activated
in CXF
(ie : <entry key="schema-validation-enabled" value="true" /> ) ?

I am still having problem to turn on activation on server side but
validation by other means like external tools (xmlSpy) or Java5 Validator
API works fine.

Do you have any idea of the problem here ?


Any chance you can file a JIRA and attach a test case that demonstrates the problem? If I can get a full test case, it's a LOT easier to debug.

Dan




Thanks

Julien


jfougere wrote:

Hi Aaron, thanks for your answer.

I have several XSD's but there is no cyclic reference. In fact the first one import the second one who itself incude the third one. (The third one
does not include nether import another xsd).

Do you have another idea for the cause of this issue ? When I am doing
validation by code it works without problem...

Thanks

Julien


Aaron Pieper wrote:

It looks to me like Xerces is recursing trying to follow your XSD
imports. Do you have any XSDs that refer to eachother in a cycle?

- Aaron

-----Original Message-----
From: FOUGERE Julien (Prestataire) [mailto:[EMAIL PROTECTED] ]
Sent: Monday, May 19, 2008 3:49 AM
To: [EMAIL PROTECTED]
Subject: Problem with schema validation (JAX-WS & JAXB)

Hi, I am currently experiencing problem to set up server side schema
validation. I have a JAX-WS frontend webservice and JAXB databinding.

When I turn schema validation on, I get a stack overflow error. It really
looks like that xerces is running on an infinite loop....



Here is my cxf-servlet.xml file :



<?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:jaxws="http://cxf.apache.org/jaxws";

     xmlns:soap="http://cxf.apache.org/bindings/soap";

     xsi:schemaLocation="

http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-2.0.xsd

http://cxf.apache.org/bindings/soap

http://cxf.apache.org/schemas/configuration/soap.xsd

http://cxf.apache.org/jaxws

http://cxf.apache.org/schemas/jaxws.xsd";>



   <jaxws:endpoint

       id="BrmService"

       implementor="fr.service.pivot.BrmServiceImpl"

       wsdlLocation="WEB-INF/wsdl/BrmAsyncServices.wsdl"

       address="/BrmService">

<!--Below is optional; logs SOAP requests/responses to servlet
container

             output log (for Tomcat: logs/catalina.out)-->

       <jaxws:features>

           <bean class="org.apache.cxf.feature.LoggingFeature"/>

       </jaxws:features>

        <jaxws:properties>

           <entry key="schema-validation-enabled" value="true" />

       </jaxws:properties>

   </jaxws:endpoint>

</beans>



Here is the stack trace :



GRAVE: "Servlet.service()" pour la servlet WebServicePort a généré une
exception

java.lang.StackOverflowError

           at java.util.zip.ZipFile.getEntry(Unknown Source)

           at java.util.jar.JarFile.getEntry(Unknown Source)

           at java.util.jar.JarFile.getJarEntry(Unknown Source)

           at sun.misc.URLClassPath$JarLoader.getResource(Unknown
Source)

           at sun.misc.URLClassPath$JarLoader.findResource(Unknown
Source)

           at sun.misc.URLClassPath.findResource(Unknown Source)

           at java.net.URLClassLoader$2.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

           at java.net.URLClassLoader.findResource(Unknown Source)

           at java.lang.ClassLoader.getResource(Unknown Source)

           at java.lang.ClassLoader.getResource(Unknown Source)

           at java.lang.ClassLoader.getResource(Unknown Source)

at java.lang.ClassLoader.getResourceAsStream(Unknown Source)

           at
org .apache .catalina .loader .WebappClassLoader.getResourceAsStream(WebappClassLoader.java:1176)

           at
com .sun .org.apache.xalan.internal.xsltc.dom.SecuritySupport12$6.run(Unknown
Source)

at java.security.AccessController.doPrivileged(Native Method)

           at
com .sun .org .apache .xalan .internal.xsltc.dom.SecuritySupport12.getResourceAsStream(Unknown
Source)

           at
com .sun .org .apache .xalan .internal.xsltc.dom.ObjectFactory.findJarServiceProviderName(Unknown
Source)

           at
com .sun .org .apache .xalan .internal.xsltc.dom.ObjectFactory.lookUpFactoryClassName(Unknown
Source)

           at
com .sun .org .apache .xalan.internal.xsltc.dom.ObjectFactory.lookUpFactoryClass(Unknown
Source)

           at
com .sun .org .apache .xalan.internal.xsltc.dom.XSLTCDTMManager.getDTMManagerClass(Unknown
Source)

           at
com .sun .org .apache .xalan.internal.xsltc.trax.TransformerFactoryImpl.<init>(Unknown
Source)

           at
sun.reflect.GeneratedConstructorAccessor45.newInstance(Unknown Source)

           at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

at java.lang.reflect.Constructor.newInstance(Unknown Source)

           at java.lang.Class.newInstance0(Unknown Source)

           at java.lang.Class.newInstance(Unknown Source)

           at javax.xml.transform.FactoryFinder.newInstance(Unknown
Source)

           at javax.xml.transform.FactoryFinder.find(Unknown Source)

at javax.xml.transform.TransformerFactory.newInstance(Unknown
Source)

           at
org.apache.cxf.wsdl.EndpointReferenceUtils $ SchemaLSResourceResolver .getSchemaAsStream(EndpointReferenceUtils.java:110)

           at
org.apache.cxf.wsdl.EndpointReferenceUtils $ SchemaLSResourceResolver .resolveResource(EndpointReferenceUtils.java:125)

           at
com .sun .org .apache .xerces.internal.util.DOMEntityResolverWrapper.resolveEntity(Unknown
Source)

           at
com .sun .org .apache.xerces.internal.impl.XMLEntityManager.resolveEntity(Unknown
Source)

           at
com .sun .org .apache .xerces.internal.impl.xs.XMLSchemaLoader.resolveDocument(Unknown
Source)

           at
com .sun .org .apache .xerces.internal.impl.xs.traversers.XSDHandler.resolveSchema(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)

           at
com .sun .org .apache .xerces .internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown
Source)





When schema validation is turned off, everything works well. I can also get the schema validation working with external tools like (xmlSpy) or
this kind of code :



 //Validation

             in = new FileInputStream(requestFile);

             SchemaFactory schemaFactory =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);

             Schema schema = schemaFactory.newSchema(new
StreamSource(new File("xsd/EAI.xsd")));

             Validator validator = schema.newValidator();

             validator.validate(new StreamSource(in));



So it seems that my XSD file is valid.





May be I'm not using the right way to activate server side schema
validation. Thanks to everyone who can help me.





Julien






--
View this message in context: 
http://www.nabble.com/Problem-with-schema-validation-%28JAX-WS---JAXB%29-tp17319174p17484086.html
Sent from the cxf-user mailing list archive at Nabble.com.


---
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog




Reply via email to