【问题标题】:WebSphere tries to load Spring related schemas from internetWebSphere 尝试从 Internet 加载 Spring 相关模式
【发布时间】:2011-03-19 06:14:17
【问题描述】:

我在我的 j2ee 应用程序中运行 spring 时遇到了一些问题。

简介:

我使用 WebSphere 6.1(我不知道它是特定于 websphere 还是更普遍的问题)

神器:

  1. Web 应用程序 (war) 在 WEB-INF/lib 文件夹中 maven 发布所有需要的 spring 依赖项。
  2. war 然后打包到 ear 中并部署在应用服务器上。

没有应用程序中没有任何 spring 配置文件或对 spring 的引用。只是WEB-INF/lib 中的jar 文件,没有更多关于spring 的内容。

当应用程序被部署并且应用程序开始加载应用程序服务器开始寻找一些 spring xml 模式:

http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/tool/spring-tool-2.0.xsd http://www.springframework.org/schema/tool/spring-tool-2.5.xsd http://www.springframework.org/schema/tool/spring-tool-3.0.xsd

它想通过上面指定的 url 从互联网上获取它们。

问题:

如何强制应用服务器使用位于本地的架构(在网络存档中)? 或者可能完全禁用此检查?

另一方面,当应用程序启动时一切正常(后来我尝试使用 IoC)。

应用程序服务器没有互联网连接,所有尝试解析此架构都会导致等待连接超时。

我的尝试:

spring.schemas 包含URL 映射到位于Web 存档中的模式到META-INF 文件夹中。 ClassLoader 可以访问所有这些文件(spring.schemas 和 xml 架构)(选中)。

任何帮助将不胜感激。

/me [stupid j2ee developer]

更新 1:

这是我从 websphere 日志文件中获取的确切消息:

[22.07.10 15:45:58:626 MSD] 00000043 XMLParser     W   java.net.SocketException occurs during processing http://www.springframework.org/schema/tool/spring-tool-2.0.xsd: Operation timed out: connect:could be due to invalid address
[22.07.10 15:46:20:112 MSD] 00000043 XMLParser     W   java.net.SocketException occurs during processing http://www.springframework.org/schema/beans/spring-beans-2.0.xsd: Operation timed out: connect:could be due to invalid address
[22.07.10 15:46:41:124 MSD] 00000043 XMLParser     W   java.net.SocketException occurs during processing http://www.springframework.org/schema/tool/spring-tool-2.5.xsd: Operation timed out: connect:could be due to invalid address
[22.07.10 15:47:02:118 MSD] 00000043 XMLParser     W   java.net.SocketException occurs during processing http://www.springframework.org/schema/beans/spring-beans-2.5.xsd: Operation timed out: connect:could be due to invalid address
[22.07.10 15:47:23:130 MSD] 00000043 XMLParser     W   java.net.SocketException occurs during processing http://www.springframework.org/schema/tool/spring-tool-3.0.xsd: Operation timed out: connect:could be due to invalid address
[22.07.10 15:47:44:129 MSD] 00000043 XMLParser     W   java.net.SocketException occurs during processing http://www.springframework.org/schema/beans/spring-beans-3.0.xsd: Operation timed out: connect:could be due to invalid address

【问题讨论】:

  • 好吧,something 正在尝试取消引用这些架构。当连接超时时,您是否会获得一个堆栈跟踪,以便确定哪个组件正在触发它?

标签: java spring websphere


【解决方案1】:

这可能是一个类加载器问题,其中来自另一个 WAR 的文件正在尝试访问 spring 模式。或者,应用服务器可能会尝试加载 web.xml 中指定的 spring 文件。

您可以尝试将 spring.schemas 和 XSD 文件放在 EAR 目录的根目录中。如果任何其他 WAR 文件正在尝试加载文件,那么根据默认的 PARENT_FIRST 类加载器策略,它应该能够找到模式。只是为了完全排除类加载器问题,如果上一步没有帮助,请尝试将 XSD 文件放入 JRE/lib/ext 目录中的 jar 中并重新启动服务器。

【讨论】:

    【解决方案2】:

    我在公共验证器框架中遇到了这个问题。我所做的是更改 xml 文件中的命名空间 [通常在其中指定它们] 以指向我托管在我的网络服务器上的本地版本。对于spring,我猜是ApplicationContext.xml。

    http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://yourservername/springns/schema/beans/spring-beans-2.0.xsd

    这不是完美的解决方案,但它确实有效。

    告诉我进展如何。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-17
      • 2011-06-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多