Solved

Java Not working in AIX 6.1

Posted on 2013-01-30
20
1,627 Views
Last Modified: 2013-01-30
I recently installed git in my AIX Server and git works fine.

But java is not working now.

If i do a java --version I'm getting the foll output.

admin:stud:/webapps/WEB-INF/classes> java -version
exec(): 0509-036 Cannot load program java because of the following errors:
        0509-150   Dependent module /opt/freeware/lib/libiconv.a(shr4_64.o) could not be loaded.
        0509-152   Member shr4_64.o is not found in archive

Open in new window

How can I fix this.

I installed GIT on my dev machine and this problem of the libiconv.a problem is occuring not containing shr4_64.o but in my qa machine libiconv.a was not even installed which has the same version of java installed as my dev machine.

Previouly the below java version was installed.

admin:stud:/demo> java -version
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build pap64dev-20080315 (SR7))
IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 AIX ppc64-64 j9vmap6423-20080315 (JIT enabled)
J9VM - 20080314_17962_BHdSMr
JIT  - 20080130_0718ifx2_r8
GC   - 200802_08)
JCL  - 20080314

Open in new window


This is a output from my QA server which has the same java installed as the dev machine which is currently giving me the error.

What can i do to fix this.

Please help..
0
Comment
Question by:gaugeta
  • 10
  • 10
20 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
Comment Utility
Do you have a LIBPATH which points to /opt/freeware/lib?

echo $LIBPATH

The original (and working) version of libiconv.a is in /usr/lib, so if there is a wrong LIBPATH unset it with

unset LIBPATH

and retry.

If the above doesn't help please post the output of

which java

and

ldd $(which java)
0
 

Author Comment

by:gaugeta
Comment Utility
@woolmilkporc:Thanks for replying.

The output of echo $LIBPATH

admin:stud:/demo> echo $LIBPATH
/dun/pvcspkg/pvcs81_aix/vm/common/lib/aix:/dun/pvcspkg/pvcs81_aix/vm/common/lib/aix:/local/lib:/stud_devel/lib:/sybase/ASE-15_0/lib:/sybase/OCS-15_0/lib:/sybase/OCS-15_0/lib3p:/sybase/OCS-15_0/lib3p64:/opt/freeware/lib:/usr/lib:/usr/lib/secure:/mftps/libs:/usr/lib:/usr/lib/secure

Open in new window


The output of which java
admin:stud:/demo> which java
/usr/java5_64/bin/java

Open in new window


ldd $(which java) did not return anythin saying its an "Illegal variable name."
0
 
LVL 68

Expert Comment

by:woolmilkporc
Comment Utility
As you can see, you have /opt/freeware/lib before /usr/lib in your LIBPATH, and this is the reason why your 64bit java tries to use the 32-bit only libiconv from there, which can't work.

So either change the sequence of path elements in your LIBPATH so that /usr/lib comes before /opt/freeware/lib or uninstall the freeware version of libiconv if you don't need it for other applications (rpm -e ...)

Which shell do you use? With ksh which is standard on AIX "ldd $(which java)" should work just fine, and also with bash. With csh try "ldd `which java` ".
0
 

Author Comment

by:gaugeta
Comment Utility
I need the libiconv gor GIT since its a dependency for git.

How can I reset my LIBPATHvariable so that /usr/lib comes before  /opt/freeware/lib.
0
 
LVL 68

Expert Comment

by:woolmilkporc
Comment Utility
Find out where it's being set.

This could be in /etc/environment, /etc/profile, your ~/.login, ~/.cshrc or ~/.tcshrc files.

Again, which shell do you use? tcsh?
0
 

Author Comment

by:gaugeta
Comment Utility
Yes its set in .tcshrc since I use a TC shell.

I reset the LIBPATH variable by putting /usr/lib before /opt/freeware/lib and then when I try checking my GIT and Java versions i get the foll output.

admin:stud:/demo> java -version
exec(): 0509-036 Cannot load program java because of the following errors:
        0509-150   Dependent module /opt/freeware/lib/libiconv.a(shr4_64.o) could not be loaded.
        0509-152   Member shr4_64.o is not found in archive


admin:stud:/demo> git --version
exec(): 0509-036 Cannot load program git because of the following errors:
        0509-150   Dependent module /usr/lib/libiconv.a(libiconv.so.2) could not be loaded.
        0509-152   Member libiconv.so.2 is not found in archive

Open in new window


And later when I put /opt/freeware/lib before /usr/lib my Git works but java still shows the same error.
0
 
LVL 68

Expert Comment

by:woolmilkporc
Comment Utility
At least java still has the wrong LIBPATH. Seems you didn't change it in the right place.

Can't you just try to "unset" the LIBPATH completely?

Most executables have  compiled-in paths.
0
 

Author Comment

by:gaugeta
Comment Utility
How can I unset it.Do you want me to delete all contents of .tcshrc file?
0
 
