Ilia Ilia created JASSIST-231:
---------------------------------
Summary: ProxyFactory.createClass throws RuntimeException caused by
CannotCompileException caused by NoClassDefFoundError
Key: JASSIST-231
URL:
https://issues.jboss.org/browse/JASSIST-231
Project: Javassist
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 3.18.2-GA
Environment: Windows 8.1, Eclipse OSGi
Reporter: Ilia Ilia
Assignee: Shigeru Chiba
This appears to be a very old bug which happens on Eclipse OSGi projects.
I have found the same issue filed at 2012.
http://www.coderanch.com/t/563250/vc/Tomcat-Startup-Error-Javassist
It still happens on the latest javassist release 3.18.2-GA
{noformat}
14-07-31 15:25:37 [ WARN] org.hibernate.type.TypeFactory {main}
HHH000233: Scoping types to session factory
org.hibernate.internal.SessionFactoryImpl@6e710b23 after already scoped
org.hibernate.internal.SessionFactoryImpl@3f925f7a
java.lang.RuntimeException: by java.lang.NoClassDefFoundError:
platform/server/core/general/protocol/ProtocolBuffer
at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:515)
at javassist.util.proxy.ProxyFactory.createClass2(ProxyFactory.java:492)
at javassist.util.proxy.ProxyFactory.createClass1(ProxyFactory.java:428)
at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:400)
at
platform.server.core.general.system.service.cache.impl.checker.CacheReusableCheckerBuilderImpl.createClass(CacheReusableCheckerBuilderImpl.java:110)
at
platform.server.core.general.system.service.cache.impl.checker.CacheReusableCheckerBuilderImpl.buildChecker(CacheReusableCheckerBuilderImpl.java:55)
at
platform.server.core.general.system.service.cache.impl.CacheWithReusableCorrect.newInstance(CacheWithReusableCorrect.java:19)
at
platform.server.core.general.system.service.cache.impl.Cache.getInstance(Cache.java:44)
at
platform.server.core.general.system.service.cache.impl.CacheWithReusableCorrect.getInstance(CacheWithReusableCorrect.java:25)
at
platform.server.core.general.protocol.impl.Protocol.newProtocolBuffer(Protocol.java:374)
at
platform.server.core.general.redis.api.codec.RedisCodec.decodeStruct(RedisCodec.java:134)
at platform.server.core.general.redis.api.codec.RedisCodec.decode(RedisCodec.java:72)
at
platform.server.core.general.redis.api.protocol.decoders.BinaryDecoder.decodeBinary(BinaryDecoder.java:64)
at
platform.server.core.general.redis.api.protocol.decoders.BinaryDecoder.decode(BinaryDecoder.java:95)
at
platform.server.core.general.redis.api.protocol.decoders.BlockDecoder.decode(BlockDecoder.java:40)
at
platform.server.core.general.redis.api.protocol.ResultDecoder.decode(ResultDecoder.java:41)
at
platform.server.core.general.redis.api.RedisConnection.decodeItem(RedisConnection.java:186)
at
platform.server.core.general.redis.api.RedisConnection.readResult(RedisConnection.java:168)
at platform.server.core.general.redis.api.RedisConnection.call(RedisConnection.java:146)
at
platform.server.core.general.redis.api.RedisConnection._doCommand(RedisConnection.java:114)
at platform.server.core.general.redis.api.RedisAPI.doCommand(RedisAPI.java:45)
at
platform.server.core.general.redis.api.SelectorConnection.doCommand(SelectorConnection.java:131)
at platform.server.core.general.redis.api.RedisClient.map_hgetall(RedisClient.java:509)
at
platform.server.core.general.statistics.charts.impl.ChartStorage.getCharts(ChartStorage.java:69)
at
platform.server.core.general.statistics.charts.impl.ChartRegistryImpl.loadChartFromStorage(ChartRegistryImpl.java:40)
at
platform.server.core.general.statistics.charts.impl.ChartRegistryImpl.<init>(ChartRegistryImpl.java:36)
at
platform.server.core.general.statistics.osgi.Activator.start_plugin(Activator.java:47)
at
platform.server.core.general.system.service.ServiceAccessor.start(ServiceAccessor.java:119)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
at java.security.AccessController.doPrivileged(Native Method)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:341)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:333)
at platform.equinox.runner.RunnerMojo.runOSGiFramework(RunnerMojo.java:207)
at platform.equinox.runner.RunnerMojo.execute(RunnerMojo.java:89)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: javassist.CannotCompileException: by java.lang.NoClassDefFoundError:
platform/server/core/general/protocol/ProtocolBuffer
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:170)
at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:507)
... 58 more
Caused by: java.lang.NoClassDefFoundError:
platform/server/core/general/protocol/ProtocolBuffer
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at sun.reflect.GeneratedMethodAccessor29.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at javassist.util.proxy.FactoryHelper.toClass2(FactoryHelper.java:182)
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:164)
... 59 more
Caused by: java.lang.ClassNotFoundException:
platform.server.core.general.protocol.ProtocolBuffer
at
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 66 more
org.osgi.framework.BundleException: Exception in
platform.server.core.general.statistics.osgi.Activator.start() of bundle
platform.server.core.general.Statistics.
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:734)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:341)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:333)
at platform.equinox.runner.RunnerMojo.runOSGiFramework(RunnerMojo.java:207)
at platform.equinox.runner.RunnerMojo.execute(RunnerMojo.java:89)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: by
java.lang.NoClassDefFoundError: platform/server/core/general/protocol/ProtocolBuffer
at
platform.server.core.general.system.service.cache.impl.checker.CacheReusableCheckerBuilderImpl.buildChecker(CacheReusableCheckerBuilderImpl.java:103)
at
platform.server.core.general.system.service.cache.impl.CacheWithReusableCorrect.newInstance(CacheWithReusableCorrect.java:19)
at
platform.server.core.general.system.service.cache.impl.Cache.getInstance(Cache.java:44)
at
platform.server.core.general.system.service.cache.impl.CacheWithReusableCorrect.getInstance(CacheWithReusableCorrect.java:25)
at
platform.server.core.general.protocol.impl.Protocol.newProtocolBuffer(Protocol.java:374)
at
platform.server.core.general.redis.api.codec.RedisCodec.decodeStruct(RedisCodec.java:134)
at platform.server.core.general.redis.api.codec.RedisCodec.decode(RedisCodec.java:72)
at
platform.server.core.general.redis.api.protocol.decoders.BinaryDecoder.decodeBinary(BinaryDecoder.java:64)
at
platform.server.core.general.redis.api.protocol.decoders.BinaryDecoder.decode(BinaryDecoder.java:95)
at
platform.server.core.general.redis.api.protocol.decoders.BlockDecoder.decode(BlockDecoder.java:40)
at
platform.server.core.general.redis.api.protocol.ResultDecoder.decode(ResultDecoder.java:41)
at
platform.server.core.general.redis.api.RedisConnection.decodeItem(RedisConnection.java:186)
at
platform.server.core.general.redis.api.RedisConnection.readResult(RedisConnection.java:168)
at platform.server.core.general.redis.api.RedisConnection.call(RedisConnection.java:146)
at
platform.server.core.general.redis.api.RedisConnection._doCommand(RedisConnection.java:114)
at platform.server.core.general.redis.api.RedisAPI.doCommand(RedisAPI.java:45)
at
platform.server.core.general.redis.api.SelectorConnection.doCommand(SelectorConnection.java:131)
at platform.server.core.general.redis.api.RedisClient.map_hgetall(RedisClient.java:509)
at
platform.server.core.general.statistics.charts.impl.ChartStorage.getCharts(ChartStorage.java:69)
at
platform.server.core.general.statistics.charts.impl.ChartRegistryImpl.loadChartFromStorage(ChartRegistryImpl.java:40)
at
platform.server.core.general.statistics.charts.impl.ChartRegistryImpl.<init>(ChartRegistryImpl.java:36)
at
platform.server.core.general.statistics.osgi.Activator.start_plugin(Activator.java:47)
at
platform.server.core.general.system.service.ServiceAccessor.start(ServiceAccessor.java:119)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
at java.security.AccessController.doPrivileged(Native Method)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
... 28 more
Caused by: java.lang.RuntimeException: by java.lang.NoClassDefFoundError:
platform/server/core/general/protocol/ProtocolBuffer
at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:515)
at javassist.util.proxy.ProxyFactory.createClass2(ProxyFactory.java:492)
at javassist.util.proxy.ProxyFactory.createClass1(ProxyFactory.java:428)
at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:400)
at
platform.server.core.general.system.service.cache.impl.checker.CacheReusableCheckerBuilderImpl.createClass(CacheReusableCheckerBuilderImpl.java:110)
at
platform.server.core.general.system.service.cache.impl.checker.CacheReusableCheckerBuilderImpl.buildChecker(CacheReusableCheckerBuilderImpl.java:55)
... 53 more
Caused by: javassist.CannotCompileException: by java.lang.NoClassDefFoundError:
platform/server/core/general/protocol/ProtocolBuffer
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:170)
at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:507)
... 58 more
Caused by: java.lang.NoClassDefFoundError:
platform/server/core/general/protocol/ProtocolBuffer
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at sun.reflect.GeneratedMethodAccessor29.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at javassist.util.proxy.FactoryHelper.toClass2(FactoryHelper.java:182)
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:164)
... 59 more
Caused by: java.lang.ClassNotFoundException:
platform.server.core.general.protocol.ProtocolBuffer
at
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 66 more
{noformat}
CacheReusableCheckerBuilderImpl.buildChecker
{code}
final Class<?> objectClass = object.getClass();
ProxyFactory proxyFactory = new ProxyFactory() {
@Override
protected ClassLoader getClassLoader() {
return CacheReusableCheckerBuilderImpl.class.getClassLoader();
}
};
proxyFactory.setSuperclass(objectClass);
List<Class> interfaces = new ArrayList<>();
interfaces.addAll(Arrays.asList(objectClass.getInterfaces()));
interfaces.add(CacheReusableChecker.class);
proxyFactory.setInterfaces(interfaces.toArray(new Class[interfaces.size()]));
Class<T> proxyFactoryClass = createClass(proxyFactory);
{code}
CacheReusableCheckerBuilderImpl.createClass
{code}
@SuppressWarnings("unchecked")
private <T> Class<T> createClass(ProxyFactory proxyFactory) {
return proxyFactory.createClass();
}
{code}
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)