Home > java > Class loading: JBoss AS vs. WAS

Class loading: JBoss AS vs. WAS

Lipiec 6th, 2010

Recently I got a task - take the "JEE" application from JBoss AS 5.1 and run it on WAS 7.0. It shouldn't be difficult - we have JEE standard after all ;-)

Of course it's easier said than done. The first issue that I had to struggle with a little was the class loading.

"By default JBoss (prior to version 3.2) uses a flat class loading model that avoids the need to redundantly include classes in different layers. " (http://community.jboss.org/wiki/ClassLoadingConfiguration)

Basically, if you need a class, just drop it into lib/ or deploy/ and that's it. Of course this is the simplistic approach, comfortable for development time, but not so good for production.

Websphere on the other hand uses different approach (by default) - it uses a hierarchy of classloaders. So trying just to move the application from JBoss to WAS ended with a tone of ClassNotFoundException and ClassCastException. The later one is cause by the fact that classes in Java are identified by their fully qualified names AND their classloaders. So if the same class is loaded by two different classloaders it is in fact considered as a different one.

In theory it is possible to configure JBoss to work like WAS, or the other way. I haven't tried that. Anyone?

Resources

http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/crun_classload.html

http://community.jboss.org/wiki/jbossclassloadingusecases

http://community.jboss.org/wiki/ClassLoadingConfiguration

http://community.jboss.org/wiki/JBossClassLoaderOverviewandGoals

http://community.jboss.org/docs/DOC-13268?uniqueTitle=false

java

  1. Lipiec 9th, 2010 at 18:32 | #1

    WAS sux:P I still didn’t figure out how to replace JSF implementation. parent last/first option does not work for me ;-/
    Maybe you have somewhere link for tutorial with solution how to change standard implementation of framework in WAS (OpenJPA/JSF)?

    Łukasz

  1. No trackbacks yet.