How to get a path of a folder in cloudera? - java

Im trying to run a my code in java using hadoop but I get an error of the path of the file
scanner1 = new Scanner(new File("/home/cloudera/pos.txt")); //Path
The error message that I get is:
Status : FAILED
java.io.FileNotFoundException: /home/cloudera/pos.txt (Permission denied)

The "Permission denied" in the error message indicates you don't have read access to the directory. Which user is running the java code, your personal user or the cloudera? To fix, you should either make the data readable for your user, move it to a common location that is globally readable, think /usr/local, or run your code as the cloudera user. Also, is this in HDFS or on the local filesystem?

Related

Where can I store data as a System Service?

I programmed a system-service and it tries to create a directory to save some data. The dir that I chose was /.myServiceData.
When I try to run it I get this error: mkdir /.ethNode: read-only file system.
Where can I store my data in the system-service on android?
-UPDATE:
I now tried to getFilesDir() in the system-service, and it also throws an error:
Caused by: java.lang.RuntimeException: No data directory found for package android

Java - Newly created file on smb share has no user, no group

I mounted a SMB share via fstab:
//IP_SERVER/public /home/sl/images_server cifs username=USER,passwd=PASSWD 0 0
I want to create some new files in /home/sl/images_server. The folder has the mod 777 and the user and group sl.
When I try to save a file via Java I get this error:
java.io.FileNotFoundException: /home/sl/images_server/test.jpg (Permission denied)
I use the following code to write the image:
ImageIO.write(ImageIO.read(SOURCE_FILE), "jpg", new File("/home/sl/images_server/test.jpg"));
After I executed the Java command I see a newly created file in the folder with nobody as user, nogroup as group and '-rw-r--r--' as mod.
What is neccessary to save a file in this folder.
Ok, the problem has nothing to do with Java. It was just my samba server which wasn't configured well.
See this for more informations.
https://askubuntu.com/questions/97669/i-cant-get-samba-to-set-proper-permissions-on-created-directories

How to pass variable file path to SQL*Loader on Linux

I'm creating .csv file and placing it in one location.
String location = "/APPL_TOP2/IMDD/apps/apps_st/appl/xxfin/12.0.0/bin/xe.csv";
Using exact path working fine on Windows but I need it to work on Linux client too.
String location = "$XXFIN_TOP\\12.0.0\\bin\\xe.csv";
If I'm using relevant path on Linux it is not working, showing Error
SQL*Loader-500: Unable to open file(/APPL_TOP2/IMDD/apps/apps_st/appl/xxfin/12.0.0/bin/xe.csv)
SQL*Loader-553: file not found
SQL*Loader-509: System error: No such file or directory
" Client is asking any option to pass relevant path client machine is Linux"
Paths in Linux have slashes which go the other way. So it should be this:
$XXFIN_TOP/12.0.0/bin/xe.csv

Access php temp file with java

I like to access an uploaded file which is temporarily stored in /tmp via php.
If I try to access it using the tmp_name from php which is the path I get this error:
java.io.FileNotFoundException: /tmp/php5UY3Ag (Permission denied)
The file is there. Otherwise I would get this error:
java.io.FileNotFoundException: /tmp/php5UY3Ag (No such file or directory)
I'm using the PHP JAVA Bridge to hand over the path.
Java is running under apache tomcat and php under the apache web server.
What do I have to do to get this working?

Deployment in tomcat

i am getting a problem
i have deployed a war file, when i run localy through tomcat it works fine but when i run on another system by giveing my system ip and then project folder e.g
http:\192.168.0.145\DllTest it loads the applet but when i click on a button to load the functionality it is throwing an exception
Exception in thread "AWT-EventQueue-3" java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: http:\192.168.0.145:8080\DllTest\lib\jinvoke.dll
while it is working fine localy but not in another system. Please tell me what is the problem.
Is it a rights issue or something else.
You cannot load a DLL on an external host. It has to be an absolute disk file system -as the exception message already hints. Your best bet is to download it manually, create a temp file and load it instead.
File dllFile = File.createTempFile("jinvoke", ".dll");
InputStream input = new URL(getCodeBase(), "lib/jinvoke.dll").openStream();
OuptutStream output = new FileOutputStream(dllFile);
// Write input to output and close streams the usual Java IO way.
// Then load it using absolute disk file system path.
System.loadLibrary(dllFile.getAbsolutePath());
dllFile.deleteOnExit();

Categories