I used org.apache.http.impl.client.HttpClients to upload file from wowza app to external server.
In WMS 3.6.4 all works fine.
In WSE 4.0.1 I get error:
ERROR server comment 2014-03-11 16:36:57 - - - - - 24.472 - invoke(createSnapshotLive): java.lang.NoSuchFieldError: INSTANCE: org.apache.http.impl.io.DefaultHttpRequestWriterFactory.<init>(DefaultHttpRequestWriterFactory.java:52)
I found why this happens here http://stackoverflow.com/questions/21864521/java-lang-nosuchfielderror-org-apache-http-message-basiclineformatter-instance
The problem is that WSE 4.0.1 has conflicted class with apache http client library.
If I testing my upload file component. No error. Using class from original apache jar
jar:file:/C:/Program%20Files%20(x86)/Wowza%20Media%20Systems/Wowza%20Streaming%20Engine%204.0.1/lib/httpcore-4.3.2.jar!/org/apache/http/message/BasicLineFormatter.class
Then run component from wowza app. Error. Used class from wms-restlet-2.1.6.jar:
jar:file:/usr/local/WowzaStreamingEngine/lib/wms-restlet-2.1.6.jar!/org/apache/http/message/BasicLineFormatter.class
How should I use apache http client 4.3.3 lib in WSE 4.0.1?
I think the only solution is to re-write your uploader to avoid this: rename, extend to other names, or use the conflicting API. The only work-around would be to run Wowza Engine but not the Manager, which I think is where the conflict is.
Richard
Hi,
I forwarded your comments.
Thanks,
Richard
Thanks for the report, Denis.
Richard
Yeah, it looks like a hot topic. Today I faced the same issue.
I have a number of custom modules using Apache HttpClient 4.3.x and all of them are not working with Wowza 4 because it is packaged with wms-restlet-2.1.6.jar which has HttpClient 4.1.1 incorporated.
The problem is that HttpClient 4.1.x is rare thing, it is really hard to find, on the original site http://hc.apache.org/ there is no information about this version. I even can’t find the documentation for that.
The last version of restlet.org is 2.2 and it uses httpclient 4.3.x.
Is it possible for Wowza Streaming Engine to migrate to restlet.org-2.2 ?
Thank you,
Denis
Also there is another reason to use HttpClient 4.3 - because of GA version of HttpAsyncClient depend on it. So, if using HttpClient 4.1 we are limited to use HttpAsyncClient.
By the way, I just tried to remove built-in HttpClient from wms-restlet-2.1.6.jar and replace it with external jar of HttpClient 4.3.2. Seems Wowza REST API works fine with it but more testing needed to be sure.
Hello Wowza,
Please upgrade the HTTP Client to the latest version 4.3 along with 2.2 of restlet. I now have to get plugins remade for this HTTP 4.1 stuff just when I was looking to deploy Wowza 4 across the server farm for a client.
Thanks.
So you mean that it is not possible to use a popular library like http-client with Wowza anymore?
I am getting the same error when instancing PoolingHttpClientConnectionManager.
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
java.lang.NoSuchFieldError: INSTANCE
at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.(DefaultHttpRequestWriterFactory.java:52)
at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.(DefaultHttpRequestWriterFactory.java:56)
at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.(DefaultHttpRequestWriterFactory.java:46)
at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.(ManagedHttpClientConnectionFactory.java:72)
at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.(ManagedHttpClientConnectionFactory.java:84)
I fixed the problem moving the HttpCient initialization out of Server init event it was attached too.
I found similar posts of issues with HttpClient when it running in another java framework not related to stream in the initializing events. In this framework the problem was that HTTpClient was not serializable and objects in the init should be.
But not sure if it is the same thing here.
Now I got that the problem persist. I just was not throwing the error anymore.
Thanks, I rewrote this part using “curl” shell command