LVL 68

Expert Comment

by:woolmilkporc
Comment Utility
No.

Once logged in to your shell issue

unset LIBPATH

and retry. Don't logout/login inbetween. See my very first comment, btw.
0
 

Author Comment

by:gaugeta
Comment Utility
I removed the /opt/freeware/lib from my LIBPATH and my java works fine.

But my git is not working now.


admin:STUD:/demo> git --version
exec(): 0509-036 Cannot load program git because of the following errors:
        0509-150   Dependent module /usr/lib/libiconv.a(libiconv.so.2) could not be loaded.
        0509-152   Member libiconv.so.2 is not found in archive

Open in new window


If I try to put /opt/freeware/lib after /usr/lib both java and git does not work.

If I put /opt/freeware/lib before /usr/lib git works but java dosent.

And for java to work I have to completely remove /opt/freeware/lib from my LIBPATH variable.

How can I make both work.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 68

Expert Comment

by:woolmilkporc
Comment Utility
unset LIBPATH

?
0
 

Author Comment

by:gaugeta
Comment Utility
I tried both
1)unset LIBPATH
2)unset $LIBPATH

both have no output and after trying out these commands if i try : $echo $LIBPATH
I get the entire same sontents.

And still java does not work.
0
 
LVL 68

Expert Comment

by:woolmilkporc
Comment Utility
Seems it's tcsh.

set LIBPATH=
0
 

Author Comment

by:gaugeta
Comment Utility
I tried set LIBPATH=

And when I tried echo $LIBPATH nothing returned.
And GIT worked and Java did not.

And I started new terminal.
The  LIBPATH variable was set with contents I have in my .tcshrc file.
And now Git works and Java does not.

But currently in .tcshrc file /opt/freeware/lib is before /usr/lib.
So In what order do I nedd to arrange for bith to work.
Now I can make only Java or Git to work but not both.
0
 
LVL 68

Expert Comment

by:woolmilkporc
Comment Utility
After

set LIBPATH=

java should have worked!

Which error message did you get?

It could be that under tcsh you must run

unsetenv LIBPATH

or, if this doesn't work

setenv LIBPATH

Don't start a new terminal inbetween!
0
 

Author Comment

by:gaugeta
Comment Utility
After
 set LIBPATH=

Java did not work.And I got the error message.
admin:stud:/demo> java -version
exec(): 0509-036 Cannot load program java because of the following errors:
        0509-150   Dependent module /opt/freeware/lib/libiconv.a(shr4_64.o) coul                                             d not be loaded.
        0509-152   Member shr4_64.o is not found in archive

Open in new window


After unsetenv LIBPATH

Java works but Git does not work.

And if I start a parallel terminal after the above steps: Git works and Java does not.
0
 
LVL 68

Expert Comment

by:woolmilkporc
Comment Utility
unsetenv is only effective in your current shell. Starting a new shell will reinitialize the old environment by runnning .tcshrc.

Well, I fear you will have to create a script either for java or git, to get a valid LIBPATH setting.

For java a script called "myjava" could look like this:

#!/usr/bin/tcsh
unsetenv LIBPATH
java "$*"

Put "myjava" in a location available to all users, e.g. /usr/local/bin, then issue "chmod +x /usr/local/bin/myjava"

/usr/local/bin/myjava -version

should work now

You can additionally set in .tcsh

alias java "/usr/local/bin/myjava"

java -version

will also work now (after starting a new shell)
0
 

Author Comment

by:gaugeta
Comment Utility
Yes that  worked. at the first go

Now when I start a new terminal and I have set the alias before opening terminal.

And If I give java -version the control goes to next line and never and after a very long time returns

admin:stud:/demo> java -version
Word too long.

Open in new window

.

Aliasing is not working.
If I remove the alias and give the /full/path/of/myjava -version it works.

What's wrong here?

What about javac ?
Should I create a script for that too?
0
 
LVL 68

Expert Comment

by:woolmilkporc
Comment Utility
What do you mean with " I have set the alias before opening terminal"?

In order to have the alias immediately available after starting the terminal you must set it in .tcshrc. Did you do that?

If so, this must be  a tcsh issue.

I'd suggest changing the script to use ksh:

#!/usr/bin/ksh
unset LIBPATH
java "$@"

Please note that it's now "unset" instead of "unsetenv", and "$@" instead of "$*".

And yes, you must do the same for javac.
0
 

Author Comment

by:gaugeta
Comment Utility
@woolmilkporc: Thanks a lot.Worked perfectly.

What is the $@ in the java "$@" that I added in the script.

What's the best source to refer/study unix/linux administration.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Windows 10 is here and for most admins this means frustration and challenges getting that first working Windows 10 image. As in my previous sysprep articles, I've put together a simple help guide to get you through this process. The aim is to achiev…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now