How to use newer external libraries in Wowza project

I want to use HttpComponents/Client 4.3 a newer version (I think) to what Wowza uses. I have tried adding the necessary external jars (httpclient-4.3.3.jar, httpcore-4.3.2.jar) to wowza/lib and restarted wowza but it still throws errors in the ide e.g.

Description	Resource	Path	Location	Type
The constructor UrlEncodedFormEntity(List<NameValuePair>, Charset) is undefined	MediaWriteListener.java	/MediaWriteListener/src/com/newtriks	line 53	Java Problem
Description	Resource	Path	Location	Type
The method consumeQuietly(HttpEntity) is undefined for the type EntityUtils	MediaWriteListener.java	/MediaWriteListener/src/com/newtriks	line 57	Java Problem

Please could someone highlight the exact steps to override older wowza related classes with my external libs?

Update:

This seems to be related to this thread which has an unanswered question posed at the end of the thread. They raise a point which enforces my question. How to manage conflicting (popular) classes with the older dated versions WSE bundles.

I can fix the warnings in the IDE using:

  1. Right click Referenced Libraries > Build Path > Configure Build Path…

  2. Select Order and Export tab.

  3. Select external classes and move them to the top.

On the remote wowza EC2 instance it still is not working and throws the below error. Bizarrely locally it works…

ERROR 500 - invoke(onAppStart): 
java.lang.NoSuchFieldError: INSTANCE: org.apache.http.impl.io.DefaultHttpRequestWriterFactory.<init>(DefaultHttpRequestWriterFactory.java:52)

Reference ticket #85046

I am yet to find the true cause of this issue, however, https://code.google.com/p/jarjar/ was the ultimate solution I resorted to…

Hi,

What does “Reference ticket #85046” ticket means?

For me it works locally too. Just in production server it do not.

Another strange think is that if the code is added in the init server listener it throws an exception, but if it is in another place it just kill the thread silently.

It makes it very hard to debug.

hi newtriks,

your tip was great. Thanks.

I fixed using maven shade plugin

org.apache.maven.plugins

maven-shade-plugin

1.4

package

shade

false

true

org.apache.httpcomponents:httpclient

org.apache.httpcomponents:httpcore

org.apache.http

wowza.org.apache.http