-
1. Re: Javassist errors with latest jboss
starksm64 May 18, 2006 8:53 AM (in response to teknokrat)Full stacktrace and the details of the deployment are needed to try to reproduce this.
-
2. Re: Javassist errors with latest jboss
teknokrat May 18, 2006 12:01 PM (in response to teknokrat)Its hard to reproduce everything since its already a complete application
A simple example is the Company class, mapped as<class name="Company" table="company"> <id name="id" type="integer"> <generator class="native" /> </id> <property name="name" /> <property name="enabled" type="boolean" /> <set name="applications" table="app" inverse="true" > <key column="company" /> <one-to-many class="Application"/> </set> </class>
the stack trace is2006-05-18 16:52:20,670 WARN [org.hibernate.tuple.PojoEntityTuplizer] could not create proxy factory for:Company org.hibernate.HibernateException: Javassist Enhancement failed: Company at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxyFactory(JavassistLazyInitializer.java:149) at org.hibernate.proxy.pojo.javassist.JavassistProxyFactory.postInstantiate(JavassistProxyFactory.java:42) at org.hibernate.tuple.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:159) at org.hibernate.tuple.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:131) at org.hibernate.tuple.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:50) at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:64) at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:256) at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:418) at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:108) at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:223) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1213) at org.jboss.hibernate.jmx.Hibernate.buildSessionFactory(Hibernate.java:231) at org.jboss.hibernate.jmx.Hibernate.startService(Hibernate.java:155) at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289) at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245) at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94) at org.jboss.mx.server.Invocation.invoke(Invocation.java:86) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978) at $Proxy0.start(Unknown Source) at org.jboss.system.ServiceController.start(ServiceController.java:417) at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94) at org.jboss.mx.server.Invocation.invoke(Invocation.java:86) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210) at $Proxy4.start(Unknown Source) at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302) at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1007) at org.jboss.deployment.MainDeployer.start(MainDeployer.java:997) at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:808) at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:771) at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94) at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133) at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142) at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210) at $Proxy8.deploy(Unknown Source) at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421) at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225) Caused by: java.lang.RuntimeException: duplicate method: getId at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:173) at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxyFactory(JavassistLazyInitializer.java:141) ... 59 more Caused by: javassist.CannotCompileException: duplicate method: getId at javassist.bytecode.ClassFile.testExistingMethod(ClassFile.java:544) at javassist.bytecode.ClassFile.addMethod(ClassFile.java:528) at javassist.util.proxy.ProxyFactory.override(ProxyFactory.java:373) at javassist.util.proxy.ProxyFactory.overrideMethods(ProxyFactory.java:349) at javassist.util.proxy.ProxyFactory.make(ProxyFactory.java:277) at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:164) ... 60 more
My jboss-service.xml which defines the hibernate MBean is identical to the example in the docs.
The Company class inherits from an Entity superclass which defines the getId() method. -
3. Re: Javassist errors with latest jboss
crnip May 22, 2006 10:09 AM (in response to teknokrat)We have produce the same error. In our case we have an entity
called Contract which implements an interface where methods are defined
which entity must implement.
I think that javassist has problems enhancing entity object which implement
an interface.
Silvo Koren -
4. Re: Javassist errors with latest jboss
penczek May 22, 2006 11:27 AM (in response to teknokrat)I have the exactly same problem here. I identified this error when my subclass extends other with generics, restricting the parameters.
Example:------------------------------------------------------------------- PersistentObject.java public interface PersistentObject<U, V> extends java.io.Serializable { public U getOid(); public void setOid(U oid); public V getVersion(); public void setVersion(V version); } ------------------------------------------------------------------- BasePersistentObjectImpl.java public abstract class BasePersistentObjectImpl<OID, VERSION> implements PersistentObject<OID, VERSION> { protected OID oid; protected VERSION version; public void setOid(OID oid) { this.oid = oid; } public void setVersion(VERSION version) { this.version = version; } } --------------------------------------------------------------- OIDPersistentObjectImpl.java import javax.persistence.*; @MappedSuperclass public abstract class OIDPersistentObjectImpl<OID extends CharSequence, VERSION> extends BasePersistentObjectImpl<OID, VERSION> { @Id @GeneratedValue public OID getOid() { return oid; } @Version public VERSION getVersion() { return version; } } ------------------------------------------------------------------- PersonVo.java public interface PersonVo extends PersistentObject<String, Integer> { public String getName(); public void setName(String name); } ------------------------------------------------------------------- PersonVoImpl.java import javax.persistence.Entity; @Entity public class PersonVoImpl extends OIDPersistentObjectImpl<String, Integer> implements PersonVo { private String name; public String getName() { return this.name; } public void setName(String name) { this.name = name; } } -------------------------------------------------------------------
This example gives the following error:12:15:40,372 ERROR [BasicLazyInitializer] Javassist Enhancement failed: test.PersonVoImpl java.lang.RuntimeException: duplicate method: getOid at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:173) at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxyFactory(JavassistLazyInitializer.java:141) at org.hibernate.proxy.pojo.javassist.JavassistProxyFactory.postInstantiate(JavassistProxyFactory.java:42) at org.hibernate.tuple.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:159) at org.hibernate.tuple.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:131) at org.hibernate.tuple.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:50) at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:64) at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:256) at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:418) at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:108) at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:223) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1213) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:631) at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:760) at org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:350) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:119) at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264) 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.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:99) at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289) at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245) at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94) at org.jboss.mx.server.Invocation.invoke(Invocation.java:86) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978) at $Proxy0.start(Unknown Source) at org.jboss.system.ServiceController.start(ServiceController.java:417) at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94) at org.jboss.mx.server.Invocation.invoke(Invocation.java:86) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210) at $Proxy49.start(Unknown Source) at org.jboss.ejb3.JmxKernelAbstraction.install(JmxKernelAbstraction.java:82) at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:626) at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:475) at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:139) at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289) at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245) at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94) at org.jboss.mx.server.Invocation.invoke(Invocation.java:86) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978) at $Proxy0.start(Unknown Source) at org.jboss.system.ServiceController.start(ServiceController.java:417) at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94) at org.jboss.mx.server.Invocation.invoke(Invocation.java:86) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210) at $Proxy34.start(Unknown Source) at org.jboss.ejb3.EJB3Deployer.start(EJB3Deployer.java:449) 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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94) at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133) at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142) at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97) at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238) at org.jboss.ws.server.WebServiceDeployer.start(WebServiceDeployer.java:117) at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188) at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95) at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210) at $Proxy35.start(Unknown Source) at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1007) at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:808) at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:771) at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94) at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133) at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142) at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210) at $Proxy6.deploy(Unknown Source) at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421) at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263) at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336) at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289) at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245) 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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94) at org.jboss.mx.server.Invocation.invoke(Invocation.java:86) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978) at $Proxy0.start(Unknown Source) at org.jboss.system.ServiceController.start(ServiceController.java:417) 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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94) at org.jboss.mx.server.Invocation.invoke(Invocation.java:86) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210) at $Proxy4.start(Unknown Source) at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302) at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1007) at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:808) at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:771) at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:755) 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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94) at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133) at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142) at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210) at $Proxy5.deploy(Unknown Source) at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482) at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362) at org.jboss.Main.boot(Main.java:200) at org.jboss.Main$1.run(Main.java:464) at java.lang.Thread.run(Thread.java:595) Caused by: javassist.CannotCompileException: duplicate method: getOid at javassist.bytecode.ClassFile.testExistingMethod(ClassFile.java:544) at javassist.bytecode.ClassFile.addMethod(ClassFile.java:528) at javassist.util.proxy.ProxyFactory.override(ProxyFactory.java:373) at javassist.util.proxy.ProxyFactory.overrideMethods(ProxyFactory.java:349) at javassist.util.proxy.ProxyFactory.make(ProxyFactory.java:277) at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:164) ... 161 more
If I remove the "extends CharSequence" from the OID generic parameter in class OIDPersistentObjectImpl.java, the example works perfectly.
This error began to happen in the jboss4.0.4.ga, with Hibernate Annotations and Entitymanager 3.2.0 CR1. With Annotaions and Entitymanager 3.1 beta this error doesnt happen.
Probably a new "bugfeature" of the new version of Hibernate?? -
5. Re: Javassist errors with latest jboss
penczek May 22, 2006 7:30 PM (in response to teknokrat)Ok, some steps of debug later, i found that Jboss 4.0.4.ga.patch1 use javassist 3.2.0.cr2, and the production (stable) version of javassist is 3.1.
Well, i tried to put the stable version in new Jboss and voilá, nothing happens, the error continued to occur. I think that the stable version of javassist, associated with the 3.1.beta version of hibernate annotations/entitymanager, the position of the Moon, Mars and Pluto was influencing this error.
The error of duplicated method occurs because Sun has implemented generics in a very awful way: a unique generic method produces 2 method in runtime, with the same signature, one volatile returning Object, and other the correct. This was confusing my javassist, and making some mods I could correct the bizarre "duplicated method" error.
Do something like that in class ProxyFactory:javassist.util.proxy.ProxyFactory ... private static boolean isVisible(int mod, String from, Member meth) { // this allow generics if ((mod & Modifier.VOLATILE) != 0) return false; else if ((mod & Modifier.PRIVATE) != 0) return false; else if ((mod & (Modifier.PUBLIC | Modifier.PROTECTED)) != 0) return true; else { String p = getPackageName(from); String q = getPackageName(meth.getDeclaringClass().getName()); if (p == null) return q == null; else return p.equals(q); } } } ...
In this way, any volatile method isn't added to the class, avoiding the "duplicated" error. -
6. Re: Javassist errors with latest jboss
ablevine1 Jun 8, 2006 3:17 PM (in response to teknokrat)I am getting the same error. I just wanted to add a little bit of information. For me my code worked fine with jboss-4.0.4.GA using the ejb3-clustered configuration. As soon as I updated to jboss-4.0.4-Patch1 with the same configuration and code, I began getting the errors described above. Similarily to the code listed by penczek I am using an inheritance hierarchy that inherits from a @MappedSuperclass, in which the getID method is defined, although my classes are not defined using generics a the class level.
It seems as if the duplicate method error is always occurring on the member function that is annotated with the @Id annotation. It looks as if that is the case for penczek as well. Does this mean that the use of inheritance hierarchies with mapped superclasses is completely broken for this jboss release?? Is there any bug that was filed for this issue yet that anyone knows of?? -
7. Re: Javassist errors with latest jboss
ablevine1 Jun 8, 2006 3:37 PM (in response to teknokrat)I believe I figured out what the underlying issue is. see this post:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=84174
Apparently, when entities use inheritance and have a return type for an overridden method that is different form the base class the "duplicate method" exception occurrs. -
8. Re: Javassist errors with latest jboss
penczek Jun 13, 2006 10:52 AM (in response to teknokrat)Well, like I said, using generics can cause this error, because it generates 2 different methods in runtime.
Your example use the same principle of generics: u are redefining the returning type of a method to a subtype of original, and this produces the same two methods, one volatile, other concrete.
Your code doesnt compile in JDK1.4 because there's no support to generics in it.
My javassist mode will resolve your problem too. -
9. Re: Javassist errors with latest jboss
fsl Jul 24, 2006 1:16 PM (in response to teknokrat)Would someone be kind enough to post a fixed javassit.jar that we can install over the jboss-4.0.4 supplied one? This bug is preventing my applications (and I guess other people apps also) from running.
-
10. Re: Javassist errors with latest jboss
newlukai Aug 2, 2006 8:17 AM (in response to teknokrat)Would someone be kind enough to post a fixed javassit.jar
Would be nice. I got this error while trying to override Object.clone(). -
11. Re: Javassist errors with latest jboss
penczek Aug 2, 2006 9:35 AM (in response to teknokrat)Try downloading javassist source code from
http://prdownloads.sourceforge.net/jboss/javassist-3.2.zip?download
Next, change isVisible(int mod, String from, Member meth) inside javassist.util.proxy.ProxyFactory class to this:private static boolean isVisible(int mod, String from, Member meth) { // this allow generics if ((mod & Modifier.VOLATILE) != 0) return false; else if ((mod & Modifier.PRIVATE) != 0) return false; else if ((mod & (Modifier.PUBLIC | Modifier.PROTECTED)) != 0) return true; else { String p = getPackageName(from); String q = getPackageName(meth.getDeclaringClass().getName()); if (p == null) return q == null; else return p.equals(q); } } }
Compile and build project and it's done!
I can't submit any jars because this forum doesn't support attached files