"Unable to access jarfile" on linux land

We have a web application running JBoss 5 that periodically runs the java process (using ProcessBuilder) to compile files on Linux. The process runs seamlessly on the Windows development machine and on the Ubuntu virtual machine we installed. The command is as follows:

/usr/java/jdk1.6.0_18/bin/java -Xmx256M -DiDesigner.javabin=java -jar "/aplicaciones/jboss/nfs/pmc_tdt/bin/lib/iDesigner.jar" --compiler --obfuscate --in "81.ida" --out "directory:OUTPUT" 

What creates the error:

 Unable to access jarfile "/aplicaciones/jboss/nfs/pmc_tdt/bin/lib/iDesigner.jar" 

All paths are validated, and the path to the ja file is enclosed in double quotes . After two beers and Big Mac, the system department confirmed that the user (jbossadmin) working with JBoss also owns the file:

 [ root@miv-multicanalidad-01 lib]# pwd /aplicaciones/jboss/nfs/pmc_tdt/bin/lib [ root@miv-multicanalidad-01 lib]# ls -l iDesigner.jar -rw-r--r-- 1 jbossadmin jbossadmin 1329162 ene 22 2010 iDesigner.jar 

I suspect this is a problem, so we asked them to change the permissions to execute , but, alas, they are still not satisfied.

The only thing I can think of is that this is a mistake in translating the path or that we did not apply the right to the right place!

Edit: An excellent suggestion by Andrea Spadecchini, however it seems that we already have permissions for passing through the path:

 drwxr-xr-x 3 root root 4096 abr 6 2010 /aplicaciones/ drwxr-xr-x+ 16 jbossadmin jbossadmin 4096 mar 7 10:13 /aplicaciones/jboss/ drwxrwxr-x+ 5 jbossadmin jbossadmin 4096 ene 25 09:21 /aplicaciones/jboss/nfs/ drwxr-xr-x 4 jbossadmin jbossadmin 4096 abr 6 16:03 /aplicaciones/jboss/nfs/pmc_tdt drwxr-xr-x 4 jbossadmin jbossadmin 4096 sep 3 2010 /aplicaciones/jboss/nfs/pmc_tdt/bin/ drwxr-xr-x 3 jbossadmin jbossadmin 4096 abr 6 16:03 /aplicaciones/jboss/nfs/pmc_tdt/bin/lib/ 

Edit:. With Eva, we can confirm that the execution of the line through the command line (bash) is executed, but it throws an error if we execute the line from the ProcessBuilder class embedded in the jar file on Linux. Just like our JBoss. The most likely cause of the problem here is double quotation marks around the parameters.

+6
java linux jar
source share
4 answers

@ian_scho Hello! I think the problem here is that command-line quotes are allowed because it is interpreted by the bash process on linux (which is interpreted by the command line) ... When the ProcessBuilder class is used inside java code, the quotes are interpreted as part of the path ... for this is shown "Unable to access jarfile" error. You can see the parent process using the ps -adf , try running your domain line in the background (&) as follows:

 /usr/java/jdk1.6.0_18/bin/java -Xmx256M -DiDesigner.javabin=java -jar "/aplicaciones/jboss/nfs/pmc_tdt/bin/lib/iDesigner.jar" --compiler --obfuscate --in "81.ida" --out "directory:OUTPUT" & 

and then call the command

 ps -adf 

you will see that the bash process is the parent ... If you do the same when you run jboss, you can see that the parent of the java process is another process that cannot interpret quotes.

I hope this helps you :)

+8
source share

Check if all directories leading to the JAR file have read and move permissions ( +rx ) for user jbossadmin .

+4
source share

If you use the Java command from the script shell, make sure that the script shell has Linux / Unix line terminators and not Windows terminators, as this could happen if the shell script was created on the Windows platform. The indicated error will certainly occur in in this case.

Use the Kate editor for Linux to check and fix, or the dos2unix utility, if available.

+1
source share

Change to the directory where the jar file is located.

 cd /aplicaciones/jboss/nfs/pmc_tdt/bin/lib/ 

Then execute the .jar file in the directory using

 java -jar ./iDesigner.jar 

It worked for me.

0
source share

All Articles