2013-12-12 19 views
2

我有一個使用彈簧啓動0.5.0M2一個Spring批次。我使用裝配jar -with-dependencies來生成一個可執行的JAR文件。我已經檢查了JAR與適當的依賴關係,即所有必需的XSD Sprinf位於何處,他們應該是生成的,彈簧啓動插件已產生了正確的META-INF/spring.schemas。Spring應用程序不採取spring.schemas考慮

我從Cygwin終端運行我的應用程序,但由於我的代理需要NTLM身份驗證,因此我沒有從Cygwin shell進行網絡訪問。

如果我用mvn spring-boot運行我的應用程序:運行它的工作。但是在生產中,批處理將使用java -jar myExecutableJar.jar運行,並且我非常確定服務器將無法訪問Internet。

在這種情況下,我得到以下錯誤:

. ____   _   __ _ _ 
/\\/___'_ __ _ _(_)_ __ __ _ \ \ \ \ 
(()\___ | '_ | '_| | '_ \/ _` | \ \ \ \ 
\\/ ___)| |_)| | | | | || (_| | )))) 
    ' |____| .__|_| |_|_| |_\__, |//// 
=========|_|==============|___/=/_/_/_/ 
:: Spring Boot :: 

2013-12-12 17:15:42,197 INFO [fr.foo.my.app.MyBatch] - <Starting MyBatch on UC401711VW7JAV1 with PID 6848 (C:\nicolas\git\foobatch\target\indexer-batch-0.2.0-jar-with-dependencies.jar started by S818203)> 
2013-12-12 17:16:03,481 WARN [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - <Ignored XML validation warning> 
org.xml.sax.SAXParseException; lineNumber: 12; columnNumber: 12; schema_reference.4 : Echec de la lecture du document de sch▒ma 'http://www.springframework.org/schema/beans/spring-beans-3.2.xsd' pour les raisons suivantes : 1) Le document est introuvable ; 2) Le document n'a pas pu ▒tre lu ; 3) L'▒l▒ment racine du document n'est pas <xsd:schema>. 
     at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) 
[...] 
Caused by: java.net.ConnectException: Connection timed out: connect 
     at java.net.DualStackPlainSocketImpl.connect0(Native Method) 
     at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) 
     at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) 
     at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) 
     at java.net.AbstractPlainSocketImpl.connect(Unknown Source) 
     at java.net.PlainSocketImpl.connect(Unknown Source) 
     at java.net.SocksSocketImpl.connect(Unknown Source) 
     at java.net.Socket.connect(Unknown Source) 
     at java.net.Socket.connect(Unknown Source) 
     at sun.net.NetworkClient.doConnect(Unknown Source) 
     at sun.net.www.http.HttpClient.openServer(Unknown Source) 
     at sun.net.www.http.HttpClient.openServer(Unknown Source) 
     at sun.net.www.http.HttpClient.<init>(Unknown Source) 
     at sun.net.www.http.HttpClient.New(Unknown Source) 
     at sun.net.www.http.HttpClient.New(Unknown Source) 
     at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source) 
     at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) 
     at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source) 
     at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) 
     at [...] 

所以我將此解釋爲應用程序試圖下載彈簧豆-3.2 XSD,而不是考慮到spring.schemas和使用類路徑的資源,存在於JAR中。

有沒有辦法強制Spring上下文來做到這一點?

感謝您的幫助!

+0

可能是一個錯誤,我想,但它適用於我(建一個罐子,拔掉網線,運行jar)。對我來說,你似乎更可能不知道你的類路徑上實際上有'spring.schemas'。不知道如何發生,但檢查你的jar的內容。 –

+0

P.S.你真的需要升級Spring Boot。 M2以來該項目發生了很多事情。你有快照時遇到同樣的問題嗎? –

回答

0

此錯誤的最常見原因是在XML中使用顯式的版本化模式URL,然後意外地在您的類路徑中包含了一個舊版版本的相關JAR。例如。如果你是指spring-beans-4.0.xsd在XML頭,但包括在你的傳遞依賴spring-context:3.2.*

相關問題