在我的代码中,我有以下代码片段:
import org.codehaus.stax2.validation.XMLValidationSchema;
import org.codehaus.stax2.validation.XMLValidationSchemaFactory;
public class MyClass
{
[...]
public void myMethod()
{
XMLValidationSchemaFactory sf = XMLValidationSchemaFactory.
newInstance(XMLValidationSchema.SCHEMA_ID_W3C_SCHEMA);
}
[...]
}
当我运行它时,会出现以下错误:
javax.xml.stream.FactoryConfigurationError: No XMLValidationSchemaFactory
implementation class specified or accessible (via system property
'org.codehaus.stax2.validation.XMLValidationSchemaFactory.w3c', or
service definition under
'META-INF/services/org.codehaus.stax2.validation.XMLValidationSchemaFactory.w3c')
at org.codehaus.stax2.validation.XMLValidationSchemaFactory.
newInstance(XMLValidationSchemaFactory.java:226)
at org.codehaus.stax2.validation.XMLValidationSchemaFactory.
newInstance(XMLValidationSchemaFactory.java:116)
我该如何解决?