Developing and deploying 64-bit NSAPI plugins on top of 64-bit Sun Java System Web Server 7

Well, one of the many features of Sun Java System Web Server 7 is the support of 64-bit on Solaris (both SPARC and AMD64 platforms). Also, with the upcoming beta release of Sun Java System Enterprise Server 2006Q4(JES5) both  Sun Java System Portal Server and Sun Java System Access Manager will be able to leverage the 64-bit Web Server.  If in case, you haven't heard, Sun Java System Web Server 6.1 64-bit holds the world record for maximum number of simultaneous connections during SpecWeb 2005 benchmark. So, there are lot of potential benefits of moving over to 64-bit Web Server.

Currently, Sun Java System Access Manager and Portal Server deploy on top of Web Server as Java Web Application. Still, they had to follow the same ground rules that any 64-bit NSAPI plugin developer is required to do -  One is NOT supposed to intermingle 32-bit NSAPI  plugins or native libraries (shared library) with 64-bit Web Server and vice versa.  So, please take time to ensure that the Web Server is actually running in 64-bit mode before deploying any 64-bit NSAPI plugins or native libraries (shared library).

Well, if  you currently develop only Java Web Applications like JSP and Servlets and does not explicitly load any native library(shared library) on top of Sun Java System Web Server 7, then it is most likely that switching the server to 64-bit is all you need to leverage the 64-bit server mode, So, if you are one such customer, then the next section is just for you..

Steps to switch the Sun Java System Web Server 7 to 64-bit mode

  • Start Sun Java System Web Server 7 Administration Server
<INSTALL_ROOT>/bin/admin-server/bin/startserv
  • Run the following command to set the web server to start in 64-bit mode
<INSTALL_ROOT>/bin/wadm set-config-prop --user=admin --port=8989 platform=64 <CONFIG_NAME>
<INSTALL_ROOT>/bin/wadm deploy-config --restart=true <CONFIG_NAME>

where <INSTALL_ROOT> - is the top level location where in you have installed Sun Java System Web Server 7 in your system
and <CONFIG_NAME> - is the config name that you would like to configure in 64-bit mode (default is hostname.domainname like lsriramn.sun.com)


Now, if you are either one of the many popular sites that have written custom NSAPI plugins for different server administration tasks or a developer who is just looking around to develop 64-bit NSAPI plugin like the   popular 32-bit NSAPI  BEA WebLogic proxy plugin , then you will need to be aware of few other steps before you can leverage the 64-bit server mode.

Developing 64-bit NSAPI plugins

Either, you are developing a 64-bit NSAPI plugin for the first time or simply porting existing 32 bit NSAPI plugins to 64-bit, few issues to keep in mind are :
  • variables defined as long within the NSAPI program will hold 64-bit data model when compiled in 64-bit while hold 32-bit data model when compiled in 32-bit mode.
  • If your current NSAPI code either uses long and int interchangably or uses to cast - like (int) to convert a long data type to an integer,  then  you will need to fix your code !
  • Also, kindly make sure that your program does not assumes either the size of int and pointers(char \*) are not same. Similarly, size of int and long are not the same. 
  • Last but not the least, please take time to read through the Solaris 64-bit Developer Guide for a detailed walk-through to convert or develop your NSAPI program to run in 64-bit mode.
For e.g
if you run into a piece of code like this - here, the code is trying to assign a memory address to an integer by explicitly doing a cast from long to int , then you will need to fix your code.

char\* newString = strdup("hello world";);
int \*p = (long)newString;

  • Once, you have verified your NSAPI program, you can use either  Solaris Studio 11 compiler (which is also available as a free download !) or 'gcc' to compile this NSAPI plugin.
  • If you use Sun Studio 11 compiler, then you will need to use either -xarch=v9 (for SPARC 64-bit platform) and -xarch=amd64 (for AMD64 platforms)  to compile this program in 64-bit mode. Similarly, if you use 'gcc' then you will need to use '-m64' compile option to compile this program in 64-bit mode.

Deploying 64-bit NSAPI plugin on top of Sun Java System Web Server 7

Please check out my earlier blog on how to install NSAPI plugin on top of Sun Java System Web Server 7.  Besides, what I had mentioned earlier,  few key issues to keep in mind or steer clear of :
  • In a hurry to get going, don't end up copying your recently built NSAPI plugins (shared libraries) directly into Sun Java System Web Server's lib directory. This is a very wrong approach and should be strongly discouraged.
  • I am sure, you will need an installer to update the plugin configuration files like magnus.conf , and obj.conf   so as to make Web Server load these NSAPI plugin at the time of server startup.
  •  In this case, you might want to a write a few line of code to confirm that the server is indeed running in 64-bit before deploying  64-bit NSAPI plugin on top of Web Server.
  • One caveat with this approach is that if in case, for some reason at a later date, you would like to start  the server  in 32 bit mode then you will need to edit the magnus.conf  so as to load the 32-bit version of NSAPI plugin at this time. Without this change, Web Server will not be able to start successfully in 32-bit mode. You will need to do this for the same reason that 64 bit NSAPI plugins needs to be deployed only on top of 64-bit Sun Java System Web Server 7. I guess, one needs a better solution here. 
Will see, if  I can follow it up and come up with a better approach to install these 3rd party NSAPI plugins.

Any comments / concerns, please feel free to write back to me.
Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Sharing what little I know

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today