Hi I write custom module for restrict access for http sessions
In log i have many errors like this
invoke(onHTTPSessionCreate): java.lang.reflect.InvocationTargetException|
at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)|
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)|
at java.lang.reflect.Method.invoke(Method.java:483)|
at com.wowza.wms.module.ModuleFunction.invoke(ModuleFunction.java:383)|
at com.wowza.wms.module.ModuleFunctions.a(ModuleFunctions.java:670)|
but sometime it work correctly.
Any Ideas ?
Thanks for answer
This kind of error indicates the compiled jar file is not in the lib/ folder of your Wowza Streaming Engine install, or possibly anything it may rely on to work correctly.
What I would do is strip down the module to a bare minimum and get that working then add back any code to see if/how/when it fails.
Regards,
Salvadore
This kind of error indicates the compiled jar file is not in the lib/ folder of your Wowza Streaming Engine install, or possibly anything it may rely on to work correctly.
What I would do is strip down the module to a bare minimum and get that working then add back any code to see if/how/when it fails.
Regards,
Salvadore
Thanks for answer!
the jar 100% is in lib folder! And some time it working
I think may be it from asynhron calls… the code is very simple
package com.wowza.wms.example;
import com.wowza.wms.httpstreamer.model.IHTTPStreamerSession;
import com.wowza.wms.module.*;
import com.wowza.wms.application.*;
public class ModuleAccessControlHTTPStreaming extends ModuleBase
{
public void onHTTPSessionCreate(IHTTPStreamerSession httpSession)
{
boolean isGood = true;
String ipAddressClient = "";
String ipAddressServer = "";
String queryStr = "";
String referrer = "";
String cookieStr= "";
String userAgent= "";
try {
userAgent = httpSession.getUserAgent();
ipAddressClient = httpSession.getIpAddress();
queryStr = httpSession.getQueryStr();
referrer = httpSession.getReferrer();
cookieStr = httpSession.getCookieStr();
ipAddressServer = httpSession.getServerIp();
final String YYY = "xxx";
referrer = referrer.trim();
String[] array = {"ForkPlayer", "Chrome", "LibVLC","MXPlayer","Winamp"};
if (referrer != null && !referrer.isEmpty()) {
isGood = checkReferrer(referrer, YYY);
if(!isGood){
isGood = checkReferrer(referrer, "zzzzzzzzz.zz");}
if(!isGood){
isGood = checkReferrer(referrer, "xxxxxxx");}
if(!isGood){
isGood = referrer.contains("xxxxxx");
}
} else if (userAgent != null && !userAgent.isEmpty()) {
if (checkReferrerArray(userAgent, array)) {
isGood = false;
}
}
if (!isGood) {
httpSession.redirectSession("http://xxx.xxx.xxx.xxx:xxxx/vod/mp4:BUY_ITV.mp4/playlist.m3u8");
}
}catch (Exception e) {
getLogger().info("Errorr!!! accept:"+isGood+" ipAddressClient:"+ipAddressClient+" queryStr:"+queryStr+" referrer:"+referrer+" useragent:"+userAgent);
httpSession.redirectSession("http://xxx.xxx.xxx.xxx:xxxx/vod/mp4:BUY_ITV.mp4/playlist.m3u8");
}
finally
{
getLogger().info("EModuleAccessControlHTTPStreaming.onHTTPSessionCreate[ ]: accept:"+isGood+" ipAddressClient:"+ipAddressClient+" queryStr:"+queryStr+" referrer:"+referrer+" useragent:"+userAgent);
}
}
private static boolean checkReferrer(String whom, String withWhom) {
return whom.contains(withWhom);
}
private static boolean checkReferrerArray(String referrer, String[] parameters) {
for (String item : parameters) {
if (referrer.contains(item)) {
return true;
}
}
return false;
}
}
Have you added the VM Arguments to your IDE?
In Eclipse, right click on the project in the left menu and choose “properties”
Next, click on the Run/Debug settings on the left, highlight the launch configuration and click Edit
Under the “arguments” tab, add the following line to the output in “VM Arguments”
On Windows:
-Dcom.wowza.wms.native.base="win"
On Mac:
-Dcom.wowza.wms.native.base="osx"
Salvadore
Hi ,
This may be caused due to Exception declaration in onHTTPSessionCreate. I think after the removal of exception it will work.
Regards
Manas