We are getting the exact same exception, with a different environment.
JBoss AS7 7.2.0.Final, Windows, JDK 1.7.0_13, Hibernate 4.2.2.Final, Postgres 9.1
We are using Hibernate JPA in the JBoss OSGi container.
When one of our services attempts to persist an entity with a field marked as @Lob the persistence fails with the exception message mentioned above.
This appears to be an issue with the way the ClobProxy is creating its Proxy instance over interfaces Clob and ClobImplementer.
The class loader that is used to initialise the PROXY_INTERFACES array may not be the same as the one returned by the ClassLoaderHelper.
Does anyone know why the ClassLoaderHelper is being used ?
It seems that just using the classloader assigned to Clob (and ClobImplementer) would be the right choice to use.
Code:
private static final Class[] PROXY_INTERFACES = { Clob.class, ClobImplementer.class };
. . .
public static Clob generateProxy(String string)
{
return (Clob)Proxy.newProxyInstance(getProxyClassLoader(), PROXY_INTERFACES, new ClobProxy(string));
}
. . .
protected static ClassLoader getProxyClassLoader()
{
ClassLoader cl = ClassLoaderHelper.getContextClassLoader();
if (cl == null) {
cl = ClobImplementer.class.getClassLoader();
}
return cl;
}