spring-boot 0.5.0M2 を使用する Spring バッチがあります。アセンブリ jar-with-dependencies を使用して、実行可能な JAR ファイルを生成します。JAR が適切な依存関係で生成されていること、つまり、必要な Sprinf xsds がすべてあるべき場所に配置されていること、および spring-boot プラグインが適切な META-INF/spring.schemas を生成していることを確認しました。
Cygwin ターミナルからアプリを実行していますが、プロキシが必要とする NTLM 認証のため、Cygwin シェルからネットワーク アクセスできません。
mvn spring-boot:run でアプリを実行すると動作します。ただし、本番環境では、バッチは java -jar myExecutableJar.jar で実行され、サーバーがインターネットにアクセスできないことは確かです。
この場合、次のエラーが表示されます。
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: 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 [...]
したがって、私はこれをアプリが spring.schemas を考慮する代わりに spring-beans-3.2 XSD をダウンロードしようとしていると解釈し、JAR に存在するクラスパス リソースを使用します。
Spring コンテキストにこれを強制する方法はありますか?
助けてくれてありがとう!