[jboss-user] [EJB/JBoss] - Need help on exception:is java.io.FileNotFoundException:
scout1lacno
do-not-reply at jboss.com
Sun Oct 29 22:26:49 EST 2006
Hi all,
Im new to EJB3 and JBOSS.
I wanna materialize a BLOB data from MS SQL to Attachments folder, all data from this folder are generated from the Blob data I acquired. Can someone tell me where to put the folder in my EJB application. Is it in my WAR file? Im clueless.
The error is below:
D:\jboss-4.0.4.GA\server\default\.\tmp\deploy\tmp58870CustomerRelationsManagement.ear-contents\CustomerRelationsManagement-war-exp.war\Attachments\14344\MyIDPic.jpg (The system cannot find the path specified)
My code is:
byte[] fileBytes;
|
|
| while (rs.next()==true){
|
|
| String idmessage = rs.getString("IDMessage");
| String filenameX = rs.getString("strName");
| fileBytes = rs.getBytes("imgAttachment");
| File IDMesx = new File("/Attachments"+"/" + idmessage ); // Maybe my mistake is here
|
| Long myIDMessage = Long.parseLong(idmessage);
|
| ServletContext context = getServletConfig().getServletContext();
| String path = context.getRealPath( "/" + IDMesx);
| File myFile = new File(path);
| myFile.mkdir();
|
| OutputStream targetFile=
| new FileOutputStream(
| myFile + "/" + filenameX );
| targetFile.write(fileBytes);
| targetFile.close();
|
| String URL = context.getServletContextName() + "/Attachments/" + IDMes + "/" + filenameX ;
| out.write("Transfer ok " + URL);
|
| }
Hope for a kind reply :)
Thankz :)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3981648#3981648
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3981648
More information about the jboss-user
mailing list