cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1488
Views
5
Helpful
3
Replies

issue in cvp 11.6 using CloseableHttpClient

rbroersma
Level 1
Level 1

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.

1 Accepted Solution

Accepted Solutions

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.

View solution in original post

3 Replies 3

Might be silly, but did you restart the VXML server after you added the new jars?

 

david

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.

Glad you figured it out and +5 for actually posting your solution.

 

david

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: