Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Java Not working in AIX 6.1

Posted on 2013-01-30
20
Medium Priority
?
1,958 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 10
20 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 2000 total points
ID: 38835272
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
ID: 38835296
@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
ID: 38835334
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:gaugeta
ID: 38835356
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
ID: 38835364
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
ID: 38835402
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
ID: 38835422
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
ID: 38835435
How can I unset it.Do you want me to delete all contents of .tcshrc file?
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 38835447
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
ID: 38835475
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
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 38835490
unset LIBPATH

?
0
 

Author Comment

by:gaugeta
ID: 38835507
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
ID: 38835566
Seems it's tcsh.

set LIBPATH=
0
 

Author Comment

by:gaugeta
ID: 38835617
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
ID: 38835674
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
ID: 38835725
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
ID: 38835779
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
ID: 38835829
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
ID: 38836271
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
ID: 38837420
@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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Windows 7 does not have the best desktop search built in. This is something Windows 7 users have struggled with. You type something in, and your search results don’t always match what you are looking for, or it doesn’t actually work at all. There ar…
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.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

618 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