jython、pyro、antを組み合わせて使用しながらIOExceptionエラーを停止するにはどうすればよいですか?
質問
この厄介な問題についての素晴らしい概要は次のとおりです。
短縮版:私たちは、使用しているこのソフトウェアの配布システムを構築しています。基本的に、ビルド アーティファクトを取り出し、それを FTP サーバーに保存し、サーバーにパッチを適用するスクリプトを実行する複数のクライアントに渡します。
ロングバージョン:
配信サーバー1台
複数のクライアントサーバー
ソフトウェア:Jython 2.5.1、ANT 1.8.0、Pyro 3.10
配布サーバーには FTP サーバーと PYRO クライアントが実行されています。各クライアント サーバー上で PRYO サーバーが実行されています。
PYRO クライアントは、パッチ手順を開始するように指示されると、すべてのクライアント サーバーのリストを含むマシン リストを読み取ります。次に、各 PYRO サーバーに 1 つずつ接続し、パッチ手順を実行します。手順は次のとおりです。getPatch (そのサーバーの最新のパッチを取得します)、StopServer (パッチを適用する必要があるものにアクセスしているまたはアクセスしていない可能性のあるソフトウェアを停止します)、パッチの適用、StartServer。各プロセスは、いくつかのフォルダー名と他の構成を渡す ANT スクリプトを呼び出します。楽しい部分は、パッチを適用するときに起こります。エラーログについては以下を参照してください。NDA の理由により、フォルダー名を削除する必要がありました。
ここが興味深いところです。プロシージャの各セクションを個別に実行します。つまりgetPatch、StopServer などを実行します。一度に 1 つずつ手動で。このバグは発生しません。物理的にマシンにアクセスしてプロセスを実行しても、そのようなことは起こりません。4 つのプロセスすべてを順番に呼び出す場合のみ。この問題は、ApplyPatch フェーズ中に、複数のファイルに対して ANT 置換スクリプトが呼び出されるときに発生します。JVM がファイルを 1 ~ 2 秒間保持し続けることに関係があるのではないかと考えられます。ただし、これは ant のバグノートに従ってパッチが適用されることになっています。
要するに:
配布サーバー ==> jython ==> pyro 接続 ==> クライアントサーバー ==> jython ==> ant スクリプト
エラーログ:
<*snip>\ant\deploy.xml:12: IOException in <*snip>\bin\startGs.sh - java.io.IOException:Failed to delete <*snip>\bin\rep4698373081723114968.tmp while trying to rename it.
at org.apache.tools.ant.taskdefs.Replace.processFile(Replace.java:709)
at org.apache.tools.ant.taskdefs.Replace.execute(Replace.java:548)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1360)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1212)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:302)
at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:221)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1360)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1212)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
at org.apache.tools.ant.Extaskdefs.SubAnt.execute(SubAnt.java:302)
at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:221)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at net.sf.antcontrib.logic.IfTask.execute(IfTask.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:154)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1360)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1212)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:302)
at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:221)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
org.apache.tools.ant.task.perform(task.java:348)でorg.apache.tools.ant.taskdefs.macroinstance.execute(macroinstance.java:398)at org.apache.tools.antでsun.reflect.nativemethodacsessimpl.invoke0(nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:39)のsun.reflect.nativemethodacsessimpl.invoke0(native method)at sun.refllect.nativemethodacsessimpl.invoke0(unknownement.java:291)のunknowedelement.execute(unknownement.java:291) .java: 25)Java.lang.Reflect.Method.Invoke(Method.java:597)at org.apache.tools.ant.dispatch.dispatchutils.execute(dispatchutils.java:106)at org.apache.tools.ant.ant.ant.ant.task .perform(task.java:348)at org.apache.tools.ant.taskdefs.sequential.execute(sequential.java:68)at org.apache.tools.ant.unknownelement.execute(unknownement.java:291) sun.refllect.nativemethodaccessimpl.invoke0(ネイティブ方法)sun.reflt.nativemethodaccessorimpl.invoke(nativemethodacsessorimpl.java:39)at sun.reflt.delegatingmethodaccessimmpl.invoke(javaimpl.pelf.pelf.pelf.java) ethod。 org.apache.tools.ant.dispatch.dispatchutils.execute(dispatchutils.java:106)at org.apache.tools.ant.task.perform(task.java:348)でorg.apache.tools.ant.dispatch.dispatchutils.execute(task.java:348)でinvoke(method.java:597) .apache.tools.ant.taskdefs.macroinstance.execute(macroinstance.java:398)at sun.reflect.nativemethodaccessorimpl.invoke0(native method)at sun.reflect.nativemethodaccessorimpl.invoke(nativemethaccessodaccessorimpl.java:39) .delegatingMethodaccessorimpl.Invoke(DelegatingMethodaccessorImpl.java:25)at java.lang.reflect.method.invoke(method.java:597)at org.apache.tools.ant.ant.ant.dispatch.dispatchils.execute org.apache.tools.ant.task.perform(task.java:348)at org.apache.tools.ant.taskdefs.parallal $ taskrunable.run(parallel.java:433)at java.lang.thread.run( thread.java:619)原因:java.io.IO例外:<*snip>\bin ep4698373081723114968.tmp の名前を変更しようとして削除できませんでした。atorg.apache.tools.ant.util.fileutils.rename(fileutils.java:1248)at org.apache.tools.ant.taskdefs.replace.processfile(palple.java:702)...さらに125個
助けていただければ幸いです。
解決
どうやらFTPに問題があるようです。jython を介して個々のフォルダーにロックを保持します。したがって、新しいファイルが導入されると、そのファイルは削除できない状態にロックされます。ファイルは引き続き編集できます。置換スクリプトを実行します。ただし、削除することはできません。FTP の別の実装に取り組む予定です。つまりant ではなく java/jython のバージョンを使用してください。