# WEBRTC stream publish failed with custom module

**URL:** https://community.wowza.com/t/webrtc-stream-publish-failed-with-custom-module/55585
**Category:** Wowza Streaming Engine
**Tags:** wowza-streaming-server-java-api, webrtc
**Created:** [July 17, 2020, 4:53pm UTC](https://community.wowza.com/t/webrtc-stream-publish-failed-with-custom-module/55585 "2020-07-17T16:53:33Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Ajander\_Singh](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@Ajander\_Singh](https://community.wowza.com/u/Ajander_Singh)
#### Post date: [July 17, 2020, 4:53pm UTC](https://community.wowza.com/t/webrtc-stream-publish-failed-with-custom-module/55585/1 "2020-07-17T16:53:33Z")

</div>

Hi,

I am facing problem with custom module and WebRTC stream with Wowza server and I am using JDK-14.0.1 for Java and I am unable to publish WebRTC Stream.

I created a Java module and it doesn’t have any logic and it contains only logging. I create a app in wowza with name bienapp and add custom module in **bienapp** as below:

When I try publish WebRTC Stream then i get **_"Publish failed. Unable to connect."_**

Custom module code

```auto
package com.bientechnologies.wowza;

import com.wowza.wms.application.*;
import com.wowza.wms.amf.*;
import com.wowza.wms.client.*;
import com.wowza.wms.module.*;
import com.wowza.wms.request.*;
import com.wowza.wms.stream.*;
import com.wowza.wms.transcoder.util.TranscoderStreamUtils;
import com.wowza.wms.rtp.model.*;
import com.wowza.wms.httpstreamer.model.*;
import com.wowza.wms.httpstreamer.cupertinostreaming.httpstreamer.*;
import com.wowza.wms.httpstreamer.smoothstreaming.httpstreamer.*;
 
public class BienApplication extends ModuleBase {
    // private BienStreamListener bienStreamListener;
    
    public void doSomething(IClient client, RequestFunction function, AMFDataList params) {
        getLogger().info("doSomething");
        sendResult(client, params, "Bien-Hello Wowza");
    }

    public void onAppStart(IApplicationInstance appInstance) {
        String fullname = appInstance.getApplication().getName() + "/" + appInstance.getName();
        getLogger().info("Bien-onAppStart: " + fullname);
        
        // this.bienStreamListener = new BienStreamListener(appInstance);
    }

    public void onAppStop(IApplicationInstance appInstance) {
        String fullname = appInstance.getApplication().getName() + "/" + appInstance.getName();
        getLogger().info("Bien-onAppStop: " + fullname);
    }

    public void onConnect(IClient client, RequestFunction function, AMFDataList params) {
        getLogger().info("Bien-onConnect: " + client.getClientId());
    }

    public void onConnectAccept(IClient client) {
        getLogger().info("Bien-onConnectAccept: " + client.getClientId());
    }

    public void onConnectReject(IClient client) {
        getLogger().info("Bien-onConnectReject: " + client.getClientId());
    }

    public void onDisconnect(IClient client) {
        getLogger().info("Bien-onDisconnect: " + client.getClientId());
    }

    public void onStreamCreate(IMediaStream stream) {
        getLogger().info("Bien-onStreamCreate: " + stream.getSrc());
        
        //AMFPacket keyFrame = stream.getLastKeyFrame();
        //fitmode: Fit mode (how video frame is fit to frame size). Valid values are letterbox, stretch, fit-height, fit-width, match-source, crop (default is letterbox).
        //int fitmode = TranscoderStreamUtils.frameSizeFitModeToId("letterbox");
    }

    public void onStreamDestroy(IMediaStream stream) {
        getLogger().info("Bien-onStreamDestroy: " + stream.getSrc());
    }

    public void onHTTPSessionCreate(IHTTPStreamerSession httpSession) {
        getLogger().info("Bien-onHTTPSessionCreate: " + httpSession.getSessionId());
    }

    public void onHTTPSessionDestroy(IHTTPStreamerSession httpSession) {
        getLogger().info("Bien-onHTTPSessionDestroy: " + httpSession.getSessionId());
    }

    public void onHTTPCupertinoStreamingSessionCreate(HTTPStreamerSessionCupertino httpSession) {
        getLogger().info("Bien-onHTTPCupertinoStreamingSessionCreate: " + httpSession.getSessionId());
    }

    public void onHTTPCupertinoStreamingSessionDestroy(HTTPStreamerSessionCupertino httpSession) {
        getLogger().info("Bien-onHTTPCupertinoStreamingSessionDestroy: " + httpSession.getSessionId());
    }

    public void onHTTPSmoothStreamingSessionCreate(HTTPStreamerSessionSmoothStreamer httpSession) {
        getLogger().info("Bien-onHTTPSmoothStreamingSessionCreate: " + httpSession.getSessionId());
    }

    public void onHTTPSmoothStreamingSessionDestroy(HTTPStreamerSessionSmoothStreamer httpSession) {
        getLogger().info("Bien-onHTTPSmoothStreamingSessionDestroy: " + httpSession.getSessionId());
    }

    public void onRTPSessionCreate(RTPSession rtpSession) {
        getLogger().info("Bien-onRTPSessionCreate: " + rtpSession.getSessionId());
    }

    public void onRTPSessionDestroy(RTPSession rtpSession) {
        getLogger().info("Bien-onRTPSessionDestroy: " + rtpSession.getSessionId());
    }

    public void onCall(String handlerName, IClient client, RequestFunction function, AMFDataList params) {
        getLogger().info("Bien-onCall: " + handlerName);
    }

}

```

Kindly suggest on above.

Thanks

---

<div class="post-metadata">

### Author: ![Rose\_Power-Wowza\_Com](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/rose_power-wowza_com/32/431_2.png) [@Rose\_Power-Wowza\_Com](https://community.wowza.com/u/Rose_Power-Wowza_Com)
#### Post date: [July 17, 2020, 5:13pm UTC](https://community.wowza.com/t/webrtc-stream-publish-failed-with-custom-module/55585/2 "2020-07-17T17:13:18Z")

</div>

I did remove the one image you posted that showed your private SSL certificate. I would suggest that you request a new SSL cert and configure it as your security may now be compromised for your Engine applications.

---

<div class="post-metadata">

### Author: ![Rose\_Power-Wowza\_Com](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/rose_power-wowza_com/32/431_2.png) [@Rose\_Power-Wowza\_Com](https://community.wowza.com/u/Rose_Power-Wowza_Com)
#### Post date: [July 17, 2020, 4:58pm UTC](https://community.wowza.com/t/webrtc-stream-publish-failed-with-custom-module/55585/3 "2020-07-17T16:58:12Z")

</div>

At this time, Wowza Streaming Engine (version 4.7.8 and later) is built on Java 9 (OpenJDK Java SE JRE 9.0.4) and supports Java 9 - Java 12. Are you able to test with a Java version that we support?

[https://www.wowza.com/docs/how-to-install-and-configure-wowza-streaming-engine](https://www.wowza.com/docs/how-to-install-and-configure-wowza-streaming-engine)

---

<div class="post-metadata">

### Author: ![Ajander\_Singh](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@Ajander\_Singh](https://community.wowza.com/u/Ajander_Singh)
#### Post date: [July 18, 2020, 5:50am UTC](https://community.wowza.com/t/webrtc-stream-publish-failed-with-custom-module/55585/4 "2020-07-18T05:50:40Z")

</div>

I have removed installed JDK and intsalled SE JDK11 on my machine, removed existing JAR file from wowza installation folder and built new JAR file but no luck. I am still facing same problem and I can see below message in logs:

Please suggest.

Thanks

---

<div class="post-metadata">

### Author: ![Ajander\_Singh](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@Ajander\_Singh](https://community.wowza.com/u/Ajander_Singh)
#### Post date: [July 20, 2020, 2:59pm UTC](https://community.wowza.com/t/webrtc-stream-publish-failed-with-custom-module/55585/5 "2020-07-20T14:59:50Z")

</div>

I created new Project and no custom code and it has only class definition. I found a error/warning in Logs and it seems that module is not loaded.

BienWebRTCModule.java code

```auto
package com.bientechnologies;

import com.wowza.wms.application.*;
import com.wowza.wms.amf.*;
import com.wowza.wms.client.*;
import com.wowza.wms.module.*;
import com.wowza.wms.request.*;
import com.wowza.wms.stream.*;
import com.wowza.wms.rtp.model.*;
import com.wowza.wms.httpstreamer.model.*;
import com.wowza.wms.httpstreamer.cupertinostreaming.httpstreamer.*;
import com.wowza.wms.httpstreamer.smoothstreaming.httpstreamer.*;

public class BienWebRTCModule extends ModuleBase {

    public void onAppStart(IApplicationInstance appInstance) {
        String fullname = appInstance.getApplication().getName() + "/" + appInstance.getName();
        getLogger().info("Bien-onAppStart: " + fullname);
    }
 
    public void onAppStop(IApplicationInstance appInstance) {
        String fullname = appInstance.getApplication().getName() + "/" + appInstance.getName();
        getLogger().info("Bien-onAppStop: " + fullname);
    }

    public void onConnect(IClient client, RequestFunction function, AMFDataList params) {
        getLogger().info("Bien-onConnect: " + client.getClientId());
    }

    public void onConnectAccept(IClient client) {
        getLogger().info("Bien-onConnectAccept: " + client.getClientId());
    }

    public void onConnectReject(IClient client) {
        getLogger().info("Bien-onConnectReject: " + client.getClientId());
    }

    public void onDisconnect(IClient client) {
        getLogger().info("Bien-onDisconnect: " + client.getClientId());
    }

    public void onStreamCreate(IMediaStream stream) {
        getLogger().info("Bien-onStreamCreate: " + stream.getSrc());
    }

    public void onStreamDestroy(IMediaStream stream) {
        getLogger().info("Bien-onStreamDestroy: " + stream.getSrc());
    }

}

```

Registered module in Wowza App:

---

<div class="post-metadata">

### Author: ![Amara\_Graham](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/amara_graham/32/381_2.png) [@Amara\_Graham](https://community.wowza.com/u/Amara_Graham)
#### Post date: [July 20, 2020, 3:08pm UTC](https://community.wowza.com/t/webrtc-stream-publish-failed-with-custom-module/55585/6 "2020-07-20T15:08:15Z")

</div>

Before including the custom module, have you tried running the basic WebRTC workflow?

When including your custom module, did you restart Engine? You will need to restart engine after adding or editing your module.
