You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Jo...@mail.sprint.com on 2002/10/09 19:53:43 UTC

still getting ExceptionInInitializerError -- schema validation w/SAX

I'm using Xerces binary [Xerces-J-bin.2.2.0.zip] -- with xercesImpl.jar 
& xmlParserAPIs.jar in the classpath.
I'm still getting the ExceptionInInitializerError (if you recall, I got 
the same whilst using the Xerces-J-tools.2.2.0.zip package a few days 
ago, and when I switched to Xerces-J-bin.1.4.4.zip, the error went 
away, but others appeared.  Well, I realized that I really wanted 
2.2.0, and switched, leading me back to the current problem.

Please help if possible.
I've racked my brain for a week, and am getting dizzy.  I know that 
it's almost certainly a stupid mistake on my part.

Thank you greatly.

Here's the code, and the output:
...
import org.xml.sax.*;
import org.xml.sax.helpers.*;

import javax.xml.parsers.*;
import org.apache.xerces.jaxp.*;
//import org.apache.xerces.parsers.*;

public abstract class TypeHandler extends DefaultHandler
{
    private String FLAG_VALIDATE = 
"http://xml.org/sax/features/validation";
    private String FLAG_SCHEMA = 
"http://apache.org/xml/features/validation/schema";
    
    private String JAXP_SCHEMA_LANGUAGE = 
"http://java.sun.com/xml/jaxp/properties/schemaLanguage";
    private String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
    
    private String schemaSource = "";
    private String JAXP_SCHEMA_SOURCE = 
"http://java.sun.com/xml/jaxp/properties/schemaSource";
    private String NNS_SCEMA_LOCATION_PROP = 
"http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocat
ion";
    
    public void parse( String filename ) throws java.io.IOException, 
org.xml.sax.SAXException, org.xml.sax.SAXParseException
    {
        try
        {
            log.debug( "file:" + filename );
            InputStream in = new BufferedInputStream(new 
FileInputStream( filename ));
            InputSource source = new InputSource( in );
            
            SAXParserFactory spf = SAXParserFactory.newInstance();
            System.out.println(spf);
            
            spf.setNamespaceAware( true );
            spf.setValidating( true );
            
            SAXParser sp = spf.newSAXParser();
            System.out.println(sp);
            
            sp.getXMLReader().setFeature(FLAG_VALIDATE, true);
            sp.getXMLReader().setFeature(FLAG_SCHEMA, true);

            sp.setProperty( 
"http://java.sun.com/xml/jaxp/properties/schemaLanguage", 
"http://www.w3.org/2001/XMLSchema" );
            
            sp.setProperty( 
"http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocat
ion", "file:///c:/!dev/omni/xml/IesVendor.xsd");
            
            log.info( "parse started." );
            sp.parse( source, this );
            log.info( "parse complete." );
        }
        catch( Throwable t )
        {
            log.warn( t.toString() );
            t.printStackTrace();
        }
    }
}

----------


0  INFO [main] (OmniLoader.java:70) - *** starting omni loader ***
10  INFO [main] (OmniLoader.java:76) - loading configuration file...
1151  INFO [main] (OmniLoader.java:154) - initializing database settings
3304  INFO [main] (OmniLoader.java:191) - initializing omni types 
settings
3555  INFO [main] (OmniLoader.java:254) - initializing process script 
settings
3565 DEBUG [main] (TypeHandler.java:67) - 
file:c:/!dev/omni/xml/delta.vendor.xml
org.apache.xerces.jaxp.SAXParserFactoryImpl@76cad3
org.apache.xerces.jaxp.SAXParserImpl@325b9d
9674  INFO [main] (TypeHandler.java:115) - parse started.
12778  WARN [main] (TypeHandler.java:127) - 
java.lang.ExceptionInInitializerError
java.lang.ExceptionInInitializerError: java.lang.RuntimeException: 
internal error
        at 
org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl.applyFacets1(Unknown 
Source)
        at 
org.apache.xerces.impl.dv.xs.SchemaDVFactoryImpl.createBuiltInTypes(Unkn
own Source)
        at 
org.apache.xerces.impl.dv.xs.SchemaDVFactoryImpl.<clinit>(Unknown 
Source)
        at java.lang.Class.newInstance0(Native Method)
        at java.lang.Class.newInstance(Class.java:237)
        at org.apache.xerces.util.ObjectFactory.newInstance(Unknown 
Source)
        at 
org.apache.xerces.impl.dv.SchemaDVFactory.getInstance(Unknown Source)
        at 
org.apache.xerces.impl.dv.SchemaDVFactory.getInstance(Unknown Source)
        at 
org.apache.xerces.impl.xs.SchemaGrammar$BuiltinSchemaGrammar.<init>(Unkn
own Source)
        at org.apache.xerces.impl.xs.SchemaGrammar.<clinit>(Unknown 
Source)
        at org.apache.xerces.impl.xs.XMLSchemaValidator.<init>(Unknown 
Source)
        at 
org.apache.xerces.parsers.IntegratedParserConfiguration.configurePipelin
e(Unknown Source)
        at org.apache.xerces.parsers.DTDConfiguration.reset(Unknown 
Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown 
Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown 
Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown 
Source)
        at javax.xml.parsers.SAXParser.parse(Unknown Source)
        at 
com.sprint.ltd.nida.omni.types.TypeHandler.parse(TypeHandler.java:116)
        at com.sprint.ltd.nida.omni.OmniLoader.main(OmniLoader.java:113)

/**
 * john joseph roets
 * compuware corporation
 * sprint ltd
 * 913.345.6234
 * john.j.roets@mail.sprint.com [mailto:john.j.roets@mail.sprint.com]
 */ 


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org