1

我需要一些帮助来防止 Wildfly11 自动加载带有@WebServiceProviderjar 依赖项注释的类。

依赖项是第 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注释不是 bean 扫描的一部分。所以添加bean-discovery-mode="none"beans.xml没有影响。除了 jar 或类之外,添加一个jboss-scanning.xml没有运气..

申请详情:

  • 类型: SpringBoot 2 战争文件
  • Container: War 以独立模式部署到 Wildfly 11
  • 为什么是野蝇?!客户口授。
  • 排除罐子?我不想从类路径中排除整个 jar,我需要一些类。我只是不希望自动加载我没有要求的东西。

更新 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> {
4

1 回答 1

0

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

我的 jboss-deployment-structure.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>
于 2018-05-10T08:34:53.327 回答