InternetDomainName.findSuffixOfType() in junit test returns java.lang.NoSuchFieldError: EXACT
See original GitHub issueI’m using guava 24.1-jre
and jdk 1.8.0.162
InternetDomainName.from("google.com");
causes
java.lang.NoSuchFieldError: EXACT
at com.google.common.net.InternetDomainName.findSuffixOfType(InternetDomainName.java:172)
at com.google.common.net.InternetDomainName.<init>(InternetDomainName.java:153)
at com.google.common.net.InternetDomainName.from(InternetDomainName.java:212)
at com.dnb.vici.formfill.common.UtilFunctions.getCustomerAndDomainId(UtilFunctions.java:73)
at com.dnb.vici.formfill.ut.UtilFunctionsTest.getCustomerAndDomainIdTest(UtilFunctionsTest.java:73)
It’s failing on InternetDomainName.java Line #172 and this old storm issue returns a very similar error.
In IntelliJ when I evaluate the expression, it returns false
as expected but running through the code will throw the exception and it only happens during a unit test… Why does this happen?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
InternetDomainName.findSuffixOfType() in junit test returns ...
I'm using guava 24.1-jre and jdk 1.8.0.162 InternetDomainName.from("google.com");. causes java.lang.NoSuchFieldError: EXACT at ...
Read more >NoSuchFieldError when trying to run a jUnit test with Spring
I have solved this, changing to JUnit 4.10. The original exception was: java.lang.NoSuchFieldError ...
Read more >Guava com.google.thirdparty.publicsuffix is not shaded
NoSuchFieldError : EXACT at com.google.common.net.InternetDomainName.findPublicSuffix(InternetDomainName.java:173) at com.google.common.net.
Read more >InternetDomainName (Guava: Google Core Libraries for Java ...
As a result, the only useful test to determine if a domain is a plausible web host is hasPublicSuffix() . This will return...
Read more >java.lang.NoSuchFieldError when accessing a property ...
package com.example.myapplication import org.junit.Assert.assertEquals import org.junit.Test data class DataResponse<T>(@JvmField val data: T) data class ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That’s awesome, thank you @Stephan202!
@nitrocode I’d add the aforementioned checks to your build by default; they could be part of a shared company POM. Others I recommend:
maven-enforcer-plugin
’sdependencyConvergence
.maven-dependency-plugin
’s variousanalyze*
goals.At Picnic we use a parent which has these and other checks; it ensures that each of our projects has a well-behaved build. (Open-sourcing (a variation of) this
pom.xml
is on my TODO list, but realistically it’s a few months out.)Edit: actually, most of that parent pom was copied over and open-sourced here. The relevant tidbits are spread across the
pluginManagement
section section and thebuild-checks
profile.