File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Access Denied Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Access Denied" Watch "Access Denied" New topic
Author

Access Denied

Arpit Gadle
Ranch Hand

Joined: Dec 16, 2008
Posts: 69

Dear All,
I had uploaded a war file on Godaddy server and it exploded successfully around 1:00 AM Arizona time. The uploaded web application has a JSP with form which allows a user to enter a name of his/her choice and on submission respective folder will be created(based on the name entered by the user) on the server under the above deployed web-application. But the things is that i am getting an exception after submission of the form as (locally on Tomcat the directory is created perfectly)


Caught Exception: java.security.AccessControlException: access denied (java.io.FilePermission /var/chroot/home/content/b/r/i/bringlifeto/html/MyDemoDirApp/demodir/testdir write)

For you reference here is the code for JSP and Servlet

index.jsp


UserDirDemo.java


web.xml



After getting this exception, I had set the "Write" permission for the deployed web-application through our hosting account on GoDaddy

Kindly put some light on this issue

Regards,
Arpit U. Gadle
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

The write permission is for the file / dir that you are trying to write to. Does your provider allow you to modify the permission of that file / dir ?

So you are using one of those shared accounts where they restart tomcat once everyday at X PM. eek. Coupled with restricted access to everything, I wonder what code you can deploy on such a server. I would recommend that you get yourself a better config to play around with. I ll stop there, since this topic actually dilutes your original question and the discussion.

I had uploaded a war file on Godaddy server and it exploded successfully around 1:00 AM Arizona time.


Explosions huh


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Arpit Gadle
Ranch Hand

Joined: Dec 16, 2008
Posts: 69

Hi Deepak,
Thanks for replying. Can you explain me what exactly you are trying to say. Is the code which I had written is wrong or I should get a new hosting account with other server which gives more flexibility.

Thanks
Salil Vverma
Ranch Hand

Joined: Sep 06, 2009
Posts: 255

Hey Arpit,



You are getting this exception while creating the directory. mkdirs function throws this exception when the user under which your app is executing does not have necessary right's to create the directory.

you might need to discuss with domain provider to get folder creation privilege as well.

Regards
Salil Verma
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12835
    
    5
The following:


will probably not work - ALL classes used in servlets/jsp should be in packages. The reason being that the JVM will try to load this class from the "current" directory, something you have not control over.

Bill
Arpit Gadle
Ranch Hand

Joined: Dec 16, 2008
Posts: 69

William Brogden wrote:The following:


will probably not work - ALL classes used in servlets/jsp should be in packages. The reason being that the JVM will try to load this class from the "current" directory, something you have not control over.

Bill


Hey Bill,
The issue is I am getting Exception as Access Denied. I have read on net that there is Policy under Tomcat/conf directory which allows different permission settings.
Is the exception related to the configuration defined in the policy file

Arpit
Somnath Mallick
Ranch Hand

Joined: Mar 04, 2009
Posts: 477
Could be. But first check if the path you are trying to create the directory in has the required permission. Check with chmod and find out the permission of the directory.
Arpit Gadle
Ranch Hand

Joined: Dec 16, 2008
Posts: 69

Dear Somnath,
Thanks for you reply. My Directory Creation web-app is deployed on a shared Linux server(GoDaddy and it uses Tomcat). I cant fire chmod command which allows me to set permission of files and directory.
And also I don't have access to catalina.policy file of the tomcat, in which i edit the permissions.

There are two types of policy file one is the default one that comes with JDK and Tomcat and the other is user created which is specific to a user developed application and is placed in the app (i don't know where). Can you tell me something about this.


Thanks
Arpit
Somnath Mallick
Ranch Hand

Joined: Mar 04, 2009
Posts: 477
Hope this is of some help...

http://tomcat.apache.org/tomcat-5.5-doc/security-manager-howto.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Access Denied