tapestry5 classloading problem

When running tapestry5 in combination with EJB3 beans, it is possible that you run into a “No ClassLoaders found for” exception with a stacktrace like the following

No ClassLoaders found for: xxx

Stack trace

        * javassist.runtime.Desc.getClassType(Desc.java:153)
        * javassist.runtime.Desc.getType(Desc.java:119)
        * javassist.runtime.Desc.getType(Desc.java:75)
        * be.synergetics.ca.t5gui.components.organization.Display._$read_parameter_object(Display.java)
        * be.synergetics.ca.t5gui.components.organization.Display.getObject(Display.java:23)
        * org.apache.tapestry.internal.bindings.PropBinding.get(PropBinding.java:54)
        * org.apache.tapestry.internal.structure.InternalComponentResourcesImpl.readParameter(InternalComponentResourcesImpl.java:198)
        * org.apache.tapestry.corelib.components.PageLink._$read_parameter_context(PageLink.java)
        * org.apache.tapestry.corelib.components.PageLink.beginRender(PageLink.java:75)
        * org.apache.tapestry.corelib.components.PageLink.beginRender(PageLink.java)
        * .....

When that happens it can be solved by adding the following line somewhere in your AppModule class.

javassist.runtime.Desc.useContextClassLoader = true;

It seems that the default behaviour for javassist is to use “Class.forName()” to instantiate classes. In some environments (notably JBoss) this does not work and the context classloader should be used. The line above assures that this is the case.

Leave a Reply

Your email address will not be published. Required fields are marked *

question razz sad evil exclaim smile redface biggrin surprised eek confused cool lol mad twisted rolleyes wink idea arrow neutral cry mrgreen