1

我正在使用 intuit 提供的 jar (ipp-java-devkit-2.0.11-jar-with-dependencies.jar) 并且遇到了一些困难。我能够创建我的 PlatformSessionContext,所以我知道它并没有完全损坏。调用 new PlatformClient() 时出现以下异常:

16:29:58,204 ERROR [[requestHandlerBlueDot]] Servlet.service() for servlet requestHandlerBlueDot threw exception java.lang.IllegalStateException: org.slf4j.LoggerFactory could not be successfully initialized. See also http://www.slf4j.org/codes.html#unsuccessfulInit
    at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:288)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:252)
    at com.intuit.platform.util.LoggerImpl.getLogger(LoggerImpl.java:48)
    at com.intuit.platform.util.LoggerImpl.getInstance(LoggerImpl.java:32)
    at com.intuit.platform.client.PlatformClient.<clinit>(PlatformClient.java:52)
    at com.jt.quickbooks.BlueDotMenuServlet.doGet(BlueDotMenuServlet.java:66)

有什么我错过的吗?

4

3 回答 3

1

弄清楚了。问题是 slf4j 日志记录 jar 是较新的版本,并且与我已经在我的服务器上运行的不兼容。发现了一个我之前没有注意到的(jBoss)部署错误:

16:27:26,172 错误 [STDERR] SLF4J:slf4j-api 1.6.x(或更高版本)与此绑定不兼容。
16:27:26,173 错误 [STDERR] SLF4J:您的绑定是 1.5.5 或更早版本。
16:27:26,173 错误 [STDERR] SLF4J:将绑定升级到版本 1.6.x。或 2.0.x

修复是删除 ipp-java-devkit-2.0.11-jar-with-dependencies.jar 并替换为 ipp-java-devkit-2.0.11.jar 然后为缺少的依赖项添加几个 jar。
我需要添加的罐子是:
org.apache.felix.bundlerepository-1.0.3.jar 用于 xmlpull.v1.xmlpullparser、xmlpull.v1.xmlserializer、kdom.Document signpost-core-1.2.1.1.jar 用于 OAuth 东西

于 2013-07-12T18:56:47.420 回答
0

它对我来说很好。请您尝试以下方法。

final PlatformSessionContext context = getPlatformContext(accesstoken,
        accessstokensecret, realmID, dataSource);

PlatformClient client = new PlatformClient();

System.out.println("User's email " + client.getUserInfo(context).getEmail());

JavaDoc 参考 - http://developer-static.intuit.com/SDKDocs/QBV2Doc/ipp-java-devkit-2.0.10-SNAPSHOT-javadoc/ (com.intuit.platform.client.PlatformClient)

请让我知道它是否适合您。

import com.intuit.platform.client.PlatformClient;
import com.intuit.platform.client.PlatformServiceType;
import com.intuit.platform.client.PlatformSessionContext;
import com.intuit.platform.client.security.OAuthCredentials;


public class Test {

    String accesstoken = "keys ****";
    String accessstokensecret = "keys ****";
    String realmID = "*********";
    String dataSource = "QBD";

    String appToken = "keys ****";
    String oauth_consumer_key = "keys ****";
    String oauth_consumer_secret = "keys ****";

    Test(){
        final PlatformSessionContext context = getPlatformContext(accesstoken,
                accessstokensecret, realmID, dataSource);
        System.out.println(context);
        PlatformClient client = new PlatformClient();
        System.out.println("User's email " + client.getUserInfo(context).getEmail());
    }

    public PlatformSessionContext getPlatformContext(final String accessToken,
            final String accessTokenSecret, final String realmID,
            final String dataSource) {

        PlatformServiceType serviceType;
        if (dataSource.equalsIgnoreCase("QBO")) {
            serviceType = PlatformServiceType.QBO;
        } else {
            serviceType = PlatformServiceType.QBD;
        }

        final OAuthCredentials oauthcredentials = new OAuthCredentials(
                oauth_consumer_key, oauth_consumer_secret,
                accessToken, accessTokenSecret);

        final PlatformSessionContext context = new PlatformSessionContext(
                oauthcredentials, appToken, serviceType, realmID);

        return context;
    }

    public static void main(String args[]){
        Test test = new Test();
    }
}

谢谢

于 2013-07-11T04:06:26.053 回答
0

请检查您的 menuproxy 网址是否正确。这可能会产生这个问题。参考: https ://developer.intuit.com/docs/0025_quickbooksapi/0010_getting_started/0020_connect/0010_from_within_your_app/add_the_connect_button

于 2013-07-11T13:23:18.673 回答