[
https://jira.jboss.org/jira/browse/JBSEAM-3925?page=com.atlassian.jira.pl...
]
Norman Richards closed JBSEAM-3925.
-----------------------------------
Fix Version/s: 2.1.2.CR1
Resolution: Done
Updated with changes from javassist 3.8.0, which is the version imported by Seam. I
don't have any way to reproduce the issue, so please report back when you've tried
the fix.
Thanks.
java.lang.LinkageError: duplicate class definition in ProxyFactory
------------------------------------------------------------------
Key: JBSEAM-3925
URL:
https://jira.jboss.org/jira/browse/JBSEAM-3925
Project: Seam
Issue Type: Bug
Components: Core
Affects Versions: 2.0.0.GA
Reporter: Takayoshi Kimura
Assignee: Norman Richards
Fix For: 2.1.2.CR1
The ProxyFactory#createClass() method is not thread safe and causes LinkageError under
heavy load. This is same problem as JASSIST-28:
https://jira.jboss.org/jira/browse/JASSIST-28
Seam has a little bit modified version of ProxyFactory taken from Javassist 3.3. This
race condition issue has been fixed in Javassist 3.4. In Javassist 3.4 this method has a
synchronized block and also weak ref based cache mechanism has been added.
The ProxyFactory#createClass() is not thread safe and called from the following 3
methods:
1. Component#getProxyFactory(), this method is a synchronized method
2. ClientSideInterceptor#readResolve()
3. JavaBeanInterceptor#readResolve()
1 and (2 or 3) can run at the same time.
Possible options:
* Re-sync ProxyFacotory source code with 3.4 or later version
* Add a synchronized modifier/block to the ProxyFacotory#createClass() method
Exception stack trace:
Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component:
test
at org.jboss.seam.Component.newInstance(Component.java:1986)
at org.jboss.seam.Component.getInstance(Component.java:1876)
at org.jboss.seam.Component.getInstance(Component.java:1843)
at org.jboss.seam.Component.getInstanceInAllNamespaces(Component.java:2192)
at org.jboss.seam.Component.getValueToInject(Component.java:2144)
at org.jboss.seam.Component.injectAttributes(Component.java:1601)
at org.jboss.seam.Component.inject(Component.java:1419)
at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:45)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at
org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at
org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:26)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at
org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:27)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
at
org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
at
org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at
org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at
org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
... 184 more
Caused by: java.lang.RuntimeException: by java.lang.LinkageError: duplicate class
definition: org/javassist/tmp/java/lang/Object_$$_javassist_95
at org.jboss.seam.util.ProxyFactory.createClass(ProxyFactory.java:190)
at org.jboss.seam.Component.createProxyFactory(Component.java:2270)
at org.jboss.seam.Component.getProxyFactory(Component.java:1378)
at org.jboss.seam.Component.wrap(Component.java:1369)
at org.jboss.seam.Component.instantiateSessionBean(Component.java:1291)
at org.jboss.seam.Component.instantiate(Component.java:1276)
at org.jboss.seam.Component.newInstance(Component.java:1970)
... 212 more
Caused by: javassist.CannotCompileException: by java.lang.LinkageError: duplicate class
definition: org/javassist/tmp/java/lang/Object_$$_javassist_95
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:165)
at org.jboss.seam.util.ProxyFactory.createClass(ProxyFactory.java:186)
... 218 more
Caused by: java.lang.LinkageError: duplicate class definition:
org/javassist/tmp/java/lang/Object_$$_javassist_95
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at sun.reflect.GeneratedMethodAccessor50.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at javassist.util.proxy.FactoryHelper.toClass2(FactoryHelper.java:177)
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:159)
... 219 more
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira