我想要實現this代碼java.lang.NoSuchFieldError的:比如在bitpay SDK
public void testGetExchangeRate() throws Exception
{
ECKey key = KeyUtils.createEcKey();
String clientName = "server 1";
BitPay bitpay = new BitPay(key, clientName);
if (!bitpay.clientIsAuthorized(BitPay.FACADE_MERCHANT))
{
// Get Merchant facade authorization code
String pairingCode = bitpay.requestClientAuthorization(
BitPay.FACADE_MERCHANT);
// Signal the device operator that this client needs to
// be paired with a merchant account.
System.out.print("Info: Pair this client with your merchant account using the pairing Code: " + pairingCode);
throw new BitPayException("Error:client is not authorized for Merchant facade");
}
}
我包括這些依賴關係:
<dependency>
<groupId>com.github.bitpay</groupId>
<artifactId>java-bitpay-client</artifactId>
<version>v2.0.4</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.5</version>
<type>jar</type>
</dependency>
但是當我運行的代碼我得到:
testGetExchangeRate(com.payment.gateway.bitpay.impl.BitpayImplTest) Time elapsed: 1.665 sec <<< ERROR!
java.lang.NoSuchFieldError: INSTANCE
at com.payment.gateway.bitpay.impl.BitpayImplTest.testGetExchangeRate(BitpayImplTest.java:55)
問題:你能給我一些建議嗎? n解決這個問題?
的[這]可能的複製(http://stackoverflow.com/questions/21622885/java-lang-nosuchfielderror-instance?rq=1)。 – Jacob