【问题标题】:WAS 8.5, How to avoid annotation scanning?WAS 8.5,如何避免注释扫描?
【发布时间】:2015-05-08 20:42:20
【问题描述】:

我们在 WAS 8.5.0.0 上部署了一个 Web 应用程序,我们正在使用 PARENT_LAST 类加载器(出于某种原因我们必须这样做),在启动期间,有一些警告:

[12/16/14 17:19:15:088 CST] 00000048 InjectionProc E   CWNEN0044E: A resource reference binding could not be found for the com.sun.xml.ws.transport.tcp.servicechannel.ServiceChannelWSImpl/wsContext resource reference, defined for the MyProjectName component.
[12/16/14 17:19:15:089 CST] 00000048 InjectionProc E   CWNEN0044E: A resource reference binding could not be found for the com.sun.xml.ws.tx.webservice.member.coord.RegistrationRequesterPortTypeImpl/wsContext resource reference, defined for the MyProjectName component.
[12/16/14 17:19:15:090 CST] 00000048 InjectionProc E   CWNEN0044E: A resource reference binding could not be found for the com.sun.xml.ws.tx.webservice.member.coord.RegistrationPortTypeImpl/wsContext resource reference, defined for the MyProjectName component.
[12/16/14 17:19:15:090 CST] 00000048 InjectionProc E   CWNEN0044E: A resource reference binding could not be found for the com.sun.xml.ws.tx.webservice.member.coord.ActivationRequesterPortTypeImpl/wsContext resource reference, defined for the MyProjectName component.
[12/16/14 17:19:15:091 CST] 00000048 InjectionProc E   CWNEN0044E: A resource reference binding could not be found for the com.sun.xml.ws.tx.webservice.member.coord.RegistrationCoordinatorPortTypeImpl/wsContext resource reference, defined for the MyProjectName component.
[12/16/14 17:19:15:092 CST] 00000048 InjectionProc E   CWNEN0044E: A resource reference binding could not be found for the com.sun.xml.ws.mex.server.MEXEndpoint/wsContext resource reference, defined for the MyProjectName component.
[12/16/14 17:19:15:092 CST] 00000048 InjectionProc E   CWNEN0044E: A resource reference binding could not be found for the com.sun.xml.ws.tx.webservice.member.at.CoordinatorPortTypeImpl/wsContext resource reference, defined for the MyProjectName component.
[12/16/14 17:19:15:093 CST] 00000048 InjectionProc E   CWNEN0044E: A resource reference binding could not be found for the com.sun.xml.ws.tx.webservice.member.coord.ActivationCoordinatorPortTypeImpl/wsContext resource reference, defined for the MyProjectName component.
[12/16/14 17:19:15:093 CST] 00000048 InjectionProc E   CWNEN0044E: A resource reference binding could not be found for the com.sun.xml.ws.tx.webservice.member.at.ParticipantPortTypeImpl/wsContext resource reference, defined for the MyProjectName component.
[12/16/14 17:19:15:094 CST] 00000048 InjectionProc E   CWNEN0044E: A resource reference binding could not be found for the com.sun.xml.ws.tx.webservice.member.at.CompletionInitiatorPortTypeImpl/wsContext resource reference, defined for the MyProjectName component.
[12/16/14 17:19:15:095 CST] 00000048 InjectionProc E   CWNEN0044E: A resource reference binding could not be found for the com.sun.xml.ws.tx.webservice.member.at.CompletionCoordinatorPortTypeImpl/wsContext resource reference, defined for the MyProjectName component.

在这些警告之后,有一个例外:

[12/16/14 17:19:15:213 CST] 00000048 webapp        E com.ibm.ws.webcontainer.webapp.WebAppImpl populateJavaNameSpace SRVE8084E: An unexpected internal server error occurred while populating the namespace.
                                 com.ibm.wsspi.injectionengine.InjectionException: CWNEN0044E: A resource reference binding could not be found for the following resource references [com.sun.xml.ws.transport.tcp.servicechannel.ServiceChannelWSImpl/wsContext, com.sun.xml.ws.tx.webservice.member.coord.RegistrationRequesterPortTypeImpl/wsContext, com.sun.xml.ws.tx.webservice.member.coord.RegistrationPortTypeImpl/wsContext, com.sun.xml.ws.tx.webservice.member.coord.ActivationRequesterPortTypeImpl/wsContext, com.sun.xml.ws.tx.webservice.member.coord.RegistrationCoordinatorPortTypeImpl/wsContext, com.sun.xml.ws.mex.server.MEXEndpoint/wsContext, com.sun.xml.ws.tx.webservice.member.at.CoordinatorPortTypeImpl/wsContext, com.sun.xml.ws.tx.webservice.member.coord.ActivationCoordinatorPortTypeImpl/wsContext, com.sun.xml.ws.tx.webservice.member.at.ParticipantPortTypeImpl/wsContext, com.sun.xml.ws.tx.webservice.member.at.CompletionInitiatorPortTypeImpl/wsContext, com.sun.xml.ws.tx.webservice.member.at.CompletionCoordinatorPortTypeImpl/wsContext], defined for the MyProjectName component.
    at com.ibm.wsspi.injectionengine.InjectionProcessor.resolveInjectionBindings(InjectionProcessor.java:1208)
    at com.ibm.wsspi.injectionengine.InjectionProcessorContextImpl.processBindings(InjectionProcessorContextImpl.java:56)
    at com.ibm.ws.injectionengine.AbstractInjectionEngine.processBindings(AbstractInjectionEngine.java:807)
    at com.ibm.ws.injectionengine.AbstractInjectionEngine.processInjectionMetaData(AbstractInjectionEngine.java:539)
    at com.ibm.ws.injectionengine.SharedInjectionEngineImpl.processInjectionMetaData(SharedInjectionEngineImpl.java:208)
    at com.ibm.ws.injectionengine.ReferenceContextImpl.process(ReferenceContextImpl.java:835)
    at com.ibm.ws.webcontainer.webapp.WebAppImpl.populateJavaNameSpace(WebAppImpl.java:1112)
    at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:328)
    at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
    at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
    at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749)
    at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
    at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426)
    at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1170)
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1370)
    at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:638)
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:769)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2172)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:445)
    at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:388)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:116)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:994)
    at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:349)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1783)

