Total Pageviews

Friday, February 10, 2012

Updating GlassFish 3.1 under RHEL 6 on a 64 Bit machine

Don't be surprised when you have problems updating GlassFish 3.1 on a RedHat Enterprise Linux 6 64 Bit machine. This will not work out of the box (officially Oracle only supports GlassFish on RedHat 4 and 5 not on version 6). But there is a way to get it to work.
You will get this error when executing the pkg command:

 [glassfish@MYMACHINE glassfish3]$ pkg list -u  
 Traceback (most recent call last):  
  File "/opt/glassfish/glassfish3/pkg/bin/", line 61, in ?  
   import pkg.actions as actions  
  File "/opt/glassfish/glassfish3/pkg/vendor-packages/pkg/actions/", line 59, in ?  
   globals(), locals(), [modname])  
  File "/opt/glassfish/glassfish3/pkg/vendor-packages/pkg/actions/", line 36, in ?  
   import generic  
  File "/opt/glassfish/glassfish3/pkg/vendor-packages/pkg/actions/", line 45, in ?  
   import pkg.variant as variant  
  File "/opt/glassfish/glassfish3/pkg/vendor-packages/pkg/", line 28, in ?  
   from pkg.misc import EmptyI  
  File "/opt/glassfish/glassfish3/pkg/vendor-packages/pkg/", line 49, in ?  
   import zlib  
 ImportError: cannot open shared object file: No such file or directory  
 There was an error running  
 You are running on a 64 bit Linux distribution and the 32 bit Linux  
 compatibility libraries do not appear to be installed. In order to use  
 the Update Center tools you must install the 32 bit compatibility libraries.  
 On Ubuntu (and possibly other Debian based systems) please install the  
 ia32-libs package. On RedHat 4 (and other RPM based systems), you may  
 need to add multiple 'compat' runtime library packages. Please see the  
 Update Center Release Notes for more information.  

The solution is to install the following packages using yum

yum install compat-db.i686 zlib.i686 libidn.i686 krb5-libs.i686

The trick is to find out about the correct names of the packages. It's easy on Debian based systems but quiet difficult on RPM based systems.
If you are using CentOS take a closer look at this blog post.