aucd29 / cloning

Automatically exported from code.google.com/p/cloning
Other
0 stars 0 forks source link

Please fix the issue #16 that is already "Done" #23

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
https://code.google.com/p/cloning/issues/detail?id=16

What steps will reproduce the problem?
1. put the cloner lib to tomcat/lib folder
2. create at least two apps that will use cloner
3. the system may fail on cloning because fields will be mixed up

What version of the product are you using? On what operating system?
ubuntu, java 6, 7

Please provide any additional information below.
the fail starts from version 1.8.2 where ObjenesisInstantiationStrategy was 
added (with singleton). 1.8.1 works correctly (this version works without 
ObjenesisInstantiationStrategy).

Original issue reported on code.google.com by alex...@aspentechlabs.com on 6 Nov 2013 at 1:40

GoogleCodeExporter commented 9 years ago
Hi,sorry for the late answer, will have a look at some point but I think the 
issue is a classloading mixup and a quick workaround would be to put the lib 
into WEB-INF/lib

Original comment by kostas.k...@googlemail.com on 12 Nov 2013 at 11:02

GoogleCodeExporter commented 9 years ago
Thanks for answer.

We just downgrade to version 1.8.1 as we cannot put it to web-inf folder
due to architecture restrictions.

Original comment by alex...@aspentechlabs.com on 13 Nov 2013 at 2:17

GoogleCodeExporter commented 9 years ago
Hi Alexey, 

I believe it is a classloading issue. Cloner is loaded via the parent class 
loader of tomcat and it probably mixes the class of webapp B with the one from 
A. But can't see why 1.8.1. The only difference is that on 1.8.2 they use the 
same Objenessis instance. So it might be that Objenessis mixes the classes of A 
and B. But that can be easily overridden in newer versions:

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.

Original comment by kostas.k...@googlemail.com on 23 Nov 2013 at 4:51

GoogleCodeExporter commented 9 years ago
Are you going to change the default constructor to avoid this type of error?

Original comment by alex...@aspentechlabs.com on 24 Nov 2013 at 12:34

GoogleCodeExporter commented 9 years ago
No as it occurs in very specific conditions and the default constructors 
provide sensible defaults for most cases at the moment. Maybe some static 
factory methods would help in situations like this. I.e.

Cloning.default() // default behaviour
Cloning.shared() // shared behaviour, i.e. used under tomcat/lib

Original comment by kostas.k...@googlemail.com on 30 Nov 2013 at 7:16

GoogleCodeExporter commented 9 years ago
Yes, that would be good to have some note in FAQ or somewhere in doc for
other people. Thanks.

Original comment by alex...@aspentechlabs.com on 30 Nov 2013 at 7:53

GoogleCodeExporter commented 9 years ago
fixed in 1.9.1-SNAPSHOT

Original comment by kostas.k...@googlemail.com on 19 Sep 2014 at 10:38