From: Martin D. <mar...@te...> - 2003-02-17 09:10:22
|
James Macgill wrote: > The error is: > Caused by: java.lang.IllegalArgumentException: A descriptor is already > registered against the name "GC_SampleTranscoding" under registry mode > "rendered" > > Looking into the project.xml file for the gcs module it looks like we > were already excluding several tests and the change in maven may have > changed the format for excluding... > <exclude>**/SampleDimensionTest.java</exclude> > <exclude>**/GridCoverageTest.java</exclude> > <exclude>**/InterpolatorTest.java</exclude> > <exclude>**/OperationTest.java</exclude> All those tests are supposed to run. Actually, the problem as to do with class loaders (the issue as been raised in some previous IRC meeting). JUnit provides their own implementation of ClassLoader that re-load Geotools class for each tests. However, they do not reload the JAI classes. Thats the problem: in a normal Java execution machine, Geotools classes are loaded only once and register themself to JAI only once. But since JUnit reload Geotools classes manytime, Geotools classes register themself to JAI many time, which cause the error. In previous IRC meeting, we sugested the deregister and register "GC_SampleTranscoding" as a workaround. It would work for this particular case, but will not solve the problem in a general sense. *All* Geotools classes that register themself to some J2SE/JAI services will have this problem (for example CoordinateSystemEPSGFactory register a ShutdownHook). I don't think that providing workaround everywhere is the best solution, especially since it would defeat the purpose of the error message: warn us about conflicts. This problem is strictly due to the way JUnit work, it is not a J2SE bug. The best solution would be to find some way to tell JUnit to use the normal J2SE class loader for each Maven execution. Regards, Martin. |