2010-07-21 76 views
3

我的j2ee應用程序中運行spring有一些問題。WebSphere試圖從互聯網上加載Spring相關模式

簡短的介紹:

我使用WebSphere 6.1(我不知道這是特定於WebSphere或更一般的問題)

工件:

  1. Web應用程序(WAR)在WEB-INF/lib文件夾中maven發佈所有需要的spring依賴項。
  2. 然後將戰爭打包並部署在應用程序服務器上。

有任何spring配置文件或引用應用程序中的春天呢。只是在WEB-INF/lib內的jar文件,沒有更多關於春天。

當應用程序部署和應用程序啓動時加載的應用程序服務器開始尋找一些春天的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

它希望把他們從互聯網上的網址如上所述。

問:

如何強制應用服務器使用位於本地模式(以Web歸檔)? 或者也許禁用這個檢查?

另一方面,當應用程序啓動完美的作品(後來我嘗試使用IoC)。

應用程序服務器沒有互聯網連接,所有解決此模式的嘗試都會導致等待連接超時。

我做的嘗試:

spring.schemas包含的URL映射到位於Web歸檔到META-INF文件夾模式。所有這些文件(spring.schemas和xml模式)可通過ClassLoader(選中)進行訪問。

任何幫助將不勝感激。

/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 
+0

好*有些東西*正試圖取消引用這些模式。當連接超時時,你會得到一個堆棧跟蹤,以確定哪個組件正在觸發它? – skaffman 2010-07-22 10:13:52

+0

問題已更新 – ProgramWriter 2010-07-22 11:55:29

回答

0

這可能是一個類加載器的問題,即從另一個WAR文件是試圖訪問Spring模式。或者,應用程序服務器可能會嘗試加載web.xml中指定的spring文件。

您可以嘗試將spring.schemas和XSD文件放在EAR目錄的根目錄中。如果任何其他WAR文件試圖加載文件,則基於默認的PARENT_FIRST類加載器策略,它應該能夠找到模式。爲了完全排除類加載器問題,如果上一步沒有幫助,請嘗試將XSD文件放入JRE/lib/ext目錄中的jar文件中,然後重新啓動服務器。

1

我有commons驗證框架這個問題。我所做的是更改xml文件中的名稱空間[它們通常指定的位置],以指向我駐留在Web服務器上的本地版本。對於春天來說,我想這是ApplicationContext.xml。

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

這不是完美的解決方案,但它的工作原理。

讓我知道它是怎麼回事。