Monday, 25 May 2015

Updating Glassfish 4 in 64-bit OS

I wanted to upgrade from Glassfish 4.0 to 4.1 and "pkg image-update" didn't work for me since I was using 64 bit OS without 32-bit support libraries. There might be other problems as well: like described by SO question http://stackoverflow.com/questions/17033118/glassfish-updatetool-linux-64-bit-issue. I was surprised that Glassfish's pkg tool supports only 32 bit systems - and to run them on 64 bit OS-es, you have to install compatibility libraries...

We can fix that! Following the guidelines given in this blog post and updates from this forum post, we can run pkg using OS's built-in 64-bit python. All modified files I've put in this github poject. Here are the steps:
  1. Hit the "pkg" tool: /opt/glassfish/bin/pkg (it should fail)
  2. mv /opt/glassfish/pkg/bin/pkg /opt/glassfish/pkg/bin/pkg.orig
  3. Download modified pkg script and copy to /opt/glassfish/pkg/bin/pkg
  4. mkdir /opt/glassfish/pkg/custom-lib
  5. cp -r /opt/glassfish/pkg/vendor-packages/pkg /opt/glassfish/pkg/custom-lib
  6. Install the dependencies so that we can compile the _actions.c:
    apt-get install python-dev gcc python-cherrypy python-mako python-openssl python-ply python-pycurl python-simplejson
  7. Download _actions.c (you can clone the project if you have git installed on the server)
  8. gcc -I/usr/include/python2.7 -shared -fpic -O2 _actions.c -o _actions.so
  9. cp _actions.so /opt/glassfish/pkg/custom-lib/pkg/actions/_actions.so
  10. download __init__.py from the project folder
  11. cp __init__.py /opt/glassfish/pkg/custom-lib/pkg/actions/__init__.py
  12. enjoy
Hope this helps! This worked for me - hopefully it will work for you as well.

No comments:

Post a Comment