06-18-2020 11:03 AM
Hello,
I am writing a class file for 'end call' in studio that does a rest call (post) to a CRM for attaching recordings to incident records from my IVR/VXML application. My code works fine stand-alone, but when trying to run in CVP/VXML I am getting the following error...
The error was: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
code snippet...
CredentialsProvider provider = new BasicCredentialsProvider(); UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("<user>", <pswd>"); provider.setCredentials(AuthScope.ANY, credentials); CloseableHttpClient client = HttpClientBuilder.create() .setDefaultCredentialsProvider(provider) .build(); HttpPost post = new HttpPost("<URL>"); post.setHeader("Accept", "application/json"); post.setHeader("Content-Type", "audio/wav"); String textFileName = "C:/Temp/sample.wav"; byte[] fileBytes = getBytes(textFileName); post.setEntity(new ByteArrayEntity(fileBytes)); ResponseHandler<String> responseHandler=new BasicResponseHandler(); String responseBody = client.execute(post, responseHandler); System.out.println(responseBody);
The issue seems to be w/ using the CloseableHttpClient. For some reason, when using this, the app doesn't seem to find the commons-logging jar in the classpath. I've used other HttpClient code in other apps successfully (or used java.net instead of HttpClient), but it seems like some features do not work in CVP. I've tried adding all the HttpClient jars in my applications /java/util/lib and /java/appliation/lib directories and that hasn't helped. I'm assuming it's because CVP has those jars in the parent classpath already and they take precedence over the app-level versions.
I've also tried pulling the httpclient and commons jars off of cvp and running them in the classpath of my stand-alone app - and that works fine so I don't think it's a version/feature issue.
I'm hoping someone has run into this and can help me out.
Thanks,
Ryan.
Solved! Go to Solution.
06-22-2020 07:52 AM
David,
Thanks for the response. I don't think it's silly as a lot of times it does seem to be the small things that are overlooked that cause an issue. Unfortunately, in this instance, I have tried restarting VXML and that didn't help.
I did end up getting my application working by re-writing the class using HttpURLConnection instead of HTTPClient. This worked w/out conflict. I would still like to understand why HTTPClient seems to have issues, but as the problem is resolved, i'll close this thread and mark it as solved.
Thanks,
Ryan.
06-19-2020 06:58 AM
06-22-2020 07:52 AM
David,
Thanks for the response. I don't think it's silly as a lot of times it does seem to be the small things that are overlooked that cause an issue. Unfortunately, in this instance, I have tried restarting VXML and that didn't help.
I did end up getting my application working by re-writing the class using HttpURLConnection instead of HTTPClient. This worked w/out conflict. I would still like to understand why HTTPClient seems to have issues, but as the problem is resolved, i'll close this thread and mark it as solved.
Thanks,
Ryan.
06-22-2020 08:04 AM
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide