Closed GoogleCodeExporter closed 9 years ago
did you tried the latest version?
https://oss.sonatype.org/content/repositories/releases/uk/com/robust-it/cloning/
Original comment by kostas.k...@googlemail.com
on 7 Mar 2013 at 10:27
No, did not use last version, tought that 1.7.4 was the last version, will try
it and come back if it still happens.
Original comment by rikardsw...@gmail.com
on 12 Mar 2013 at 12:14
The same is with 1.9.0 (used within tomcat 7)
2013-04-03 01:57:43 [jw.egrasp.dom-startStop-1] ERROR
org.springframework.web.context.ContextLoader - Context initialization failed
java.lang.IllegalArgumentException: Can not set boolean field
com.evalica.acc.domain.field.EmployerReferenceField.showEmployerName to
com.evali
ca.acc.domain.field.EmployerReferenceField
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150)
at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:37)
at sun.reflect.UnsafeBooleanFieldAccessorImpl.set(UnsafeBooleanFieldAccessorImpl.java:57)
at java.lang.reflect.Field.set(Field.java:657)
at com.rits.cloning.Cloner.cloneInternal(Cloner.java:515)
at com.rits.cloning.Cloner.deepClone(Cloner.java:323)
at com.evalica.acc.util.Utils.cloneDeeply(Utils.java:1724)
at com.evalica.acc.domain.cache.EhcacheCopyStrategyBase.copyElement(EhcacheCopyStrategyBase.java:29)
Original comment by alex...@aspentechlabs.com
on 2 Apr 2013 at 11:06
So if you create a testcase testing with a couple of instances of
EmployerReferenceField, does it reproduce?
If not, do you use proxies (i.e. cgi or asm?). If you debug, does
EmployerReferenceField gain any fields due to proxies?
Original comment by kostas.k...@googlemail.com
on 3 Apr 2013 at 8:20
I'm also usign Weblogic 10.3.4, Spring 3.0 and Hibernate Annotations, and I
obtain the same error. I think that the error is produced by Hibernate Proxies.
I tried to load the entire real object from the database but it still throws
the exception.
This problem only ocurrs on Weblogic. I deployed the application on Tomcat 6
and the clonation works perfectly.
In addition, I have redefined the cloneInternal method in order to clone
Hibernate managed objects by deleting(assign to null) the @id property and it
works.
How can I solve this problem?
Thanks!
Original comment by r.vegas1...@gmail.com
on 11 Apr 2013 at 4:57
what happens if you do cloner.nullInsteadOfClone for these classes (and all
other hibernate classes that you might be using)?
org.hibernate.engine.SessionImplementor
org.hibernate.impl.SessionImpl
org.hibernate.impl.StatelessSessionImpl
org.hibernate.transaction.JDBCTransaction
Original comment by kostas.k...@googlemail.com
on 13 Apr 2013 at 5:43
I set the cloningEnabled flag to true and did cloner.nullInsteadOfClone for
SessionImplementor, SessionImpl, StatelessSessionImpl and JDBCTransaction.
Now it works fine!
Thank you very much for solving my problem :)
Original comment by r.vegas1...@gmail.com
on 15 Apr 2013 at 7:14
Cheers, closing this issue
Original comment by kostas.k...@googlemail.com
on 16 Apr 2013 at 7:51
I still having this issue. The issue happens within one of 2 applications
loaded on tomcat 7.
If only one application loaded - all is fine. If two same applications loaded
one is OK, the second has java.lang.IllegalArgumentException: Can not set
boolean field
com.evalica.acc.domain.field.EmployerReferenceField.showEmployerName to
com.evalica.acc.domain.field.EmployerReferenceField
Strange thing is that cloner tries to set EmployerReferenceField (that is not
boolean) to boolean EmployerReferenceField.showEmployerName.
This issue is not appears on cloner versions 1.8.1 and lower. And appears on
all 1.8.2+.
Cloner library is within tomcat/lib folder and not separate for each
WEB-INF/lib folder. Maybe this is the reason?
Original comment by alex...@aspentechlabs.com
on 6 Nov 2013 at 1:25
Suppose it may be because of static singleton and if cloner library is shared
between tomcat apps - we may fail and intersection of cloning objects.
This singleton is not used in version 1.8.1 and lower.
Singleton:
public class ObjenesisInstantiationStrategy implements IInstantiationStrategy
{
private final Objenesis objenesis = new ObjenesisStd();
@SuppressWarnings("unchecked")
public <T> T newInstance(Class<T> c)
{
return (T) objenesis.newInstance(c);
}
private static ObjenesisInstantiationStrategy instance = new ObjenesisInstantiationStrategy();
public static ObjenesisInstantiationStrategy getInstance()
{
return instance;
}
}
Original comment by alex...@aspentechlabs.com
on 6 Nov 2013 at 1:35
The Cloner has a constructor:
public Cloner(final IInstantiationStrategy instantiationStrategy)
Instead of calling the default constructor, just call this one as :
new Cloner(new ObjenesisInstantiationStrategy())
1 instance of ObjenesisInstantiationStrategy per web app is required.
Does this work?
Original comment by kostas.k...@googlemail.com
on 23 Nov 2013 at 4:52
Original issue reported on code.google.com by
rikardsw...@gmail.com
on 18 Dec 2012 at 12:03