Problem with Hibernate Proxy Creation on Virgo

Virgo logo

Yesterday I ran into a strange problem, where Hibernate could not successfully create proxy objects using Javassist. My setup had three bundles, a domain bundle with domain classes, a persistence bundle with Hibernate utilities, and a web bundle. When running on the Virgo Web Server, Hibernate would fail to create proxy objects with this strange error:

  1. java.lang.NoClassDefFoundError: javassist/util/proxy/ProxyObject

or

  1. java.lang.NoClassDefFoundError: org/hibernate/proxy/HibernateProxy

However, if you were to check the persistence bundle’s MANIFEST.MF, you would see that both javassist.util.proxy and org.hibernate.proxy packages were imported.

The problem turned out to be that the domain bundle also needed to import these packages. While I’m not exactly sure why, because Hibernate-related logic was all executed in the persistence bundle, it fixed my problem.

Note that I believe this is a problem specific to Virgo. Yesterday I also tried to run the same bundles on GlassFish 3.0.1, and while the web bundle failed to run, the Hibernate bundle could create the session factory and run successfully. The version of Virgo that had this problem was 2.1.0. I will see if it is fixed in the future versions.