4

I am currently using the Quick Books Online SDK and some of their code is throwing a class not found error. Has anyone ever ran into this problem or a similar one?

I looked at their HelloWorld app example and I do not see anything different from my current implementation. Moreover, I really only need their default configuration.

METHOD CAUSING ERROR =>>

/**
 * Extracts environment properties on a JRE < 1.5. This implementation
 * uses ant for this purpose.
 */
void extractProperties14()
{
    extractPropertiesFromCollection(Execute.getProcEnvironment());
}

TRACE =>>>

java.lang.ClassNotFoundException: org.apache.tools.ant.taskdefs.Execute
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) ~[na:na]
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]
    at org.apache.commons.configuration.EnvironmentConfiguration.extractProperties14(EnvironmentConfiguration.java:160) ~[commons-configuration-1.6.jar:1.6]
    at org.apache.commons.configuration.EnvironmentConfiguration.<init>(EnvironmentConfiguration.java:77) ~[commons-configuration-1.6.jar:1.6]
    at com.intuit.ipp.util.Config.<init>(Config.java:218) ~[ipp-v3-java-devkit-4.0.3-jar-with-dependencies.jar:na]
    at com.intuit.ipp.util.Config.<init>(Config.java:30) ~[ipp-v3-java-devkit-4.0.3-jar-with-dependencies.jar:na]
    at com.intuit.ipp.util.Config$1.initialValue(Config.java:188) ~[ipp-v3-java-devkit-4.0.3-jar-with-dependencies.jar:na]
    at com.intuit.ipp.util.Config$1.initialValue(Config.java:186) ~[ipp-v3-java-devkit-4.0.3-jar-with-dependencies.jar:na]
    at java.base/java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:195) ~[na:na]
    at java.base/java.lang.ThreadLocal.get(ThreadLocal.java:172) ~[na:na]
    at com.intuit.ipp.util.Config$1.get(Config.java:192) ~[ipp-v3-java-devkit-4.0.3-jar-with-dependencies.jar:na]
    at com.intuit.ipp.util.Config$1.get(Config.java:186) ~[ipp-v3-java-devkit-4.0.3-jar-with-dependencies.jar:na]
    at com.intuit.ipp.util.Config.setProperty(Config.java:247) ~[ipp-v3-java-devkit-4.0.3-jar-with-dependencies.jar:na]
    at com.incursus.patch.helper.QBOServiceHelper.getDataService(QBOServiceHelper.java:24) ~[classes/:na]
    at com.incursus.patch.web.PortalController.callQBOCompanyInfo(PortalController.java:89) ~[classes/:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:215) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
Thomas Fritsch
  • 9,639
  • 33
  • 37
  • 49
incursus
  • 63
  • 2
  • 6
  • did you try to clean and build?(rebuild) – Jonathan JOhx Jan 14 '19 at 23:25
  • Check the following link to see if it might help solve your issue. Chances are you're not including the jar on the path. https://examples.javacodegeeks.com/java-basics/exceptions/java-lang-classnotfoundexception-how-to-solve-class-not-found-exception/ – locus2k Jan 14 '19 at 23:25
  • Are you sure that `org.apache.tools.ant.taskdefs.Execute` the same class for `Execute.getProcEnvironment()`? Are you accidentally importing a different `Execute` class in the file containing the `extractProperties14()` method? – entpnerd Jan 15 '19 at 00:24

1 Answers1

1

You may be having an issue related to a missing library on your application classpath

So basically you can try two options:

  1. Find the compatible version and add the Apache Ant Core on your classpath
  2. Try to upgrade your apache-commons-configuration 1.6 to apache-commons-configuration 1.10 which does not require the Execute class.

Here is the source code of the EnvironmentConfiguration currently in the version 1.10:

/**
 * Create a Configuration based on the environment variables.
 *
 * @see System#getenv()
 */
public EnvironmentConfiguration()
{
    super(new HashMap<String, Object>(System.getenv()));
}

Of course you will have to test and validate if upgrading the version will not cause any incompatibility at runtime.

nortontgueno
  • 2,553
  • 1
  • 24
  • 36