- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我继承了一个旧的(15 年)Java 应用程序,该应用程序维护得很差。 Mavenizing 没有正确完成,所以我确实尝试了一下,因为很多库都是手动添加到类路径中的。现在我有一个主 pom,它在 pom 文件中包含所有库作为依赖项。
错误如下:
Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Unknown attribute http://javax.xml.XMLConstants/property/accessExternalDTD
但是现在我在启动网络服务时遇到了一些解析器问题。旧项目使用 SaxParser for XML,但它也使用 Spring,我在初始化 bean 时看到冲突。
我已经升级到 Java 8(也在 Liberty Profile 上运行,因为我们通过 IBM JDK 8 绑定(bind)到 IBM)。添加了 jaxp-api 以获取类路径上的“accessExternalDTD”属性。删除了 xerces 实现(也从 xalan 依赖项中排除),但没有任何作用。
[err] JAXP: find factoryId=javax.xml.parsers.DocumentBuilderFactory
[err] JAXP: found service provider by ServiceLoader, value=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
2019-01-21 11:18:35 DEBUG CalculationExecutor:186 - 0.000 CalculationExecutor.new: begin
2019-01-21 11:18:35 DEBUG Loader:50 - Trying to find [project-calculationKernel.xml] using context classloader: com.ibm.ws.classloading.internal.ThreadContextClassLoader@c5d35d81.
2019-01-21 11:18:35 DEBUG Loader:56 - Found: wsjar:file:/C:/LogFiles/Tools/wlp-webProfile8-java8-win-x86_64-18.0.0.4/wlp/usr/servers/Server18.0.0.4/apps/expanded/CreditRiskWebServicesEAR.ear/CreditRiskWebServices.war/WEB-INF/lib/RiskRatingCalculation-17.0.48-SNAPSHOT.jar!/project-calculationKernel.xml
2019-01-21 11:18:35 INFO BaseCastorMappingMarshaller:33 - Castor version used by Castor Mapping Marshaller: 1.2 [0]
2019-01-21 11:18:35 DEBUG Loader:50 - Trying to find [castorMapping-projectConfiguration.xml] using context classloader: com.ibm.ws.classloading.internal.ThreadContextClassLoader@c5d35d81.
2019-01-21 11:18:35 DEBUG Loader:56 - Found: wsjar:file:/C:/LogFiles/Tools/wlp-webProfile8-java8-win-x86_64-18.0.0.4/wlp/usr/servers/Server18.0.0.4/apps/expanded/CreditRiskWebServicesEAR.ear/CreditRiskWebServices.war/WEB-INF/lib/CalculationKernelSE-17.0.48-SNAPSHOT.jar!/castorMapping-projectConfiguration.xml
[err] JAXP: find factoryId=javax.xml.parsers.SAXParserFactory
[err] JAXP: found service provider by ServiceLoader, value=org.apache.xerces.jaxp.SAXParserFactoryImpl
[err] JAXP: find factoryId=javax.xml.parsers.SAXParserFactory
[err] JAXP: found service provider by ServiceLoader, value=org.apache.xerces.jaxp.SAXParserFactoryImpl
2019-01-21 11:18:35 DEBUG CalculationExecutor:186 - 0.00691 CalculationExecutor.new: end
[err] JAXP: find factoryId=javax.xml.parsers.DocumentBuilderFactory
[err] JAXP: found service provider by ServiceLoader, value=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
[err] JAXP: find factoryId=javax.xml.transform.TransformerFactory
[err] Warning: external object model net.sf.saxon.dom.DOMEnvelope has been loaded, but is not an instance of net.sf.saxon.om.ExternalObjectModel
[err] Warning: external object model net.sf.saxon.dom.DOMObjectModel has been loaded, but is not an instance of net.sf.saxon.om.ExternalObjectModel
[err] JAXP: found service provider by ServiceLoader, value=net.sf.saxon.TransformerFactoryImpl
[ERROR ] SRVE0283E: Exception caught while initializing context: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'soapRiskApprovalService' defined in ServletContext resource [/WEB-INF/applicationContext-creditRiskWebServices.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Unknown attribute http://javax.xml.XMLConstants/property/accessExternalDTD
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1745)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$136.00000000124ED300.getObject(Unknown Source)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:400)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:291)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:2376)
at [internal classes]
Caused by: java.lang.IllegalArgumentException: Unknown attribute http://javax.xml.XMLConstants/property/accessExternalDTD
at net.sf.saxon.Configuration.setConfigurationProperty(Configuration.java:2185)
at net.sf.saxon.TransformerFactoryImpl.setAttribute(TransformerFactoryImpl.java:342)
at org.springframework.xml.transform.TransformerFactoryUtils.defaultSettings(TransformerFactoryUtils.java:56)
at org.springframework.xml.transform.TransformerFactoryUtils.newInstance(TransformerFactoryUtils.java:32)
at org.springframework.xml.transform.TransformerHelper.newTransformerFactory(TransformerHelper.java:88)
at org.springframework.xml.transform.TransformerHelper.getTransformerFactory(TransformerHelper.java:104)
at org.springframework.xml.transform.TransformerHelper.createTransformer(TransformerHelper.java:119)
at org.springframework.xml.transform.TransformerHelper.transform(TransformerHelper.java:131)
at org.springframework.xml.transform.TransformerObjectSupport.transform(TransformerObjectSupport.java:96)
at org.springframework.ws.wsdl.wsdl11.provider.InliningXsdSchemaTypesProvider.getSchemaElement(InliningXsdSchemaTypesProvider.java:113)
at org.springframework.ws.wsdl.wsdl11.provider.InliningXsdSchemaTypesProvider.addTypes(InliningXsdSchemaTypesProvider.java:101)
at org.springframework.ws.wsdl.wsdl11.ProviderBasedWsdl4jDefinition.afterPropertiesSet(ProviderBasedWsdl4jDefinition.java:234)
at org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition.afterPropertiesSet(DefaultWsdl11Definition.java:183)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1804)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1741)
... 15 more
我用谷歌搜索了很多,但我找不到任何可以让这个旧应用程序启动的方法。希望有人遇到同样的问题,并能指导我如何处理这个问题。
最佳答案
您的问题似乎与 SWS-1049 有关,在spring-ws 3.0.6.RELEASE中引入。您需要改用 3.0.7.BUILD-SNAPSHOT。
关于java - 创建 Spring bean 时未知属性 accessExternalDTD,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54288266/
出于安全原因,我添加了声明: transformerFactory.setFeature("http://javax.xml.XMLConstants/property/accessExternalD
我继承了一个旧的(15 年)Java 应用程序,该应用程序维护得很差。 Mavenizing 没有正确完成,所以我确实尝试了一下,因为很多库都是手动添加到类路径中的。现在我有一个主 pom,它在 po
我将 logback 与 groovy 一起使用,并在解析 xml 时出现大量警告。我知道导致此问题的 JDK1.7_u45 中的错误。 Warning: org.apache.xerces.par
我想在我的项目中防止 XXE 攻击。它是旧的 api 项目,运行在 java 7(无 maven)和 jboss-as-7 服务器上。但在执行过程中我收到错误:org.xml.sax.SAXNotRe
尝试在我的应用程序中添加 apache-cxf 包。但是在运行应用程序时出现以下错误 实例化失败 [org.springframework.ws.server.endpoint.mapping.Pay
我是一名优秀的程序员,十分优秀!