Sunday, December 6, 2009

GlassFish and Adf Toplink 10g

After my success in deploying an ADF Faces web application in Glassfish (2.1.1), I got a crazy idea. Why not try deploying an ADF Faces with ADF Toplink (EJB 3.0 SessionBean with Pojos) enterprise application in GlassFish? Oracle has deploying instructions for JBoss and WebLogic. What these application Servers have more than GlassFish? Exactly. Nothing!

So I put my thoughts into work. The first success came when I put toplink.jar in ${glassfish}/lib, restarted the server and the model was successfully deployed with no errors! Then I started adding one by one all the runtime libraries that where reported missing by glassfish deployer. Finally I reached a point where deployment was successful, but there were still runtime errors. I continued adding more libraries, one by one. But when I added xmlparserv2.jar library I returned to square one. The deployment was once again unsuccessful. I googled the error:

------------------------------------------------
java.lang.UnsupportedOperationException: This parser does not support specification "null" version "null"
at javax.xml.parsers.DocumentBuilderFactory.setSchema(DocumentBuilderFactory.java:561)
...
-----------------------------------------------


All hits I got for this error was about using an older xml parser. But I could not figure out why. I searched inside the xmlparserv2.jar and found some javax.* classes apart from oracle.* classes. So I deleted all javax.* classes from inside the jar in order not to override the default classes, and I created a new xmlparserv2.jar (I also removed from xmlparserv2.jar the directory META-INF/services). I renamed it to oxmlparserv2.jar and added it to project libraries.

The application was deployed once again. I was really happy. But my troubles weren't over yet. Not even a simple query would run without giving the error:

----------------------------------------------
javax.servlet.ServletException: javax.el.MethodNotFoundException: Method not found: findItemByName.execute(javax.faces.event.ActionEvent)
root cause
javax.faces.el.MethodNotFoundException: javax.el.MethodNotFoundException: Method not found: findItemByName.execute(javax.faces.event.ActionEvent)
root cause
javax.el.MethodNotFoundException: Method not found: findItemByName.execute(javax.faces.event.ActionEvent)
----------------------------------------------


This was an even more obscure error. I presumed it would still have to do with some missing library. All I needed was to find which library. But there was no error 'noClassDefFoundError' to help me this time! Then I remembered that JDeveloper supports installing all of its runtime libraries to various applications servers, why not glassfish too? Since there is no glassfish installation process in JDeveloper, I improvised. I downloaded a JBoss v4 and installed it. I opened JDeveloper 10.1.3.5 and then I followed the menu:
Tools --> ADF Runtime Installer --> JBoss.
I completed the installation throught the wizard. Jdev then displayed a summary of the installed libraries. Based on this list I figured out that I only needed to use those libraries that were installed in {server}/default/lib directory of JBoss. The others did not seem very important. Here is a list of those that worked form me:

----------------------------------------------------
adf-connections.jar
adfbinding.jar
adfcm.jar
adfm.jar
adfmtl.jar
adfmweb.jar
adfshare.jar
adfui.jar
antlr.jar
bc4jct.jar
bc4jctejb.jar
bc4jdomgnrc.jar
bc4jdomorcl.jar
bc4jimdomains.jar
bc4jmt.jar
bc4jmtejb.jar
cache.jar
collections.jar
commons-cli-1.0.jar
commons-el.jar
concurrent.jar
dc-adapters.jar
dms.jar
http_client.jar
jazncore.jar
jdev-cm.jar
jsp-el-api.jar
libs.txt
mdsrt.jar
ojdbc14.jar
ojpse.jar
oracle-el.jar
oraclepki.jar
ordhttp.jar
ordim.jar
osdt_cert.jar
osdt_core.jar
osdt_saml.jar
osdt_wss.jar
osdt_xmlsec.jar
oxml.jar
oxmlparserv2.jar
runtime12.jar
share.jar
toplink-agent.jar
toplink.jar
translator.jar
xmlef.jar
xsqlserializers.jar
xsu12.jar
----------------------------------------------------


So I copied them to my {glassfish}/lib dir. Except for xml.jar and xmlparserv2.jar. For those two I deleted all javax.* classes from the jar and then I copied them with new names, as oxmlparserv2.jar and oxml.jar, in order to distinguish them in the future.

The result was astounding. The application was deployed successfully and run a query! Total Success!

All that is left to do now, is run thorough tests on every adf-toplink application that needs to be deployed in glassfish, so as to find any minor inconsistencies. As a hint, I have found that the path is handled differently between the two servers. This thought will solve almost 90% of the rest of the incompatibility problems.

Concluding, I need to say that glassfish server has already surpassed my expectations. It is a free open source application server that can compete evenly with other commercial application servers. And if it can run oracle's applications, then it can run any j2ee application!

I want to add as a last thought, as a big organization's application server administrator, a comparison, between glassfish and oas. Say we have 35.000 Euros to spent for a linux application server, hardware and software.

In case we buy oas enterprise edition, its price goes to about 15.000 Euros a core. So with 35.000 Euros we get a dual core license and that leaves 5.000 to get a machine with the best dual core in the market, and at least 10GB of memory. Let's assume that the rest of the hardware will be the same.

In case we choose glassfish, all the money goes to hardware. What do we buy with 35.000 Euros? Two machines (as I saw at dell's site) with 24 cores ( 4 x Intel 6cores) and 48GB memory each. Which sums up to 48 cores running almost at top speed and 96GB of memory. With both servers we get clustering and support. And I need to add that glassfish community support is as good as oracle's.

What I make of it? I don't care how fast oas is. It may even be twice as fast (or even thrice as fast) as glassfish. Who cares? With those money and glassfish one can buy 24 times more cpus and memory.

And as a last stroke, I need to add the yearly support fee to oracle. Instead of paying support and licensing fees, which amount in around 20% a year. If we save this money, we can invest them in a new system every four or five years. (And all the rest of the money can go to seminars!)

A clear win for open source and glassfish against oracle application server!


P.S.
There is an error in this comparison. While GlassFish is open source and therefore free, the use of ADF framework is not. I have a more accurate comparison here.

5 comments:

  1. The one thing you neglected to mention is that to deploy the ADF runtime to a non-Oracle application server that you need to license it...

    ReplyDelete
  2. Excelente ....
    muchas gracias....

    ReplyDelete
  3. Nice post, very informative and comparative.

    ReplyDelete
  4. how i can deploy an ADF application in Oracle Glassfish server?, my application in ADF use some Tabs, when yo deploy your ADF application in GFish they permit run all ADF - JSF and JSFF components?

    ReplyDelete