title: XSD SchemaFactory error - Java 6
body: <p>In the code below, I am trying to validate a XML. Everything works find when i run it from eclipse. When i deploy it on weblogic the code fails with error: "SAX Exception while processingsrc-resolve: Cannot resolve the name XX:sometag  to a(n) 'type definition' component."</p>
  
  <pre><code>SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
  System.out.println("schemaFactory -&gt; " + schemaFactory.getClass());
  Schema schema = schemaFactory.newSchema(resourceHandler.getXSDStreams());
  StreamSource xmlContent = new StreamSource(new StringReader(requestXML));
  Validator validator = schema.newValidator();
  validator.validate(xmlContent);
  </code></pre>
  
  <p>This is the output generated on eclipse for Schema Factory:
  schemaFactory -> class com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory</p>
  
  <p>On Weblogic the same code with the same JAR files gives the error mentioned above. The schemaFactory is exactly the same.</p>
  
  <p>Config - 2</p>
  
  <p>I tried setting the System property to load xerces files and added xerces to the classpath</p>
  
  <pre><code>String schemaFactoryProperty = "javax.xml.validation.SchemaFactory:" + XMLConstants.W3C_XML_SCHEMA_NS_URI;
  System.setProperty(schemaFactoryProperty,"org.apache.xerces.jaxp.validation.XMLSchemaFactory");  
  </code></pre>
  
  <p>Still the output for the schema factory remains the same: "schemaFactory -> class com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory" but this time the error changed to:</p>
  
  <pre><code>java.lang.IllegalArgumentException: Source parameter of type 'javax.xml.transform.stream.StreamSource' is not recognized this SchemaFactory.
      at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:203)
      at com.bt.asi.task.AffectedServiceTask.execute(AffectedServiceTask.java:47)
      at com.bt.asi.service.ASIJMSService.onMessage(ASIJMSService.java:30)
      at... 
  </code></pre>
  
  <p>I am on Java 6 and WLS 10.3.0 (Java 6) and using Spring framework.</p>