cancel
Showing results for 
Search instead for 
Did you mean: 

Shared Folder acess problem in J2ee application

Former Member
0 Kudos

Hi,

We are using SAP Netweaver 04s JAVA system.

In our j2ee application we are trying to access shared resource(file), but ejb is giving exception. Our code is as follows:



File srcDir = new File("\machine_namefolder");
if(!srcDir.exists())
{throw new Exception("directory does not exist", srcSys);
}

It gives expection "FileNotFoundException".

The same j2ee application is working fine when deployed on IBM Websphere.

We trired to access same shared path from windows, it is also working.

Please help us. Thanks in advance.

--sagar

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

i solve it by own.

Vlado
Advisor
Advisor
0 Kudos

Hi Sagar,

EJBs are not allowed to access files and directories in the filesystem. See the <a href="http://java.sun.com/blueprints/qanda/ejb_tier/restrictions.html">EJB Restrictions</a>, and particularly <b>Why can't EJBs read and write files and directories in the filesystem? And why can't they access file descriptors?</b>

Cheers,

Vladimir

Former Member
0 Kudos

But then why is same thing working when i deploy my application in websphere.

and most importantly when i give a shared path of same machine where my application is deployed, it is still working. problem comes, when i give shared path of a different machine. It just dosent picks up the files.

I have to give shared path of a different machine because we have a Grid setup and we will have all our files shared in only one of the folders

Vlado
Advisor
Advisor
0 Kudos

If you read carefully, you can find the answers to all those questions in the before mentioned FAQ.

-Vladimir

Former Member
0 Kudos

thanks valdimir, but i couldnot find answer to my questions, that when i deploy the same application in websphere, it is able to access shared folders of any machine.

however when i deploy same j2ee ap[plication in NW WebAs, it can access shared folder of same machine <b>but cannot access shared folder of a different machine.</b>

Former Member
0 Kudos

can it be because of some short falls in NW WebAs ? i mean some extra restricitions ?

Vlado
Advisor
Advisor
0 Kudos

As I said the answers are there, you just have to find and read them

<i>"Some Containers may allow the Deployer to grant more, or fewer, permissions to the enterprise bean instances than specified in Table 10. Support for this is not required by the EJB specification. Enterprise beans that rely on more or fewer permissions will not be portable across all EJB Containers."</i>

Former Member
0 Kudos

Thanks for immediate reply.

We solve the problem. Itz because of sap service user (<b><SAPID>adm</b>) who tries to access shared folders.

All Netweaver services on machine are under <SAPID>adm user.

To access the shared folder on remote machines, Netweaver services must be configured to run as a <b>domain account</b> , which account also present on remote machines.

We change the ownership of these services to domain account and restart the services. Now any shared folders are accessible from our application.

--sagar

Vlado
Advisor
Advisor
0 Kudos

Anyway, what is more important here is what you are trying to achieve. The restrictions outlined above are not there without a reason.

-Vladimir