Reputation: 554
I am using the jar provided by intuit (ipp-java-devkit-2.0.11-jar-with-dependencies.jar) and having some difficulty. I am able to create my PlatformSessionContext so I know that it is not completely broken. When calling new PlatformClient() I get the following exception:
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)
Is there something that I missed?
Upvotes: 1
Views: 292
Reputation: 554
Figured it out. Issue was that the slf4j logging jars were newer versions and incompatible with what I already have running on my server. Found a (jBoss) deployment error that I didn't notice before:
16:27:26,172 ERROR [STDERR] SLF4J: slf4j-api 1.6.x (or later) is incompatible with this binding.
16:27:26,173 ERROR [STDERR] SLF4J: Your binding is version 1.5.5 or earlier.
16:27:26,173 ERROR [STDERR] SLF4J: Upgrade your binding to version 1.6.x. or 2.0.x
Fix was to remove ipp-java-devkit-2.0.11-jar-with-dependencies.jar and replace with ipp-java-devkit-2.0.11.jar then add a couple jars for the missing dependencies.
The jars I needed to add were:
org.apache.felix.bundlerepository-1.0.3.jar for xmlpull.v1.xmlpullparser, xmlpull.v1.xmlserializer, kdom.Document
signpost-core-1.2.1.1.jar for OAuth stuff
Upvotes: 1
Reputation: 5340
It is working fine for me. Can you please try the following.
final PlatformSessionContext context = getPlatformContext(accesstoken,
accessstokensecret, realmID, dataSource);
PlatformClient client = new PlatformClient();
System.out.println("User's email " + client.getUserInfo(context).getEmail());
JavaDoc Ref - http://developer-static.intuit.com/SDKDocs/QBV2Doc/ipp-java-devkit-2.0.10-SNAPSHOT-javadoc/ (com.intuit.platform.client.PlatformClient)
Please let me know if it works for you.
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();
}
}
Thanks
Upvotes: 0
Reputation: 2367
Please check if your menuproxy url is correct. That can create this issue. Reference: https://developer.intuit.com/docs/0025_quickbooksapi/0010_getting_started/0020_connect/0010_from_within_your_app/add_the_connect_button
Upvotes: 0