question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

InternetDomainName.findSuffixOfType() in junit test returns java.lang.NoSuchFieldError: EXACT

See original GitHub issue

I’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:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nitrocodecommented, Apr 24, 2018

That’s awesome, thank you @Stephan202!

1reaction
Stephan202commented, Apr 24, 2018

@nitrocode I’d add the aforementioned checks to your build by default; they could be part of a shared company POM. Others I recommend:

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 the build-checks profile.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found