[Red5] All of a sudden no custom classes...?

Trevor Burton worldofpaper at googlemail.com
Sat Sep 27 01:25:09 PDT 2008


k, switching back to 0.7.0 i fixed my problem...
i had restarted my machine - and red5 started up in the background, when i
started red5 in eclipse via the plugin somehow i must have had two instances
running - not sure how as i was getting no 'address already in use'  - but i
think this was my problem.

so to send custom classes in 0.7.0 you don't need the IExternalizable
interface...

and you need the explicit/implicit getters/setters - so, client side, this
will work

private var test:Number;

private function setTest(value:Number):void
{
    test = value;
}

private function getTest():Number
{
    return test
}

or this will work:

private var _test:int;

private function set test(value:int):void
{
    _test = value;
}

private function get test():int
{
    return _test
}

and server side you'll need

private double l;

public double getL() {
    return l;
}

public void setL(double l) {
    this.l = l;
}

once i can get the trunk running i'll do a more thorough test and blog the
results with examples.

one final point is that it seems that all primitive types except String get
initialised to some default value. For instance if you don't initialise any
properties then Number will get returned as 0, Boolean as false... but
String comes back as null.... so maybe something to watch out for.

T

On Sat, Sep 27, 2008 at 8:20 AM, Trevor Burton
<worldofpaper at googlemail.com>wrote:

