Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.security.AccessControlException

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi, I am facing a problem with security. I am trying to write an XML file through an (java)EJB bean .Compiling is no problem.It is giving an access control exception at run time.The code and exception details are as follows.hope you can please help me out.
CODE:
---------------------
filePath = "c:\\j2sdkee1.2.1\\public_html\\";
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance ();
DocumentBuilder builder = factory.newDocumentBuilder ();
TransformerFactory tFactory = TransformerFactory.newInstance ();
Transformer transformer = tFactory.newTransformer ();
ByteArrayInputStream byt = new ByteArrayInputStream (contractLineStr.toString().getBytes ());
Document document = builder.parse (byt);
DOMSource source = new DOMSource (document);
File file = new File (filePath);
if (file.exists ())
file.delete ();
StreamResult result = new StreamResult (new FileOutputStream(filePath));
transformer.transform (source, result);

The Exception i am getting is
-----------------------------
java.security.AccessControlException:
access denied (java.io.FilePermission c:\j2sdkee1.2.1\public_html\CO301214.xml write)
bye

madhu g
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"madhu g",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp .
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in again with a new name which meets the requirements.
Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic