create a text file from jsp using JBOSS

Posted on 2009-03-31
Medium Priority
Last Modified: 2013-12-02
Hello Experts,

I am trying to create a text file from jsp in jboss , it is working fine if i run standalone java program but from jsp it says Access Denied exception, please help

Writer output1 =null;
            String text = "JBOSS";
           String PROD2 = "abcd-web-server";
String fileLoc1 = "\\"+PROD2+"\\d$\\";
            File file1 = new File("\\"+fileLoc1+"write.txt");
            System.out.println("Chk file read" +file1.canRead());
            output1 = new BufferedWriter(new FileWriter(file1));

Open in new window

Question by:kothakotha
  • 2
LVL 19

Accepted Solution

ramazanyich earned 1000 total points
ID: 24036727
the problem is that jboss server could be run as another user (or even localsystem user if it is run as windows service). And also you are trying to save to network shared folder which has to be mapped then jboss server is running.
I would suggest to create file not using absolute path but relative path and use some other programs to transfer created files, eg. some batch files which will do transfer files using FTP (or you can also do FTP using JAVA if you want)

Author Comment

ID: 24041592
Thanks for the solution...i modified my jboss userto use my user credentials, it worked fine..


Author Closing Comment

ID: 31565091
checking the jboss credentials helped me to solve the problem, thanks

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Most of the developers using Tomcat find it easy to configure the datasource in Server.xml and use the JNDI name in the code to get the connection.  So the default connection pool using DBCP (or any other framework) is made available and the life go…
Upgrading Tomcat – There are a couple of methods to upgrade Tomcat is to use The Apache Installer is to download and unzip and run the services.bat remove|install Tomcat6 Because of the App that we are working with, we can only use Tomcat 6.…
How to fix display issue, screen flickering issue when I plug in power cord to the machine. Before I start explaining the solution lets check out once the issue how it looks like after I connect the power cord. most of you also have faced this…
The video provides a quick and easy steps to migrate MBOX file to well known Outlook PST and Office 365. Besides this, it also supports and migrates more than 20 email clients of MBOX which include AppleMail, Opera, Thunderbird and SeaMonkey effortl…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question