相关疑难解决方法(0)

java.lang.NoSuchFieldError:bitpay SDK中的INSTANCE

我想实现这个代码

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");
    } …
Run Code Online (Sandbox Code Playgroud)

java maven maven-dependency

11
推荐指数
1
解决办法
318
查看次数

线程“main”中的异常 java.lang.NoClassDefFoundError: org/apache/http/ConnectionReuseStrategy:

我试图在 Eclipse 的 maven 项目中作为 Java 应用程序运行,但出现以下运行时错误。错误如下所示。

线程“main”中的异常 java.lang.NoClassDefFoundError: org/apache/http/ConnectionReuseStrategy at com.wang.testMaven.App.main(App.java:16) 由:java.lang.ClassNotFoundException: org.apache.http .ConnectionReuseStrategy at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

我的代码如下所示

public class App 
{
    public static void main( String[] args )
    {
        System.out.println( "Hello World!" );
        HttpClient httpClient = HttpClientBuilder.create().build();
        System.out.println( "Hello World!" );

    }
}
Run Code Online (Sandbox Code Playgroud)

我的 pom.xml 如下所示

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.wang</groupId>
  <artifactId>testMaven</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>testMaven</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
  <dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpcore</artifactId>
    <version>4.1-alpha1</version>
</dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
            <groupId>org.apache.httpcomponents</groupId> …
Run Code Online (Sandbox Code Playgroud)

java maven-2

4
推荐指数
1
解决办法
3万
查看次数

标签 统计

java ×2

maven ×1

maven-2 ×1

maven-dependency ×1