> I was using release 0.7.0 so i updated my trunk and decided to run tests
> against that.
> running Standalone.java as a java application won't work because there's a
> problem:
>
> lines 87-88 of LoggingContextSelector.java read:
>
> ContextInitializer ctxInit = new ContextInitializer(loggerContext);
> ctxInit .autoConfig();
>
> change to:
>
> //ContextInitializer ctxInit = new ContextInitializer();
> ContextInitializer.autoConfig(loggerContext);
>
> ok, now it runs.... but then fails because address is already in use....
> using tcpview shows me that 5080 and 8080 are being used by eclipse, i stop
> the startup process and they disappear - so running as a java application
> won't work because it blocks itself!
>
> so, i'll compile it as a jar and run via the red5 plugin... running the ant
> task from within eclipse doesn't work because the compiler fails... no
> reason why. So i run the same target from a command prompt and it's fine,
> builds the jar...
>
> running red5.bat fails, though, the window appears briefly, then
> disappears. going through the .bat file and trying to get it to a point
> where it'll at least stay visible so i can see how far it gets is
> unsuccessful, same with red5-bootstrap.bat
>
> so i've gone from having an application that works fine, to not even being
> able to start red5. this is sooooo frustrating.
>
> if anyone would like to provide some help i'd be extremely grateful - i'm
> not an experienced java developer, so could well be missing something
> obvious here.
>
> T
>
> On Fri, Sep 26, 2008 at 10:01 PM, Gordon Leland Hempton <
> ghempton at gmail.com> wrote:
>
>> I have had problems in the past using IExternalizable with readUTF and
>> writeUTF on red5. In the same case, it worked with readObject and
>> writeObject.
>>
>>
>> On Fri, Sep 26, 2008 at 1:54 PM, Trevor Burton <
>> worldofpaper at googlemail.com> wrote:
>>
>>> thanks for the reply, paul, i'll check the samples tomorrow am here and
>>> see if i can nail down exactly what works and what doesn't - right now i'm
>>> getting weird results when they're in a more complex app.
>>> T
>>>
>>>
>>> On Fri, Sep 26, 2008 at 9:27 PM, Mondain <mondain at gmail.com> wrote:
>>>
>>>> If there is a problem, lets getting it nailed down so we can do our
>>>> release!! :)
>>>>
>>>>
>>>> On Fri, Sep 26, 2008 at 1:26 PM, Mondain <mondain at gmail.com> wrote:
>>>>
>>>>> Not sure whats going on here.. my blog post should still apply, I use
>>>>> that style when needed. There were some patches applied to trunk recently
>>>>> that dealt with serializing/deserializing and this issue has attached sample
>>>>> for your inspection to verify my "working" results..
>>>>> http://jira.red5.org/browse/APPSERVER-283
>>>>>
>>>>> Paul
>>>>>
>>>>>
>>>>> On Fri, Sep 26, 2008 at 12:16 PM, Christopher Walzl <cwalzl at gmail.com>wrote:
>>>>>
>>>>>> Haha, no problem.  Great news!
>>>>>> I've been pretty excited about how active this Red5 community is.
>>>>>>  I've just started developing with it, and hope to continue with it in the
>>>>>> future! Great work on Red5 guys & gals!
>>>>>>
>>>>>> -Chris
>>>>>>
>>>>>> Chris Walzl
>>>>>> cwalzl at gmail.com
>>>>>> (972) 974-6728
>>>>>>
>>>>>> Sent from my MacBook Pro
>>>>>>
>>>>>> On Sep 26, 2008, at 2:01 PM, Trevor Burton wrote:
>>>>>>
>>>>>> Thanks Chris, i just removed the IExternalizable interface stuff and
>>>>>> it works!
>>>>>> after you mentioned that you didn't use any of that i thought i'd give
>>>>>> it a try.
>>>>>>
>>>>>> Paul, is this right? If so, how come it was working earlier today?
>>>>>>
>>>>>> weird, still as long as it's working.
>>>>>>
>>>>>> Chris, thank you very much for responding... i was getting to the edge
>>>>>> of my nerves there, the dog has left the room in disgust at my language :P
>>>>>>
>>>>>> T
>>>>>>
>>>>>> On Fri, Sep 26, 2008 at 7:54 PM, Christopher Walzl <cwalzl at gmail.com>wrote:
>>>>>>
>>>>>>> Did you up the logging in logback.xml?  There are various properties
>>>>>>> in there with either a setting of "DEBUG" "INFO" or "ERROR" I think.
>>>>>>>  Changing them to "DEBUG" may provide more information...
>>>>>>>
>>>>>>> Chris Walzl
>>>>>>> cwalzl at gmail.com
>>>>>>> (972) 974-6728
>>>>>>>
>>>>>>> Sent from my MacBook Pro
>>>>>>>
>>>>>>> On Sep 26, 2008, at 1:47 PM, Trevor Burton wrote:
>>>>>>>
>>>>>>> i've tried setting up a simple example using Paul's example
>>>>>>>
>>>>>>> http://gregoire.org/2008/09/12/using-custom-objects-in-amf3-with-red5/
>>>>>>>
>>>>>>> and it doesn't work either... this is really frustrating - i've
>>>>>>> uninstalled/reinstalled Red5 and still doesn't work.
>>>>>>>
>>>>>>> if i adjust paul's server side method to this.
>>>>>>>
>>>>>>> public MyClass getMyObject(MyClass param) {
>>>>>>> MyClass myObj = new MyClass();
>>>>>>> myObj.setL(1L);
>>>>>>>  myObj.setX(42);
>>>>>>> myObj.setB((byte) 1);
>>>>>>> myObj.setBool(true);
>>>>>>>         myObj.setStr("The quick brown fox");
>>>>>>>  return myObj;
>>>>>>>     }
>>>>>>>
>>>>>>> it returns null.
>>>>>>>
>>>>>>> if i change the netconnection call to
>>>>>>>
>>>>>>> connection.call( "getMyObject", resp, new MyClass() );
>>>>>>>
>>>>>>> it fails again, silently...
>>>>>>>
>>>>>>> i'm using flash for this - but am registering the class with
>>>>>>>
>>>>>>> registerClassAlias('org.red5.core.MyClass', MyClass );
>>>>>>>
>>>>>>> and that path is correct. And this is how i was doing it when it was
>>>>>>> working....
>>>>>>>
>>>>>>> T
>>>>>>>
>>>>>>> On Fri, Sep 26, 2008 at 7:31 PM, Trevor Burton <
>>>>>>> worldofpaper at googlemail.com> wrote:
>>>>>>>
>>>>>>>> not sure exactly how you're doing it Christopher, but your Red5 app
>>>>>>>> needs to be aware of the class yes....
>>>>>>>> I've tried making a simple example to show it failing....
>>>>>>>>
>>>>>>>> client side as looks like this:
>>>>>>>>
>>>>>>>> package
>>>>>>>> {
>>>>>>>> import flash.utils.IDataInput;
>>>>>>>> import flash.utils.IDataOutput;
>>>>>>>>  import flash.utils.IExternalizable;
>>>>>>>>
>>>>>>>> public class MyClass implements IExternalizable
>>>>>>>>  {
>>>>>>>> public var p : String = "100";
>>>>>>>>
>>>>>>>> public function MyClass()
>>>>>>>>  {
>>>>>>>> }
>>>>>>>>
>>>>>>>> public function readExternal(input : IDataInput) : void
>>>>>>>>  {
>>>>>>>> p = input.readUTF( );
>>>>>>>> }
>>>>>>>>
>>>>>>>> public function writeExternal(output : IDataOutput) : void
>>>>>>>>  {
>>>>>>>>  output.writeUTF( p );
>>>>>>>> }
>>>>>>>> }
>>>>>>>> }
>>>>>>>>
>>>>>>>> server side class looks like this:
>>>>>>>>
>>>>>>>> package org.red5.core;
>>>>>>>>
>>>>>>>> import org.red5.io.amf3.IDataInput;
>>>>>>>> import org.red5.io.amf3.IDataOutput;
>>>>>>>> import org.red5.io.amf3.IExternalizable;
>>>>>>>>
>>>>>>>> public class MyClass implements IExternalizable {
>>>>>>>>
>>>>>>>> public String string = "";
>>>>>>>>  public MyClass() {
>>>>>>>>  }
>>>>>>>>  public void readExternal(IDataInput input) {
>>>>>>>>  string = input.readUTF();
>>>>>>>> }
>>>>>>>>
>>>>>>>> public void writeExternal(IDataOutput output) {
>>>>>>>>  output.writeUTF(string);
>>>>>>>> }
>>>>>>>>
>>>>>>>> }
>>>>>>>>
>>>>>>>> and in an otherwise empty Application class i have this method
>>>>>>>>
>>>>>>>> public MyClass echo(MyClass myClass)
>>>>>>>> {
>>>>>>>> return myClass;
>>>>>>>> }
>>>>>>>>
>>>>>>>> and nothing happens... like i say, earlier today i had much more
>>>>>>>> complex examples all working... now something as basic as this is failing
>>>>>>>> and failing silently...
>>>>>>>>
>>>>>>>> T
>>>>>>>>
>>>>>>>> On Fri, Sep 26, 2008 at 7:24 PM, Christopher Walzl <
>>>>>>>> cwalzl at gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Hi Trevor,
>>>>>>>>> I recently had trouble with custom classes as well.  I'm probably
>>>>>>>>> doing it the wrong way, but my solution was to include that custom class as
>>>>>>>>> apart of the red5 application.
>>>>>>>>>
>>>>>>>>> For example, I have a webapp called "testServer" and it has a
>>>>>>>>> "classes" directory - I added the compiled custom .class files to this
>>>>>>>>> directory(within a diretory structure that matches the package statement).
>>>>>>>>>
>>>>>>>>> If it's possible to send custom classes over the wire to red5
>>>>>>>>> without it having access to the actual .class files, I'd love to hear about
>>>>>>>>> it!
>>>>>>>>>
>>>>>>>>> Good luck!
>>>>>>>>>
>>>>>>>>> Chris Walzl
>>>>>>>>> cwalzl at gmail.com
>>>>>>>>> (972) 974-6728
>>>>>>>>>
>>>>>>>>> Sent from my MacBook Pro
>>>>>>>>>
>>>>>>>>> On Sep 26, 2008, at 1:06 PM, Trevor Burton wrote:
>>>>>>>>>
>>>>>>>>> Been working on a Red5 project this afternoon.
>>>>>>>>> Everything was working fine until all of sudden Red5 fails when i
>>>>>>>>> try and send a custom class over the wire.
>>>>>>>>>
>>>>>>>>> nothing has changed, classes implement IExternalizable etc. etc. it
>>>>>>>>> was working, i restarted then it wasn't....
>>>>>>>>>
>>>>>>>>> i can't see what the problem is here, the console shows nothing, it
>>>>>>>>> doesn't try to load the custom class or anything. just nothing.
>>>>>>>>>
>>>>>>>>> has anyone encountered anything similar, or can anyone suggest a
>>>>>>>>> place to start trying to track this problem down, i've spent nearly 4 hours
>>>>>>>>> here trying to work out what's causing it and i'm no closer than i was when
>>>>>>>>> i started. :(
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Trevor Burton
>>>>>>>>> http://www.paperworld3d.com
>>>>>>>>>  _______________________________________________
>>>>>>>>> Red5 mailing list
>>>>>>>>> Red5 at osflash.org
>>>>>>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> Red5 mailing list
>>>>>>>>> Red5 at osflash.org
>>>>>>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Trevor Burton
>>>>>>>> http://www.paperworld3d.com
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Trevor Burton
>>>>>>> http://www.paperworld3d.com
>>>>>>>  _______________________________________________
>>>>>>> Red5 mailing list
>>>>>>> Red5 at osflash.org
>>>>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Red5 mailing list
>>>>>>> Red5 at osflash.org
>>>>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Trevor Burton
>>>>>> http://www.paperworld3d.com
>>>>>>  _______________________________________________
>>>>>> Red5 mailing list
>>>>>> Red5 at osflash.org
>>>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Red5 mailing list
>>>>>> Red5 at osflash.org
>>>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> http://gregoire.org/
>>>>> http://osflash.org/red5
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> http://gregoire.org/
>>>> http://osflash.org/red5
>>>>
>>>> _______________________________________________
>>>> Red5 mailing list
>>>> Red5 at osflash.org
>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>
>>>>
>>>
>>>
>>> --
>>> Trevor Burton
>>> http://www.paperworld3d.com
>>>
>>> _______________________________________________
>>> Red5 mailing list
>>> Red5 at osflash.org
>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>
>>>
>>
>>
>> --
>> Gordon Hempton
>> http://hempton.com
>>
>> _______________________________________________
>> Red5 mailing list
>> Red5 at osflash.org
>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>
>>
>
>
> --
> Trevor Burton
> http://www.paperworld3d.com
>



-- 
Trevor Burton
http://www.paperworld3d.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/red5_osflash.org/attachments/20080927/1535db15/attachment-0001.html 


More information about the Red5 mailing list