3
使用MyBatis的獨立(Atlassian的JIRA插件(OSGi的)environmnent)XPathFactoryImpl未找到錯誤(使用的MyBatis)
發生了下列錯誤。
[INFO] [talledLocalContainer] org.apache.ibatis.exceptions.PersistenceException:
[INFO] [talledLocalContainer] ### Error building SqlSession.
[INFO] [talledLocalContainer] ### Cause: java.lang.RuntimeException: XPathFactory#newInstance() failed to create an XPathFactory for the default o
bject model: http://java.sun.com/jaxp/xpath/dom with the XPathFactoryConfigurationException: javax.xml.xpath.XPathFactoryConfigurationException: java.
util.ServiceConfigurationError: javax.xml.xpath.XPathFactory: Provider org.apache.xpath.jaxp.XPathFactoryImpl not found
[INFO] [talledLocalContainer] ### Cause: java.lang.RuntimeException: XPathFactory#newInstance() failed to create an XPathFactory for the default object model: http://java.sun.com/jaxp/xpath/dom with the XPathFactoryConfigurationException:javax.xml.xpath.XPathFactoryConfigurationException: java.util.ServiceConfigurationError: javax.xml.xpath.XPathFactory: Provider org.apache.xpath.jaxp.XPathFactoryImpl not found
源代碼
static {
try {
// set SessionFactory
if (MyBatisConnectionFactory.sqlSessionFactory == null) {
MyBatisConnectionFactory.sqlSessionFactory = new SqlSessionFactoryBuilder().build(Resources.getResourceAsStream("/mybatisConfig.xml"));
}
} catch (final Exception e) {
MyBatisConnectionFactory.LOGGER.error(e.getMessage());
} finally {
}
}
當添加的Xalan,會出現以下錯誤。
Caused by: java.lang.ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to javax.xml.parsers.DocumentBuilderFactory
在純Java應用程序環境中沒有發生此錯誤。
我不知道爲什麼會出現這個錯誤。
請幫幫我。
謝謝。
代碼正在使用servicelocator來查找要使用的實現。顯然,jar不在類路徑中 – MeBigFatGuy