문제

My web service, living on Axis2 inside a WSO2 WSAS application server, contains the following code:

String prop = "javax.xml.transform.TransformerFactory";
String val = "net.sf.saxon.TransformerFactoryImpl";

public static TransformerFactory getTransformerFactory() {
    System.setProperty(prop, val); // This line executes normally
    return TransformerFactory.newInstance(); // Error occurs inside this call
}

When run, the service produces this error:

[2013-04-15 12:22:41,263] ERROR
  {org.apache.axis2.transport.base.threads.NativeWorkerPool} -  Uncaught
  exception
javax.xml.transform.TransformerFactoryConfigurationError: Provider
  net.sf.saxon.TransformerFactoryImpl not found
        at javax.xml.transform.TransformerFactory.newInstance(Unknown Source)
        at com.example.Setup.getTransformerFactory(Setup.java:40)
        at com.example.ProcessFiles.init(ProcessFiles.java:336)
        at com.example.TorgApp.incoming(TorgApp.java:229)
        ...

I do have Saxon-HE-9.4.jar in my classpath, and it is readable. It is also available to Axis2 (/foo/bar/wso2as/wso2as-4.0.0/tmp/axis2-tmp-6436419317930731973.tmp/axis67573163200472779114Saxon-HE-9.4.jar).

According to the Javadoc for newInstance(), the system property I'm setting should overrule all other methods of identifying which TransformerFactory to use, so precedence is not the issue.

What could be causing this error, and what can I do to get my desired Saxon transformer factory?

도움이 되었습니까?

해결책

If axis2 (which seems to be the cause of the exception) is placed outside your web application then you must also make Saxon available there too.

Most application servers have a predefined location where jar files can be placed for exactly this purpose. It will not be enough just to deploy it in your web application.

다른 팁

This seems to be a class loading issue. Have you followed this documentation. http://docs.wso2.org/wiki/display/AS510/Webapp+ClassLoading

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top