gpt4 book ai didi

java - 如何停止 Wildfly11 加载 jar 依赖 Web 服务

转载 作者:太空宇宙 更新时间:2023-11-04 10:28:54 25 4
gpt4 key购买 nike

我需要一些帮助来防止 Wildfly11 自动加载 jar 依赖项中用 @WebServiceProvider 注释的类。

依赖项是第 3 方,因此我无法更改 jar 的内容或对其源代码进行更改。

我已经尝试过

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<exclude-subsystems>
<subsystem name="jaxrs" />
<subsystem name="webservices" />
</exclude-subsystems>
</deployment>
</jboss-deployment-structure>

这完全禁用了 Web 服务支持,目前还不错(尽管我确实遇到了其他似乎不会破坏任何内容的错误)...但理想情况下我只是想排除 jar 或某些类/类路径自动加载。

到目前为止我发现,@WebServiceProvider 注释不是 beans 扫描的一部分。因此,将 bean-discovery-mode="none" 添加到 beans.xml 没有任何影响。添加 jboss-scanning.xml 没有成功排除 jar 或类..

申请详情:

  • 类型: SpringBoot 2 war 文件
  • 容器:以独立模式部署到 Wildfly 11 的 War
  • 为什么选择 Wildfly?!客户决定。
  • 排除 jar? 我不想从类路径中排除整个 jar,有一些我需要的类。我只是不想让 automagic 加载我没有要求的东西。

更新 1这是日志条目是的,它提示 WSDL...但我什至根本不想加载这个类。

11:56:50,990 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.unit."studyquotation.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."studyquotation.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "studyquotation.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:172)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.jboss.wsf.spi.WSFException: JBWS024109: Could not get WSDL contract for endpoint com.ca.gen80.wsrt.router.GenServiceRouter at WEB-INF/wsdl/router.wsdl
at org.jboss.wsf.stack.cxf.metadata.MetadataBuilder.getWsdlLocationURL(MetadataBuilder.java:283)
at org.jboss.wsf.stack.cxf.metadata.MetadataBuilder.build(MetadataBuilder.java:90)
at org.jboss.wsf.stack.cxf.deployment.aspect.DescriptorDeploymentAspect.start(DescriptorDeploymentAspect.java:42)
at org.jboss.as.webservices.deployers.AspectDeploymentProcessor.deploy(AspectDeploymentProcessor.java:73)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:165)
... 5 more

该类注释为

@WebServiceProvider(
serviceName = "router",
portName = "routerSoapPort",
targetNamespace = "http://GenStudio/router/",
wsdlLocation = "WEB-INF/wsdl/router.wsdl"
)
@BindingType("http://schemas.xmlsoap.org/wsdl/soap/http")
@ServiceMode(Mode.MESSAGE)
public class GenServiceRouter implements Provider<SOAPMessage> {

最佳答案

一种排除自动加载某些依赖项的方法,我没有尝试过,但可能会对您有所帮助

我的 jboss-deployment-struct.xml 的内容

<jboss-deployment-structure>
<deployment>
<!-- Add picketlink module dependency -->
<dependencies>
<module name="org.picketlink" annotations="true">
<imports>
<exclude path="org/picketlink/identity/federation/core/pdp/**"/>
</imports>
</module>
</dependencies>
</deployment>
</jboss-deployment-structure>

关于java - 如何停止 Wildfly11 加载 jar 依赖 Web 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50268613/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com