Servlet doing serialization

Hi all,

I'm designing a small app in order to perform compilation test on struts framework using flash tools. The project is organized this way: the user tells how many "compilation test" he wants to perform on the main page and then these informations are passed to a servlet which generates fake informations about the user and perform the compilation of a Flash animation. All these informations (first name, last name, mail, various informations and path to flash animation) are stored inside a separate class which also reads the content of the flash file and stores it into an attribute. This class implements the serializable interface. When things are done, I try to serialize the object.

Problems are beginning at this point: I'm not able to serialize my object. In fact, I generate a random filename and pass it to a FileOutputStream, so it is supposed to create my file. Despite of this, I get an*annoying* Error 500 which tells me the following:

java.io.FileNotFoundException: /var/lib/tomcat5/webapps/struts_test/WEB_INF/classes/objects/aGdsPhOboRJgf.ser (No such file or directory)

java.io.FileOutputStream.open (Native Method)

java.io.FileOutputStream.<init> (FileOutputStream.java:179)

java.io.FileOutputStream.<init> (FileOutputStream.java:70)

java.io.FileWriter.<init> (FileWriter.java:46)

struts_test.IdentifyAction1.execute (IdentifyAction1.java:76)

org.apache.struts.action.RequestProcessor.processActionPerform (RequestProcessor.java:421)

org.apache.struts.action.RequestProcessor.process (RequestProcessor.java:226)

org.apache.struts.action.ActionServlet.process (ActionServlet.java:1164)

org.apache.struts.action.ActionServlet.doPost (ActionServlet.java:415)

javax.servlet.http.HttpServlet.service (HttpServlet.java:709)

javax.servlet.http.HttpServlet.service (HttpServlet.java:802)

sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)

sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)

java.lang.reflect.Method.invoke (Method.java:597)

org.apache.catalina.security.SecurityUtil$1.run (SecurityUtil.java:243)

java.security.AccessController.doPrivileged (Native Method)

javax.security.auth.Subject.doAsPrivileged (Subject.java:517)

org.apache.catalina.security.SecurityUtil.execute (SecurityUtil.java:272)

org.apache.catalina.security.SecurityUtil.doAsPrivilege (SecurityUtil.java:161)

This stacktrace guides us to the idea that we don't have deployed the right security policy, but it isn't. My catalina.policy contains the following:

grant codeBase"file:${catalina.home}/webapps/struts_test/-"{

...

permission java.io.FilePermission"/var/lib/tomcat5/webapps/struts_test/WEB-INF/classes/struts_test/flash/-","read,write";

permission java.io.FilePermission"/var/lib/tomcat5/webapps/struts_test/WEB-INF/classes/objects/test.ser","write,read";

.....

};

So I've tried to tell it a nice permission java.security.AllPermission;

and this results in the non-appearance of the error message, but the file is*NOT* created... It's going to drive me nuts... So if anyone has an idea, I'd be honoured to read it :)

Thanks!

System Configuration:

OS: Ubuntu Linux 7.04

Tomcat: version 5.0

Java: JDK1.6.0_02

SE with some Ant and Struts-related libraries and

[3739 byte] By [n2xta] at [2007-11-27 11:04:57]
# 1

Are you sure the path is correct?

ava.io.FileNotFoundException: /var/lib/tomcat5/webapps/struts_test/WEB_INF/classes/objects/aGdsPhOboRJgf.ser (No such file or directory)

Should it not be "WEB-INF" instead of "WEB_INF"?

tolmanka at 2007-7-29 13:05:20 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Holy sh** !!! I feel really stupid this time... Thought I've well checked this...

Many thanks tolmank, and sorry for the annoying question...

n2xta at 2007-7-29 13:05:20 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...