对不起,日志信息超长,基本上是"CWNEN0044E: A resource reference binding could not be found for the following resource references...",而提到的类,如“ServiceChannelWSImpl”,都在webservice-rt-2.0.1.jar

如果我删除 webservice-rt-2.0.1.jarwebservice-api-2.0.1.jar(以及我的依赖于这 2 个 jar 的类),那么错误就消失了。

我google了一下,好像和注解扫描有关,所以我更新了我的MANIFEST.MF,并添加:

Ignore-Scanning-Archives: webservices-api-2.0.1.jar, webservices-rt-2.0.1.jar

但这不起作用,错误仍然存​​在。

还有其他建议吗?我没有想法,可以请一些 WAS 专家帮忙吗?

[更新] 这是 web.xml(对不起,我必须删除公司相关信息)

<?xml version="1.0" encoding="UTF-8"?>
<web-app 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    id="project-1" 
    version="3.0" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

  <display-name>project-1</display-name>
  <listener>
    <listener-class>com.mh.proj1.server.MyServletContextListener</listener-class>
  </listener>
  <listener>
    <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
  </listener>
  <listener>
    <listener-class>org.jboss.resteasy.plugins.spring.SpringContextLoaderListener</listener-class>
  </listener>
  <listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
  </listener>
  <listener>
    <listener-class>com.mh.proj1.spring.ApplicationContextHolder</listener-class>
  </listener>
  <listener>
    <listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
  </listener>
  <context-param>
    <param-name>webAppRootKey</param-name>
    <param-value>proj1decision</param-value>
  </context-param>
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:spring/applicationContext.xml</param-value>
  </context-param>
  <context-param>
    <param-name>resteasy.providers</param-name>
    <param-value>com.mh.proj1.exceptions.WAEExceptionMapper,com.mh.proj1.exceptions.GenericExceptionMapper</param-value>
  </context-param>
  <filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <servlet>
    <servlet-name>Resteasy</servlet-name>
    <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
  </servlet>

  <servlet>
    <servlet-name>CALC WS</servlet-name>
    <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>Resteasy</servlet-name>
    <url-pattern>/rs/*</url-pattern>
  </servlet-mapping>


  <servlet-mapping>
    <servlet-name>CALC WS</servlet-name>
    <url-pattern>/ws/*</url-pattern>
  </servlet-mapping>
  <session-config>
    <session-timeout>1</session-timeout>
  </session-config>
</web-app>

以及类中使用的注解:

@Component("CalcWS")
@WebService(endpointInterface = "com.a.b.BaseWS", targetNamespace = "http://driver.abc.com/", serviceName = "BaseWSService", portName = "BaseWSPort", wsdlLocation = "WEB-INF/wsdl/BaseWSService.wsdl")
public class CalcWS implements BaseWS {
...
}

【问题讨论】:

    标签: websphere jax-ws websphere-8


    【解决方案1】:

    WebSphere 提供 JAX-WS 运行时。因此,我建议您从应用程序中删除任何与 JAX-WS 相关的 jar,并使用 WebSphere 提供的实现。看看你是否还会有错误。

    如果您想使用第三方提供商,您需要为您的应用程序禁用 WebSphere JAX-WS 运行时。

    要在应用程序级别关闭注释扫描,请将 WAR 文件或 EJB 模块的 META-INF/MANIFEST.MF 中的 DisableIBMJAXWSEngine 属性设置为 true。示例:

    Manifest-Version: 1.0
    DisableIBMJAXWSEngine: true
    

    查看此页面的详细信息:Using a third-party JAX-WS web services engine

    【讨论】:

    • 感谢您的回复,我们已经在 MANIFEST.MF 中添加了 DisableIBMJAXWSEngine: true ,但它没有帮助,我们仍然遇到同样的错误。
    • @morven 检查这个答案 - stackoverflow.com/a/20831904/3701228。但是您是否尝试过删除 webservices jar 并使用 WAS 内置引擎?
    • gas,我确实尝试删除webservice-rt-2.0.1.jar和webservice-api-2.0.1.jar,但是导致了WSServlet找不到的错误,我发现有web.xml 中的引用,xxxcom.sun.xml.ws.transport.http.servlet.WSServlet1。如何处理这个错误?
    • @morven 您的 Web 服务是否使用 @WebService 注释定义?您的 web.xml 是 3.0 版本吗?如果是,请从 web.xml 注释掉该 servlet,在符合 JAX-WS 的容器中不需要它。也许将web.xml 和您的服务类示例添加到问题中。
    • 谢谢你,Gas,我明天到办公室时会更新​​帖子。关于您所说的,如果我们使用注释,我们不需要 web.xml conf,它是否适用于所有服务器(如 Tomcat 或其他东西),还是仅适用于 WAS?对不起,如果这是一个愚蠢的问题,我缺乏相关知识。
    猜你喜欢
    • 1970-01-01
    • 2012-10-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-21
    • 2021-11-04
    相关资源
    最近更新 更多