This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, Basically I would like to create and write to a file at runtime. The problem is basically doing the same on the UNIX server. I have given the path/filename as an environment variable in web.xml & pass this variable as a parameter to the FileOutputStream instance. My problem is creating the file in the directory I require. I have a directory structure as "/devel/logs/logs" on the unix platform which is outside the OC4J container. I am unable to access this directory. Say I create the variable as - "/devel/logs/logs/myapp.log" , on the Unix server, this throws a null pointer error. However, on my local m/c the same file gets created within- /devel/logs/logs Now say I create the variable as - "\devel\logs\logs\myapp.log" , on the Unix server, this creates a file by the name -- "\devel\logs\logs\myapp.log" under the OC4J home directory. What I want to know is, how to I create a file in the "\devel\logs\logs\" directory on the UNIX server. Please note that this directory is outside the OC4J container and that since it is a UNIX platform I will not be able to give anything like "c:\devel\logs\logs"
Hi Arch, Your question is not terribly clear to me -- but I'll try to answer it, anyway (if you don't mind :-) I believe you are using OC4J (I assume stand-alone version -- and not the one embedded in "JDeveloper" -- but I don't know what version number) running on a Windows machine (but again, I don't know which version of Windows) and that you want some component in your application (that you have deployed to OC4J) to write log messages to some file that is supposed to reside on another, UNIX machine (yet again, I don't know what UNIX version nor what type of machine) which is situated on the same local directory (i.e. LAN) as the Windows machine (that is running OC4J). Assuming the above is correct, then you have two possibilities (in my opinion):
use a file URL which has the format: file://host ort/path/to/file
create (and use) a network mapping for the UNIX machine from the Windows machine. At my place of work we use "samba" software to do this. Unfortunately, I don't know much about it (I just use it).
However, your problem may also have to do with permissions. The Windows user (that "owns" the OC4J instance that is running) may not have permission to create files on the UNIX machine. But yet again, I can't help you with a more detailed answer since I didn't find enough information in your question to allow me to. And if the above is totally useless to you, then please excuse me. Hope it helps (anyway). Good Luck, Avi.
Joined: Feb 07, 2003
Hi Avi, Just to give you a little clarification -- I have deployed my EAR file in the OC4J container on the Oracle 9iAS Server. This is installed on a UNIX sun solaris box. I need to access a file on the same Unix box but the directory is outside the OC4J home directory. Thanks, Arch