Solved

create a text file from jsp using JBOSS

Posted on 2009-03-31
3
744 Views
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

Thanks,
Kothakotha
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));

    output1.write(text);

    output1.close();

Open in new window

0
Comment
Question by:kothakotha
  • 2
3 Comments
 
LVL 19

Accepted Solution

by:
ramazanyich earned 250 total points
Comment Utility
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)
0
 

Author Comment

by:kothakotha
Comment Utility
Thanks for the solution...i modified my jboss userto use my user credentials, it worked fine..

0
 

Author Closing Comment

by:kothakotha
Comment Utility
checking the jboss credentials helped me to solve the problem, thanks
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

-Xmx and -Xms are the two JVM options often used to tune JVM heap size.   Here are some common mistakes made when using them:   Assume BigApp is a java class file for the below examples. 1.         Missing m, M, g or G at the end …
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now