Search code examples
javadependenciesjerseydependency-management

NoSuchMethodError: org.glassfish.jersey.internal.LocalizationMessages.WARNING_PROPERTIES()Ljava/lang/String


I'm getting this error below, I've tried excluding Jersey from every dependency and have the versions synced, but still getting the error. I've isolated every jersey I can think of. Could FasterXML be the culprit somehow?

Any pointer is appreciated!

2023-08-11 01:28:58,514 ERROR Executor task launch worker for task 49576 com.company.companyorg.ps.companyapp.srf.money.merchantchange.handler.MerchantChangeHandler$ - Failed to extract merchant profile for merchantAccountNumber: 123123123123123
java.lang.NoSuchMethodError: org.glassfish.jersey.internal.LocalizationMessages.WARNING_PROPERTIES()Ljava/lang/String;
    at org.glassfish.jersey.internal.config.SystemPropertiesConfigurationModel.getProperties(SystemPropertiesConfigurationModel.java:120)
    at org.glassfish.jersey.internal.config.SystemPropertiesConfigurationProvider.getProperties(SystemPropertiesConfigurationProvider.java:29)
    at org.glassfish.jersey.internal.config.ExternalPropertiesConfigurationFactory.readExternalPropertiesMap(ExternalPropertiesConfigurationFactory.java:55)

Complete stack trace: https://pastebin.com/Cjwn3157

Here's the dependency tree: https://pastebin.com/yxeqNwx8

handler pom.xml: https://pastebin.com/L0kbTHd0

runner pom.xml: https://pastebin.com/8Lp5DkBd


Solution

  • Yes FasterXLM could conflict with Jersey, fasterxml-jackson and jersey-server, upgrade your jersey-server to v3 which will remove localization-messages dependency cause

    jersey-server depends: jaxrs-api which that depends on localization-message while fasterxml-jackson depends on jackson-databind which also depends on localization-messages

    you can either do that or use jackson instead

    Edit: excluding localization-messages which is dependency of jaxrs-api so not good, instead upgrade jaxrs-api to v3

    <dependency>
    <groupId>javax.ws.rs</groupId>
    <artifactId>jaxrs-api</artifactId>
    <version>3.0.0</version>
    

    if these didn't worked, include "LocalizationMessages" to your import statement and use getMessage to get message from warning.properties file

    well after a bit of searching i see that WARNING_PROPERTIES() has been removed from LocalizationMessages's new version and that's why you get NoSuchMethodError, let me know if that fixes the issue.