Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7694147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:15:10+00:00 2026-05-31T21:15:10+00:00

My project has a JAXWS class where an XSD is read and finally validated

  • 0

My project has a JAXWS class where an XSD is read and finally validated in another method.

Here is the java code where they read the XSD

private static final ThreadLocal <DocumentBuilder> parser =
            new ThreadLocal <DocumentBuilder> () {
                   @Override protected DocumentBuilder initialValue() {
                             DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
                             SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
                             // loading Schema file
                             //System.out.println("Hi .. am in parser");
                              DocumentBuilder parserBuilder = null;
                              if(finalXsd !=null){
                                logger.info("finalXsd FILE"+finalXsd);                          
                                Source schemaFile = new StreamSource(new File(finalXsd));

                                try{
                                    logger.info ("place-0") ;
                                    Schema schema = factory.newSchema(schemaFile);
                                    logger.info ("place-1") ;
                                    docBuilderFactory.setValidating(false); // true is used for DTD based validation, for schema validation set to false
                                    logger.info ("place-2") ;
                                    docBuilderFactory.setSchema(schema);
                                    logger.info ("place-3") ;
                                    parserBuilder = docBuilderFactory.newDocumentBuilder();
                                    logger.info ("place-4") ;
                                    parserBuilder.setErrorHandler( new JythonResponseErrorHandler() );
                                    logger.info ("place-5") ;
                                }catch(SAXException s)                          
                                {   
                                    logger.error("SAXException in ThreadLocal.");
                                    s.printStackTrace() ;
                                    return null;
                                } catch (ParserConfigurationException e) {                              
                                    e.printStackTrace();
                                    logger.error("ParserConfigurationException in ThreadLocal.");
                                    return null;
                                }


                            }
                            return parserBuilder;

                   }
          };

XSD FILE (which the above code trying to read) :

<?xml version="1.0" encoding="UTF-8"?>

