最終的に私は解決策を見つけることができましたが、解決策はまだブラックボックスです。失敗/成功した理由に対する答えが誰かにある場合は、スレッドを更新してください。
解決策の概要:1。ファイルの内容をバイトアリーとしてキャプチャし、FileOutputStreamを使用してjbosstmpフォルダー内のxmlファイルに書き込みました。
- jbossメッセージキューに投稿するとき、FileInputStreamをバイト配列として使用して明示的に記述されたxmlファイル(最初のステップ)を使用し、それをメッセージ本文として渡しました。
コード例:
表示:FormFileを含むJSPページ
コントローラクラス:UploadAction.java
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){
...........
writeInitFile(theForm.getFile().getFileData()); // Obtain the uploaded file
Message msg = messageHelper.createMessage( readInitFile() ); // messageHelper is a customized factory method to create Message objects. Passing the newly
wrote file's byte array.
messageHelper.sendMsg(msg); // posting in the queue
...........
}
private void writeInitFile(byte[] fileData) throws Exception{
File someFile = new File("/jboss-5.1.0.GA-3/test/server/default/tmp/UploadTmp.xml"); // Write the uploaded file into a temporary file in jboss/tmp folder
FileOutputStream fos = new FileOutputStream(someFile);
fos.write( fileData );
fos.flush();
fos.close();
}
private byte[] readInitFile() throws Exception{
StringBuilder buyteArray=new StringBuilder();
File someFile = new File("/jboss-5.1.0.GA-3/test/server/default/tmp/UploadTmp.xml"); // Read the Newly created file in jboss/tmp folder
FileInputStream fstream = new FileInputStream(someFile);
int ch;
while( (ch = fstream.read()) != -1){
buyteArray.append((char)ch);
}
fstream.close();
return buyteArray.toString().getBytes(); // return the byte []
}
脚注:これは、Linux/Windowsのデフォルトのファイル保存タイプと関係があると思います。例:Windowsのデフォルト:ANSI。