-
-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UnknownCurrencyException(CurrencyCode=EUR) #158
Comments
@MystyxMac Can you reproduce it always or from time to time? |
@AlexanderYastrebov When we had this bug, it was every time we ran our program. Now we added a workaround. That is we added Monetary.getCurrency("EUR"); to one of the classes that gets loaded first. |
@MystyxMac Thanks a lot. If there's a workaround, it won't be considered a |
@keilw I had seen this issue on one of our instances yesterday (for different currency) and solved it temporarily by restarting the instance so it can reinitialize. The issue was constantly observed, so it is not a first-time/startup problem and I do not think it can be solved by additional early method call.
|
I think it is important to mention that we faced the issue with <dependency>
<groupId>javax.money</groupId>
<artifactId>money-api-bp</artifactId>
<version>1.0</version>
</dependency> |
We have this problem with <dependency>
<groupId>org.javamoney</groupId>
<artifactId>moneta</artifactId>
<version>1.1</version>
</dependency> |
@AlexanderYastrebov did you mean Moneta-BP 1.0? You won't use |
@keilw (I'm part of @AlexanderYastrebov's team). Not sure I understand your comment correctly. We're using Java 7 and therefore are required to use the backport. We're not using moneta (1.8+), just the backport. |
I have a test case which will reproduce the problem. See https://github.com/AlexanderYastrebov/unknown-currency |
@keilw @MystyxMac I got the point about workaround now, thanks. Static initialization like static {
//
// Initialize currency list early to avoid unsafe lazy multithreaded initialization
//
Monetary.getCurrency("EUR");
} should probably do the trick |
My system properties where I can reproduce it with test case:
|
@AlexanderYastrebov Thanks and nice that you could reproduce it. Yes, we use that workaround too. Is there something to fix or is this by design and is the workaround necessary? |
With static block in place I can not reproduce it anymore with test case. |
Also possible to reproduce with
|
With
and also have got different kind of error once:
|
@MystyxMac @AlexanderYastrebov That is why I was questioning the dependency
Which would not work with Java SE 7 and the API Backport. Could you please continue the Moneta-BP relevant findings and conversation in JavaMoney/jsr354-ri-bp#37 Keeping this one open simply to try reproduce the issue in Moneta (you don't have to do that) or port any resolutions to the Java 8+ version, but please let's discuss the Java 7 issues in the ri-bp ticket now. |
I can reproduce it with <dependencies>
<dependency>
<groupId>org.javamoney</groupId>
<artifactId>moneta</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
Ok, though I am sure the core issue is the same |
I have updated test case to support different moneta versions |
I don't think it's the very same issue, but there is a strong indication
that the problem with lazy initialization is systematic and therefore
affects multiple different modules.
…On 7 Jul 2017 19:27, "Werner Keil" ***@***.***> wrote:
Thanks, so it happens both with Moneta and Moneta-BP?
ConcurrentException sounds like it could be related to #161
<#161> which @atsticks
<https://github.com/atsticks> already analyzed. Please have a look, if
they are related, it makes it easier to find a solution to both or consider
them "duplicates".
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#158 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAaPncviy_3L0HW6AdJrBNnqNatY84Grks5sLmqBgaJpZM4NWuH_>
.
|
Multiple modules in the sense that Moneta is now broken into sub-modules, or do you mean Moneta vs. Moneta-BP? |
I was referring to different parts of the library, maybe feature would have been a better word. In particular it looks like there similar bugs in the initialization of currencies (this issue) and exchange rates (#161). |
Happy if someone was willing to help on that. It does require JCP membership, unless Zalando joined by now, everyone who wants to help (and if they like also be listed) as contributor could join as Associate members. |
Effectively I am currently fixing some issues with lazy initialization on the conversion side as well. I will check the currency loading as well... To be clear: IMO we should fix this:
AFAIK the code in backport and Java 8 is quite similar, so I assume the same issues on both version to be present. |
…currency-exception GH-158 Uses static method initializer in JDKCurrencyProvider
How can I resolve this issue? This happens with versions 1.0 and 1,1 on Java 8u111 and higher.
When I use
I get an
Can this be a timing issue? Is the JDKCurrencyProvider lazy loaded?
The text was updated successfully, but these errors were encountered: