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

Shared Drive access from WebSphere

Anshul Jain
Greenhorn

Joined: May 10, 2006
Posts: 12
Hi,
I am using JAVA IO API in my websphere application for accessing file located in shared drive. I am using absolute naming pattern as par JAVA IO specification which says "For Win32 platforms, the prefix of a pathname that contains a drive specifier consists of the drive letter followed by ":" and possibly followed by "\" if the pathname is absolute. The prefix of a UNC pathname is "\\"; the hostname and the share name are the first two names in the name sequence. A relative pathname that does not specify a drive has no prefix."

The application�s file access logic is like below:

********************************************************************************************************************************************************

String pdfStatementPath = "L:\\LOAN\\LOAN_PDF\\test.pdf";

Java.io.File l_file = null;

l_file = new Java.io.File(pdfStatementPath);

if(!l_file.canRead()){ //Tests whether the application can read the file denoted by this abstract pathname.

System.out.println("File " + pdfStatementPath + " can not be read from shared location.");

}

else{

//logic to read the file

}

********************************************************************************************************************************************************

Please note that if I put �LOAN� folder in websphere application server�s local drive it can be accessed using same application.

Success case:
C:\LOAN\LOAN_PDF\test.pdf

Failure case:
L:\LOAN\LOAN_PDF\test.pdf or
\\<server-name>\<shared folder name>\LOAN\LOAN_PDF\test.pdf

I am not getting any exception while executing above logic.

The same file can be read from the network drive if I use independent java file with the same logic.

Please guide..

Thanks-in-advance
Alok
jeroen dijkmeijer
Ranch Hand

Joined: Sep 26, 2003
Posts: 131
Maybe it's a good idea to post which version of WAS your using. I'm using Was 6.1 (currently only in a test environment) and somehow we cant get it to read from the shared drives, for which you've to be authenticated. The problem you experienced is not the same, but similar to our problem: not being able to "classload" (property files) from shared drives. We tried to tell the server that it should run under my account but that did not work. Next we're going to try to run the server normal (that is not in services mode). Which will be next week.

Regards,
Jeroen.
Anshul Jain
Greenhorn

Joined: May 10, 2006
Posts: 12
Thanks jeroen....

I am using WAS6.0.2. And I have resolved this issue by following these who steps:
1. I restarted was_nodeagent service as Administrator which was by default "Local System".
2. I changed folder path in UNC format as per Microsoft specification. Which says "A service (or any process that is running in a different security context) that must access a remote resource should use the Universal Naming Convention (UNC) name to access the resource."
Manon Baratt
Ranch Hand

Joined: Jan 30, 2006
Posts: 58
I am using RAD 7.0 with WAS 6.0 on my winodws desktop. I have an application that needs to access files(images) in a directory on a unix box. Under Tomcat I was able to create a project in Eclipse and map to the directory on the unix server. I don't think I can do that under WAS. I probably have to do something like what is mentioned in your message. Any ideas?

Thanks in advance.
Vedhas Pitkar
Ranch Hand

Joined: Jan 27, 2001
Posts: 445
Originally posted by Alok Mahajan:
Thanks jeroen....

I am using WAS6.0.2. And I have resolved this issue by following these who steps:
1. I restarted was_nodeagent service as Administrator which was by default "Local System".
2. I changed folder path in UNC format as per Microsoft specification. Which says "A service (or any process that is running in a different security context) that must access a remote resource should use the Universal Naming Convention (UNC) name to access the resource."


Hi Alok,

We are facing the same problem with the shared drive and Websphere. Can you please let me know in detail what you did to get it working?

I am using WAS 6.0.2 on Win XP Java 1.4.2. We start the server using AppSever\bin\startServer.cmd. But we dont start nodes or node agents when we start the server.

We try to access the shared drive as in "J:\temp" where J is mapped to a folder to which the user has all rights.

Thanks in advance,
Vedhas
Anshul Jain
Greenhorn

Joined: May 10, 2006
Posts: 12
Hi,

According to Microsoft, our issue is like below:
http://support.microsoft.com/default.aspx/kb/180362/en-us/

I did two changes and it worked fine:
1. Instead of accessing using shared drive name I used full system name
like instead of L:/temp/ I used \\fileservername\temp\
2.App server node should "log on as" administrator or admin user.
Vedhas Pitkar
Ranch Hand

Joined: Jan 27, 2001
Posts: 445
Originally posted by Alok Mahajan:
Hi,

According to Microsoft, our issue is like below:
http://support.microsoft.com/default.aspx/kb/180362/en-us/

I did two changes and it worked fine:
1. Instead of accessing using shared drive name I used full system name
like instead of L:/temp/ I used \\fileservername\temp\
2.App server node should "log on as" administrator or admin user.


Thanks for the info, Alok.

I forgot to mention that the above works on some m/cs and not on others (all Win XP SP2). This is what puzzles me and leads me to think that this may be an OS issue.

Any thoughts?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Shared Drive access from WebSphere