# HTTP URLConnection Calls not working in custom module

**URL:** <https://community.wowza.com/t/http-urlconnection-calls-not-working-in-custom-module/40907>\
**Category:** Wowza Developer Dojo\
**Tags:** wowza-streaming-server-java-api\
**Created:** [March 29, 2014, 1:32am UTC](https://community.wowza.com/t/http-urlconnection-calls-not-working-in-custom-module/40907 "2014-03-29T01:32:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajdep\_Rath](https://avatars.discourse-cdn.com/v4/letter/r/bcef8e/32.png) [@Rajdep\_Rath](https://community.wowza.com/u/Rajdep_Rath)\
**Post date:** [March 29, 2014, 1:32am UTC](https://community.wowza.com/t/http-urlconnection-calls-not-working-in-custom-module/40907/1 "2014-03-29T01:32:15Z")

</div>

I have been working on a custom live record module. I had tested it locally but then it want working on-line.

The error received is :

ERROR server comment - [appname/_definst_]LiveStreamRecorderFLV.startRecording: open file (H:\Program Files\Wowza Media Systems\Wowza Media Server 3.6.4\content\test3\_2014-03-31-00.42.07.861-IST\_0.flv): java.lang.NullPointerException

But i dont get this error if i am running this module on wowza streaming engine 4.x. However i do get it in 3.6.X. Does this mean live recording is not supported on older wowza ? I followed code examples from here:

[https://www.wowza.com/docs/how-to-start-and-stop-live-stream-recordings-programmatically-imediastreamactionnotify3](https://www.wowza.com/docs/how-to-start-and-stop-live-stream-recordings-programmatically-imediastreamactionnotify3)

Complete stack trace is:

```auto
ERROR server comment - invoke(closeStream): java.lang.NullPointerException: java.io.File.<init>(null:-1)
java.lang.NullPointerException
	at java.io.File.<init>(Unknown Source)
	at com.packagename.server.wms.module.MyLiveRecord$SegmentListener.onSegmentEnd(MyLiveRecord.java:98)
	at com.wowza.wms.livestreamrecord.model.LiveStreamRecorderBase.notifySegmentEnd(LiveStreamRecorderBase.java:444)
	at com.wowza.wms.livestreamrecord.model.LiveStreamRecorderFLV.a(LiveStreamRecorderFLV.java:79)
	at com.wowza.wms.livestreamrecord.model.LiveStreamRecorderFLV.onUnPublish(LiveStreamRecorderFLV.java:332)
	at com.wowza.wms.livestreamrecord.model.LiveStreamRecordActionNotifier.onUnPublish(LiveStreamRecordActionNotifier.java:37)
	at com.wowza.wms.stream.MediaStream.notifyActionUnPublish(MediaStream.java:2288)
	at com.wowza.wms.client.Client.closeOpenStream(Client.java:1703)
	at com.wowza.wms.module.ModuleCore.closeStream(ModuleCore.java:787)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.wowza.wms.module.ModuleFunction.invoke(ModuleFunction.java:346)
	at com.wowza.wms.module.ModuleFunctions.invoke(ModuleFunctions.java:214)
	at com.wowza.wms.request.RequestProcessFunctions.processFunctions(RequestProcessFunctions.java:110)
	at com.wowza.wms.request.RequestProcessData.flushFunction(RequestProcessData.java:58)
	at com.wowza.wms.request.RequestProcessData.processNextRequest(RequestProcessData.java:852)
	at com.wowza.wms.client.ClientWorker.processNextReq(ClientWorker.java:83)
	at com.wowza.wms.request.RTMPRequestAdapter.service(RTMPRequestAdapter.java:587)
	at com.wowza.wms.server.ServerHandler.a(ServerHandler.java:653)
	at com.wowza.wms.server.ServerHandler.a(ServerHandler.java:375)
	at com.wowza.wms.server.ServerHandler.messageReceived(ServerHandler.java:487)
	at com.wowza.wms.server.ServerHandlerThreadedSession.run(ServerHandlerThreadedSession.java:108)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

```

Can some one clarify me on this ?

---

<div class="post-metadata">

**Author:** ![Rajdep\_Rath](https://avatars.discourse-cdn.com/v4/letter/r/bcef8e/32.png) [@Rajdep\_Rath](https://community.wowza.com/u/Rajdep_Rath)\
**Post date:** [March 30, 2014, 11:20am UTC](https://community.wowza.com/t/http-urlconnection-calls-not-working-in-custom-module/40907/2 "2014-03-30T11:20:21Z")

</div>

I managed to resolve the issue after using wowza media server 3.6 to debug the module. There seems to be some differences in wowza streaming engine edition and the older WMS. The fragment of code throwing the error was this:

```auto
public void onSegmentStart(ILiveStreamRecord recorder)
		{
			String filepath = recorder.getCurrentFile();
		}

```

This throws a nullpointer exception in wowza 3.6 where as it runs fine on wowza streaming engine. The fix was to use getFilePath rather than getCurrentFile

```auto
public void onSegmentStart(ILiveStreamRecord recorder)
		{
			String filepath = getFilePath();
		}

```

---

<div class="post-metadata">

**Author:** ![Roger\_Littin1](https://avatars.discourse-cdn.com/v4/letter/r/c89c15/32.png) [@Roger\_Littin1](https://community.wowza.com/u/Roger_Littin1)\
**Post date:** [March 31, 2014, 12:10pm UTC](https://community.wowza.com/t/http-urlconnection-calls-not-working-in-custom-module/40907/3 "2014-03-31T12:10:29Z")

</div>

Hi,

Good to see that you got it working.

As you have noticed, the recording API did change a lot in Wowza Streaming Engine. The main reasons for the changes is so that all of the different recording methods would work together. Previously, if you started a recording using the LiveStreamRecord HTTP provider then it would not be available in the API methods.

The new method is to use the StreamRecorder API which does allow recordings that are started with the manager to be accessible via the API.

Roger.
