Posted by: cmani2010 | June 5, 2006

Porting ISV apps to Sun application server – some general guidelines

Our group gets involved in porting ISV applications to the Sun platform (OS/JDK/JES stack). I would like to share some experiences that I have had while portings apps to the Sun app server:

1. Getting web.xml to work on Sun app server is the key first step. Sun app server does not take too kindly to mistakes in web.xml. Hence make sure you run the web.xml through a xml validator like netbeans or xmlspy. The prime requirement is to get them validated against http://java.sun.com/j2ee/dtds/web-app_2_2.dtd. Some of things that you are bound to catch are things like duplicate entries, missing entries and entries in the wrong location. If we are porting to Servlet 2.3 spec, then there are other gotchas like url-pattern not allowing things like “*.do” anymore.

2. Porting to sun-web.xml is another big step. This involves configuring database connection pool, ejb mappings etc.

3. Since our app server (8.1 or 8.2) comes out of the box with JDK 1.5.x (though it also supports 1.4.2_06 and above), errors may come up when the source code gets compiled with JDK 1.5.

4. Another important thing is to get your ant build.xml ready, to do a compile/deploy thing multiple times. The best thing (thats what I do) is to copy one of the sample build.xml file that comes with the app server samples directory.

5. If EJB’s are being used, then a recompile is a must and creating the sun-ejb-jar.xml is the first step. If there are cmp mapping’s, use a tool like netbeans or Sun Java Studio enterprise to do the mappings against a database schema

6. Check the WEB-INF/lib directory of the ISV app, they usually pack a lot of jar files (some required and some unwanted).

7. Another biggie is the xml parsers. Sun app servers ship with the latest xml parsers and you may encounter parser library clashes. Either rewrite the code or set the older xml library in the app server JDK prefix classpath or set the classloader delegate property to false in sun-web.xml (see http://www.sun.com/software/dtd/appserver/sun-web-app_2_4-1.dtd for more details).

8. Another thing to watch out for is the web services that an ISV app may use. Sun app server bundles JWSDP, and if the ISV apps uses Apache Axis, the above library workarounds mentioned in xml parsers may work.
9. After we get this far, another thing that usually stumps the ISV is the way our App server is architected and how it runs. To put it simply, we have DAS (domain admin server) which is like the mother ship and has the admin console running on it (usually https and 4849 in app server 8.1) and has a app server server instance running on http/8080,https/8181). To create a new server instance, the first step is to create a node agent (run asadmin create-node-agent) and then start it (asadmin start-node-agent). The second step is to create a server instance with this node agent. This way, you have a server instance to play around with and not start and stop the DAS evertime. To restart this new server instance, you either stop/start the node agent or start/stop the server instance.

10. In case, you app server goes into a zombie state, do a “grep -i appserv”, kill them and do a asadmin start-domain.

11. One more major major thing, is that the Sun app server 8.x has the Security manager turned ON by default. Hence, if the ISV app does things writing files/network calls etc, we will get a permission issue in the app server server.log file. You will either need to give a explicit permission to the ISV app in server.policy (the preferred way) or to test it quickly disable the security manager (by deleting -Djava.security.policy proerty in JVM option – THIS IS NOT A GOOD THING IN PRODUCTION). I believe, this is not the case in Glassfish (Sun app server 9.x) and boy, I am happy !!

Ideally the Sun app server migration tool , should be sufficient. But hey, a tool can only go so far, and you will need to go down and get your hands a little dirty 🙂 This is not a comprehensive list of porting do’s and dont’s nor does it replace official Sun documentation 😉

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: