如何根据 JAX-WS 规范发现 Web 服务实现 类?

How are web service implementation classes discovered according JAX-WS spec?

我很感兴趣,Java EE / JAX-WS 规范(或一般的 Weblogic)如何处理情况,其中有 @WebService 带注释的 Web 服务实现 类库 jar 或者在...

根据考虑所有三种可能性的 JAX-WS 规范,Weblogic 应该发现并托管这些服务、忽略它们还是未定义行为?

更重要的是,如何配置行为?最终,我不想托管这些 Web 服务,但它们确实托管了,我不确定这是正常行为还是配置错误。

Web 服务的部署在第 8 章 JSR-109 Implementing Enterprise Web Services 1.4 Specification 中定义 "Deployment"。

它说:

Validation of the artifact packaging is performed to ensure that:

  • Every port in every WSDL defined in the Web services deployment descriptor has a corresponding port-component element.
  • JAX-RPC or JAX-WS service components are only packaged within a WAR file.
  • Stateless or Singleton session bean Web services are only packaged within an EJB-JAR or WAR file.
  • The WSDL bindings used by the WSDL ports are supported by the Web Services for Java EE runtime. Bindings that are not supported may be declared within the WSDL if no port uses them.

这意味着您的服务器应该只在它们作为 WAR 的一部分部署时才能找到这些服务,或者(如果它们已经用 @Singleton 或 @Stateless 注释或在部署中配置描述符)作为 EJB 模块的一部分。

如果它们出现在 WEB-INF/lib 目录中,它们就是 WAR 的一部分。

EAR 的 APP-INF/lib 目录中是否存在此类 jar 未指定,因为该目录是 WebLogic 扩展,可追溯到 00 年代的某个时间。您应该避免使用它,而只是将实用程序 jar 放在 EAR 文件的 lib 目录中。

无论如何,如果您的服务器从 WAR 文件以外的任何其他地方部署 Web 服务(并且它们绝对不是 EJB),那么您需要向您的供应商投诉。

问题在于 EAR 中库的打包方式。在起点,所有库都驻留在 EAR 根目录中,依赖模块(WAR、EJB)通过其 MANIFEST.MFClass-Path 属性引用它们。出于某些奇怪的原因,这些库甚至在 EAR 的 MANIFEST.MF 中列出,我真的不知道为什么。

显然,从 Weblogic 的角度来看,这与库包含的资源相同 在模块本身 中,因此容器会自动发现注释和其他配置每个引用库的模块。我不确定是不是这种情况,但我相信是这样并尝试确认它。

将库移至 APP-INF/lib 后,未从库中发现任何注释或配置。