<!--W3C Schema generated by XMLSpy v2010 rel. 2 (http://www.altova.com) -->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="TAG">
        <xs:complexType>
            <xs:attribute name="name" use="required" type="xs:string" />
            <xs:attribute name="value" use="optional" type="xs:string" />
        </xs:complexType>
    </xs:element>

    <xs:element name="STRING">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="EN" />
                <xs:element ref="ES" />
            </xs:sequence>
            <xs:attribute name="name" use="required" type="xs:string">
            </xs:attribute>
        </xs:complexType>
    </xs:element>

    <xs:element name="FRACTION">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="N" />
                <xs:element ref="D" />
            </xs:sequence>
            <xs:attribute name="name" use="required" >
            </xs:attribute>
        </xs:complexType>
    </xs:element>

    <xs:element name="RESULTLIST">
        <xs:complexType> 
        <xs:sequence>
                 <xs:element ref="RESPONSE" maxOccurs="unbounded" />
        </xs:sequence> 
        </xs:complexType> 
    </xs:element>

    <xs:element name="RESPONSE">
        <xs:complexType mixed="true" >
                <xs:sequence>
                    <xs:any minOccurs="0" maxOccurs="unbounded"/>               
                </xs:sequence>      
        </xs:complexType>
    </xs:element>

    <xs:element name="PLURAL">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="STRING" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="NAME">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="STRING" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="INTEGER">
    </xs:element>

    <xs:element name="ID" type="xs:int">
    </xs:element>

    <xs:element name="GENDER">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="STRING" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="BOOL">
        <xs:complexType>
            <xs:simpleContent>
                <xs:extension base="xs:boolean">
                    <xs:attribute name="name" use="required" type="xs:string">
                    </xs:attribute>
                </xs:extension>
            </xs:simpleContent>
        </xs:complexType>
    </xs:element>

    <xs:element name="FILE_ID" type="xs:int">
    </xs:element>

    <xs:element name="ES" type="xs:string" />

    <xs:element name="EN" type="xs:string" />
    <xs:element name="N" type="xs:int" />   
    <xs:element name="D" type="xs:int" />
    <xs:element name="DICTIONARY">
        <xs:complexType mixed="true">
        <xs:choice>         
            <xs:any minOccurs="0" maxOccurs="unbounded"/>
        </xs:choice>    
            <xs:attribute name="name" use="required" type="xs:string">
            </xs:attribute>
        </xs:complexType>
    </xs:element>

    <xs:element name="ASSET">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="NAME" />
                <xs:element ref="PLURAL" />
                <xs:element ref="ALTTEXT" />
                <xs:element ref="GENDER" />
                <xs:element ref="ID" />
                <xs:element ref="FILE_ID" />
                <xs:element ref="DICTIONARY" maxOccurs="unbounded" />
            </xs:sequence>
            <xs:attribute name="name" use="required" >
            </xs:attribute>
        </xs:complexType>
    </xs:element>

    <xs:element name="ARRAY">
        <xs:complexType>
            <xs:choice>
                <xs:element ref="ARRAY" minOccurs="0" maxOccurs="unbounded" />
                <xs:element ref="STRING" minOccurs="0" maxOccurs="unbounded"/>
                <xs:element ref="ASSET"  maxOccurs="unbounded"/>
                <xs:element ref="INTEGER" minOccurs="0" maxOccurs="unbounded"/>
                <xs:element ref="FRACTION" minOccurs="0" maxOccurs="unbounded"/>
                <xs:element ref="DICTIONARY" minOccurs="0" maxOccurs="unbounded"/>
            </xs:choice>
            <xs:attribute name="name" use="required" type="xs:string">
            </xs:attribute>
        </xs:complexType>
    </xs:element>

    <xs:element name="ALTTEXT">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="STRING" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>

</xs:schema>

while sending a response from SOAP-UI, the above code gets executed and throws below exception

org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'file:/D:/softwares/jboss-5.1.0.GA/server/default/deploy/poctest.war/WEB-INF/classes/final.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
     at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
     at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
     at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
     at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
     at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
     at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(Unknown Source)
     at org.apache.xerces.impl.xs.traversers.XSDHandler.getSchemaDocument(Unknown Source)
     at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown Source)
     at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source)
     at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
     at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
     at org.apache.xerces.jaxp.validation.XMLSchemaFactory.newSchema(Unknown Source)
     at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:594)
     at com.hmco.ssms.services.poc.SoarPocJaxWS$1.initialValue(SoarPocJaxWS.java:59)
     at com.hmco.ssms.services.poc.SoarPocJaxWS$1.initialValue(SoarPocJaxWS.java:46)
     at java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:141)
     at java.lang.ThreadLocal.get(ThreadLocal.java:131)
     at com.hmco.ssms.services.poc.SoarPocJaxWS.getParametersMultiple(SoarPocJaxWS.java:144)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at org.jboss.wsf.container.jboss50.invocation.InvocationHandlerJSE.invoke(InvocationHandlerJSE.java:108)
     at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:222)
     at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:474)
     at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:295)
     at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:205)
     at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:131)
     at org.jboss.wsf.common.servlet.AbstractEndpointServlet.service(AbstractEndpointServlet.java:85)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
     at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
     at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
     at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
     at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
     at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
     at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
     at java.lang.Thread.run(Thread.java:662)

I even tried changing XS to XSD in the xsd file. but stil i get this exception.

Please help me on this

Thanks
Arun

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T21:15:11+00:00Added an answer on May 31, 2026 at 9:15 pm

    Issue is fixed,

    This is because, in jboss-5 the files inside the WAR file cannot be read using getResource() and hence there were no proper file-binding SchemaFactory

    I changed the path of the file and now it is working cool !!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My Project has 2 java files (A.java and B.java in same package). A.java uses
My project has the need to build consistent urls similar to the ones here
My project has viewmodels labeled like this: public class locViewModel { [Required] public string
My project has a UIImage category function that I want to call from another
My project has multiple themes with different colors. I need to skin certain textboxes
The project has been working fine in 2003 but when opening it in 2008
A Project has multiple Tasks, which has multiple Assignments Projects (1-n) -> Tasks (1-n)
My project has a file foo that I've been using and checking in with
My project has a C++ library that I want to allow the user to
class Project has_many :pages end class Page belongs_to :project end @project = Project.first @project.pages.list_out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.