gpt4 book ai didi

java - Authorize.net Java SDK(2.0.1v) 环境未设置问题

转载 作者:行者123 更新时间:2023-12-05 06:20:00 36 4
gpt4 key购买 nike

我在我的应用程序中使用 Authorize.net 作为付款供应商。从 Mobile SDK 获取表单 token 后,我在后端使用他们的 Java SDK 来启动付款。

但是我在使用 Authorize.net Java SDK(v2.0.1) 中的 CreateAnAcceptPaymentTransaction 类时遇到以下问题。

Environment not set. Set environment using setter or use overloaded method to pass appropriate environment

下面一行中的 Controller 对象有错误。

CreateTransactionController controller = new CreateTransactionController(apiRequest);

我已经通过下面的代码设置了环境

ApiOperationBase.setEnvironment(Environment.SANDBOX);

试图将版本降级到 v2.0.0 但它对我不起作用。

非常感谢任何帮助。

最佳答案

错误实际上不是设置环境。

您可能遇到了下面提到的异常。

javax.xml.bind.JAXBException Implementation of JAXB-API has not been found on module path or classpath 

它是在 gradle 文件或 Maven 文件中缺少依赖项。

将这些依赖项添加到您的 pom/gradle 中:

Gradle :

compile('javax.xml.bind:jaxb-api:2.3.0')
compile('javax.activation:activation:1.1')
compile('org.glassfish.jaxb:jaxb-runtime:2.3.0')

Pom:

<!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0-b170201.1204</version>
</dependency>

<!-- https://mvnrepository.com/artifact/javax.activation/activation -->
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.glassfish.jaxb/jaxb-runtime -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.0-b170127.1453</version>
</dependency>

原始帖子可以在这里找到javax.xml.bind.JAXBException Implementation of JAXB-API has not been found on module path or classpath

关于java - Authorize.net Java SDK(2.0.1v) 环境未设置问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60650812/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com