我在Liferay上部署了一个portlet,它有webservice调用并且正在使用内部轴库。调用Web服务时,我收到以下错误
引起:java.util.ServiceConfigurationError:javax.xml.stream.XMLInputFactory:Provider com.ctc.wstx.stax.WstxInputFactory not a subtype
我查了各种其他帖子
我分析了误差线,将其分为两部分
并得出结论,错误是由于Stax Implementation不匹配造成的。
我看到WstxInputFactory存在于woodstox-core-asl-4.1.4
要查看此jar添加的位置,我检查了build.gradle
buildscript {
repositories {
maven {
url "https://cdn.lfrs.sl/repository.liferay.com/nexus/content/groups/public"
}
}
dependencies {
classpath group: "com.liferay", name: "com.liferay.gradle.plugins.css.builder", version: "2.0.0"
}
}
apply plugin: "com.liferay.css.builder"
dependencies {
def withoutServletAPI = {
exclude group: 'javax.servlet', module: 'servlet-api'
}
compile group: "org.springframework", name: "spring-webmvc-portlet", version: "4.1.5.RELEASE"
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.6.0"
compileOnly group: "javax.portlet", name: "portlet-api", version: "2.0"
compileOnly group: "javax.servlet", name: "javax.servlet-api", version: "3.0.1"
compileOnly group: "org.osgi", name: "org.osgi.service.component.annotations", version: "1.3.0"
compile group: "org.apache.axis", name:"axis", version: "1.4"
compile group: "org.apache.axis2", name:"axis2-adb", version: "1.6.3", withoutServletAPI
compile group: "org.apache.axis2", name:"axis2-transport-local", version: "1.6.3", withoutServletAPI
compile group: "org.apache.axis2", name:"axis2-transport-http", version: "1.6.3", withoutServletAPI
compile group: "com.google.code.gson", name:"gson", version: "2.3.1"
compile group: "jstl", name:"jstl", version: "1.2"
compile group: "taglibs", name:"standard", version: "1.1.2"
//compile group: "memberservice", name:"memberservice", version: "1.0.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.util.java", version: "2.4.0"
//compile group: "com.sun.xml.ws", name: "jaxws-rt", version: "2.2.10"
testCompile group: 'junit', name: 'junit', version: '4.8.1'
testCompile group: 'org.mockito', name: 'mockito-all', version: '1.9.5'
compile files('../../modules/memberservice/build/libs/memberservice-1.0.0.jar')
}
war {
dependsOn buildCSS
exclude "**/*.scss"
filesMatching("**/.sass-cache/") {
it.path = it.path.replace(".sass-cache/", "")
}
includeEmptyDirs = false
}
我在gradle中检查了依赖树,发现woodstox-core-asl-4.1.4是对于build2grad中的axis2-adb-1.6.3的传递依赖。
显然jar中存在一些冲突导致上述错误,但我无法找到导致它的jar。我怀疑JDK 8已经有了XMLInputFactory,在我的战争中,我看到geronimo-stax-api又是一个传递依赖,可能会导致冲突。
我正在寻找实际导致问题的原因。
注意:此代码不是由我创建的。我的客户已经提供了这个代码,该代码在JBoss上的旧版Liferay(6.2)上运行,由不同的供应商创建,我们正在Tomcat上迁移到更新版本的Liferay(DXP)。
PS:我还检查过Tomcat的lib目录,那里也没有stax实现
答案 0 :(得分:-1)
I have a similar issue. When upgraded portlet is deployed, spring application boots up successfully. When attempted to view a portlet page, this error occurs.
2018-08-29 14:31:50.955 ERROR [http-nio-8080-exec-8][render_portlet_jsp:131] null
java.util.ServiceConfigurationError: javax.xml.parsers.SAXParserFactory: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not a subtype
at java.util.ServiceLoader.fail(ServiceLoader.java:239)
at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at javax.xml.parsers.FactoryFinder$1.run(FactoryFinder.java:294)
at javax.xml.parsers.FactoryFinder.findServiceProvider(FactoryFinder.java:289)
at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:267)
at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:127)
at org.apache.taglibs.standard.tlv.JstlBaseTLV.validate(JstlBaseTLV.java:194)
at org.apache.taglibs.standard.tlv.JstlCoreTLV.validate(JstlCoreTLV.java:138)
at org.apache.jasper.compiler.TagLibraryInfoImpl.validate(TagLibraryInfoImpl.java:957)
at org.apache.jasper.compiler.Validator.validateXmlView(Validator.java:1929)
at org.apache.jasper.compiler.Validator.validate(Validator.java:1896)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:223)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:625)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:473)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:377)