<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/4.1.92">
</HEAD>
<BODY>
On Mon, 2012-10-22 at 12:31 +0200, P. Peterse (HDB) wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Martin,

can it be that the class Proj4Keyword also need to be synchronized?

</PRE>
</BLOCKQUOTE>
Did you try running the code without the 'towgs84' parameter? If you get the same error, but for the 'proj' parameter, that would support the theory that your dealing with a synchronization problem.<BR>
'towgs84' just happens to be the first parameter to be checked. The next would be 'proj', at least on my JVM.<BR>
<BR>
In this case, I think the Proj4Keyword.supportedParameters() method should be synchronized, but I'm not really a multithreading expert.<BR>
<BR>
Groeten, Gertjan<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<PRE>
Regards,
Peter

Op 22-10-2012 11:55, P. Peterse (HDB) schreef:
> Hello Martin,
>
> I updated the proj4j package and using this library in our project.
>
> unfortunately the error still exists:
> ============
> towgs84 parameter is not supported
> org.osgeo.proj4j.UnsupportedParameterException: towgs84 parameter is not
> supported
>     at
> org.osgeo.proj4j.parser.Proj4Keyword.checkUnsupported(Proj4Keyword.java:108)
>     at
> org.osgeo.proj4j.parser.Proj4Keyword.checkUnsupported(Proj4Keyword.java:115)
>     at org.osgeo.proj4j.parser.Proj4Parser.parse(Proj4Parser.java:34)
>     at org.osgeo.proj4j.CRSFactory.createFromParameters(CRSFactory.java:120)
>     at org.osgeo.proj4j.CRSFactory.createFromParameters(CRSFactory.java:98)
>     at com.hdb.tol.wms.RDConverter.convert2WGS84(RDConverter.java:114)
> ============
> Is this an other issue with an other race condition?
>
> One of your questions was:
>
> Are you using the codein a multithreaded context?  
>
> This is true, our project is using multiple threads.
>
> Regards,
> Peter
>
> Op 22-10-2012 9:47, P. Peterse (HDB) schreef:
>> Hello Martin,
>>
>> I've just update the proj4j code. And start trying it in our code.
>> I will let you now if it will work.
>>
>> Thanks for digging in to the code.
>>
>> Regards,
>> Peter
>>
>> Op 19-10-2012 19:52, Martin Davis schreef:
>>> I just committed a patch to the Registry which should avoid potential
>>> race conditions during initialization.
>>>
>>> Also, the idea about conflicting JARs is a good thing to look at too. 
>>> Ah, the joys of Java classloaders...
>>>
>>> On 10/19/2012 8:36 AM, Martin Davis wrote:
>>>> Not sure why this would be a transient error.  Are you using the code
>>>> in a multithreaded context?  It's possible there's a race condition in
>>>> the Registry initialization.  If you can recompile the code, try
>>>> changing the initialize method in Registry.java to:
>>>>
>>>>    private synchronized void initialize() {
>>>>
>>>> M
>>>>
>>>> On Fri, Oct 19, 2012 at 6:14 AM, P. Peterse (HDB)
>>>> <<A HREF="mailto:p.peterse@han-dataport.nl">p.peterse@han-dataport.nl</A>> wrote:
>>>>> Hello,
>>>>>
>>>>> here is the stack trace from my code:
>>>>> ===============
>>>>> org.osgeo.proj4j.InvalidValueException: Unknown projection: sterea
>>>>>      at
>>>>> org.osgeo.proj4j.parser.Proj4Parser.parseProjection(Proj4Parser.java:71)
>>>>>
>>>>>      at org.osgeo.proj4j.parser.Proj4Parser.parse(Proj4Parser.java:43)
>>>>>      at
>>>>> org.osgeo.proj4j.CRSFactory.createFromParameters(CRSFactory.java:120)
>>>>>      at
>>>>> org.osgeo.proj4j.CRSFactory.createFromParameters(CRSFactory.java:98)
>>>>>      at com.hdb.tol.wms.RDConverter.convert2WGS84(RDConverter.java:114)
>>>>> ===============
>>>>>
>>>>> What can I check?
>>>>>
>>>>> Thanks for any reply.
>>>>> Peter
>>>>>
>>>>> Op 19-10-2012 10:40, P. Peterse (HDB) schreef:
>>>>>> Hello Martin,
>>>>>>
>>>>>> It looks indeed that it's an initialisation issue. We are trying to
>>>>>> trace the bug and for now we suspect that the issue is in the class
>>>>>> Proj4Keyword
>>>>>> This method checkUnsupported is throwing the error. The code thinks
>>>>>> one
>>>>>> of the params is not supported.
>>>>>>
>>>>>> If we find a sollution we will send it.
>>>>>>
>>>>>> Regards,
>>>>>> Peter Peterse
>>>>>>
>>>>>>
>>>>>> Op 17-10-2012 18:27, Martin Davis schreef:
>>>>>>> I just tried this as well, and the code works fine for me.  But if
>>>>>>> the
>>>>>>> problem is some kind of transient intialization error it's probably
>>>>>>> not going to show up in simple one-off tests.
>>>>>>>
>>>>>>> All I can suggest is to try and see if you can catch the problem in a
>>>>>>> debug session, and then have a look at why it might be occurring.
>>>>>>>
>>>>>>> Nice to see Proj4J is getting used!
>>>>>>>
>>>>>>> Martin
>>>>>>>
>>>>>>> On Wed, Oct 17, 2012 at 3:10 AM, P. Peterse (HDB)
>>>>>>> <<A HREF="mailto:p.peterse@han-dataport.nl">p.peterse@han-dataport.nl</A>> wrote:
>>>>>>>> Hello list,
>>>>>>>>
>>>>>>>> We are using org.osgeo.proj4j in our project and facing sometimes an
>>>>>>>> issue while transforming an coordinate from lat/long format to
>>>>>>>> EPSG:28992.
>>>>>>>> Most times the conversion will work ok, but sometimes there comes an
>>>>>>>> exception:
>>>>>>>> towgs84 parameter is not supported
>>>>>>>> The input coordinate is:
>>>>>>>> LatLon[lat=52.11882666666666, lon=5.04316]
>>>>>>>>
>>>>>>>> The used code is as follows:
>>>>>>>> ===============
>>>>>>>>          CRSFactory csFactory = new CRSFactory();
>>>>>>>>          final String EPSG28992_PARAM = "+proj=sterea
>>>>>>>> +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079
>>>>>>>> +x_0=155000 +y_0=463000 +ellps=bessel
>>>>>>>> +towgs84=565.417,50.3319,465.552,-0.398957,0.343988,-1.8774,4.0725
>>>>>>>> +units=m +no_defs";
>>>>>>>>          CoordinateReferenceSystem epsg28992 =
>>>>>>>> csFactory.createFromParameters("EPSG:28992", EPSG28992_PARAM);
>>>>>>>>
>>>>>>>>          final String WGS84_PARAM = "+title=long/lat:WGS84
>>>>>>>> +proj=longlat
>>>>>>>> +ellps=WGS84 +datum=WGS84 +units=degrees";
>>>>>>>>          CoordinateReferenceSystem epsg4326 =
>>>>>>>> csFactory.createFromParameters("WGS84",WGS84_PARAM);
>>>>>>>>
>>>>>>>>          CoordinateTransformFactory ctFactory = new
>>>>>>>> CoordinateTransformFactory();
>>>>>>>>          CoordinateTransform trans =
>>>>>>>> ctFactory.createTransform(epsg4326,
>>>>>>>> epsg28992);
>>>>>>>>          ProjCoordinate inCoord = new ProjCoordinate();
>>>>>>>>          ProjCoordinate outCoord = new ProjCoordinate();
>>>>>>>>          inCoord.y = pos.getLat();
>>>>>>>>          inCoord.x = pos.getLon();
>>>>>>>>          //convert from lat/lon to RD.
>>>>>>>>          trans.transform(inCoord, outCoord);
>>>>>>>>          final double[] point = new double[2];
>>>>>>>>          point[0]=outCoord.x;
>>>>>>>>          point[1]=outCoord.y;
>>>>>>>>
>>>>>>>>          return point;
>>>>>>>> ===============
>>>>>>>>
>>>>>>>> Does anyone have a clue what's going wrong over here?
>>>>>>>>
>>>>>>>> Thanks for your patience.
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Peter Peterse
>>>>>>>> _______________________________________________
>>>>>>>> Proj4j mailing list
>>>>>>>> <A HREF="mailto:Proj4j@lists.osgeo.org">Proj4j@lists.osgeo.org</A>
>>>>>>>> <A HREF="http://lists.osgeo.org/mailman/listinfo/proj4j">http://lists.osgeo.org/mailman/listinfo/proj4j</A>
>>>>>> _______________________________________________
>>>>>> Proj4j mailing list
>>>>>> <A HREF="mailto:Proj4j@lists.osgeo.org">Proj4j@lists.osgeo.org</A>
>>>>>> <A HREF="http://lists.osgeo.org/mailman/listinfo/proj4j">http://lists.osgeo.org/mailman/listinfo/proj4j</A>
>>>>>>
>>>>>>
>>>>> _______________________________________________
>>>>> Proj4j mailing list
>>>>> <A HREF="mailto:Proj4j@lists.osgeo.org">Proj4j@lists.osgeo.org</A>
>>>>> <A HREF="http://lists.osgeo.org/mailman/listinfo/proj4j">http://lists.osgeo.org/mailman/listinfo/proj4j</A>
>>>> _______________________________________________
>>>> Proj4j mailing list
>>>> <A HREF="mailto:Proj4j@lists.osgeo.org">Proj4j@lists.osgeo.org</A>
>>>> <A HREF="http://lists.osgeo.org/mailman/listinfo/proj4j">http://lists.osgeo.org/mailman/listinfo/proj4j</A>
>>>>
>>>>
>>>> -----
>>>> No virus found in this message.
>>>> Checked by AVG - <A HREF="http://www.avg.com">www.avg.com</A>
>>>> Version: 2012.0.2221 / Virus Database: 2441/5341 - Release Date:
>>>> 10/19/12
>>>>
>>>>
>>> _______________________________________________
>>> Proj4j mailing list
>>> <A HREF="mailto:Proj4j@lists.osgeo.org">Proj4j@lists.osgeo.org</A>
>>> <A HREF="http://lists.osgeo.org/mailman/listinfo/proj4j">http://lists.osgeo.org/mailman/listinfo/proj4j</A>
>>>
>>>
>> _______________________________________________
>> Proj4j mailing list
>> <A HREF="mailto:Proj4j@lists.osgeo.org">Proj4j@lists.osgeo.org</A>
>> <A HREF="http://lists.osgeo.org/mailman/listinfo/proj4j">http://lists.osgeo.org/mailman/listinfo/proj4j</A>
>>
>>
> _______________________________________________
> Proj4j mailing list
> <A HREF="mailto:Proj4j@lists.osgeo.org">Proj4j@lists.osgeo.org</A>
> <A HREF="http://lists.osgeo.org/mailman/listinfo/proj4j">http://lists.osgeo.org/mailman/listinfo/proj4j</A>
>
>

_______________________________________________
Proj4j mailing list
<A HREF="mailto:Proj4j@lists.osgeo.org">Proj4j@lists.osgeo.org</A>
<A HREF="http://lists.osgeo.org/mailman/listinfo/proj4j">http://lists.osgeo.org/mailman/listinfo/proj4j</A>
</PRE>
</BLOCKQUOTE>
<BR>
</BODY>
</HTML>