[Red5] ClassLoader Problem

Mondain mondain at gmail.com
Fri Jan 25 15:40:57 PST 2008


Logically if you're classes were on the client or on the classpath you would
not get this error:

java.lang.ClassNotFoundException:
it.intelligere.fss.servent.core.strategies.proxy.Request



On Jan 25, 2008 2:48 PM, tavolate <
Agostino.Semeria at external.thalesaleniaspace.com> wrote:

>
> Unfortunately, your solution don't work. As I thought, the classes are
> already into the jar of the client. I think that to load my classes, java
> uses a classloader and it's knows all my classes, but the classloader used
> to load the mina classes, don't knows my classes. My client, extend the
> RTMPClient classes provided by Red5 and this class uses Mina. There is
> some
> configuration file for Mina to use for this purpose (where I can set up my
> classpath)?
>
>
> tavolate wrote:
> >
> > Thank you for your response. I try this evening, but I don't think it's
> > the solution, because the classes are already insite the "myApplet.jar".
> I
> > hope you are right...because I haven't any idea...
> >
> >
> >
> > Mondain wrote:
> >>
> >> If its an applet, you could just jar up all the classes required and
> use
> >> the
> >> archive attribute of the applet tag:
> >> <applet code="myPackage.myClass.class" codeBase="
> >> http://www.someServer/someFolder/" archive="myApplet.jar">
> >>
> >> These pages might explain a bit better than I have:
> >> http://mindprod.com/jgloss/applet.html
> >>
> http://www.velocityreviews.com/forums/t152635-java-applet-classpath.html
> >> http://scv.bu.edu/Doc/Java/tutorial/tools/environment/classpath.html
> >>
> >> Its been a very long time since my last applet development effort..
> >>
> >> On Jan 25, 2008 8:10 AM, tavolate <
> >> Agostino.Semeria at external.thalesaleniaspace.com> wrote:
> >>
> >>>
> >>> The problem is on the client and it is an Applet... I don't know how I
> >>> can
> >>> add my classes. And more, my client knows the class because are loaded
> >>> by
> >>> the same classloader, but the MINA thread that is created (on the
> >>> client)
> >>> when a request is made by the server, it has a classloader that don't
> >>> knows
> >>> my class.
> >>>
> >>>
> >>> Mondain wrote:
> >>> >
> >>> > Agostino,
> >>> > All you should need to do is place your classes within the
> application
> >>> > classpath. The easiest way to do this is to jar them up and place
> the
> >>> jar
> >>> > in
> >>> > the <myapp>/WEB-INF/lib directory.
> >>> >
> >>> > Paul
> >>> >
> >>> > On Jan 25, 2008 12:20 AM, tavolate <
> >>> > Agostino.Semeria at external.thalesaleniaspace.com> wrote:
> >>> >
> >>> >>
> >>> >> Hi,
> >>> >>  I made application client - server with Red5. The client is
> >>> implemented
> >>> >> with Java. For this purpose, my client extends the RTMPClient
> class.
> >>> I
> >>> >> can
> >>> >> call remote function easily on the server. I would like to calls
> some
> >>> >> function on another connected client to the server. To do that, the
> >>> >> client
> >>> >> A, call a function on the server and then the server call the
> >>> function
> >>> >> requested on the client B. The function that I would like to call
> has
> >>> one
> >>> >> parameter. This parameter is of type MyClass.
> >>> >>
> >>> >> I can call this function on the server BUT when the server call the
> >>> >> function
> >>> >> on the client B, on the client B there is an error: the MyClass is
> >>> not
> >>> >> found.
> >>> >>
> >>> >> ERROR [SocketConnectorIoProcessor-1.0] (Input.java:383) - Error
> >>> loading
> >>> >> class: it.intelligere.fss.servent.core.strategies.proxy.Request
> >>> >> java.lang.ClassNotFoundException:
> >>> >> it.intelligere.fss.servent.core.strategies.proxy.Request
> >>> >>        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> >>> >>        at java.security.AccessController.doPrivileged(Native
> Method)
> >>> >>        at java.net.URLClassLoader.findClass(URLClassLoader.java
> :188)
> >>> >>        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> >>> >>        at
> >>> sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
> >>> >>        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> >>> >>        at org.red5.io.amf.Input.newInstance(Input.java:379)
> >>> >>        at org.red5.io.amf.Input.readObject(Input.java:479)
> >>> >>        at
> >>> org.red5.io.object.Deserializer.deserialize(Deserializer.java
> >>> >> :83)
> >>> >>        at
> >>> >>
> >>>
> org.red5.server.net.rtmp.codec.RTMPProtocolDecoder.decodeNotifyOrInvoke
> >>> (
> >>> >> RTMPProtocolDecoder.java:790)
> >>> >>        at
> >>> >> org.red5.server.net.rtmp.codec.RTMPProtocolDecoder.decodeInvoke(
> >>> >> RTMPProtocolDecoder.java:715)
> >>> >>        at
> >>> >> org.red5.server.net.rtmp.codec.RTMPProtocolDecoder.decodeMessage(
> >>> >> RTMPProtocolDecoder.java:523)
> >>> >>        at
> >>> >> org.red5.server.net.rtmp.codec.RTMPProtocolDecoder.decodePacket(
> >>> >> RTMPProtocolDecoder.java:419)
> >>> >>        at
> >>> >> org.red5.server.net.rtmp.codec.RTMPProtocolDecoder.decode(
> >>> >> RTMPProtocolDecoder.java:201)
> >>> >>        at
> >>> >> org.red5.server.net.rtmp.codec.RTMPProtocolDecoder.decodeBuffer(
> >>> >> RTMPProtocolDecoder.java:122)
> >>> >>        at
> >>> >> org.red5.server.net.rtmp.codec.RTMPMinaProtocolDecoder.decode(
> >>> >> RTMPMinaProtocolDecoder.java:60)
> >>> >>        at
> >>> >> org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(
> >>> >> ProtocolCodecFilter.java:156)
> >>> >>        at
> >>> >>
> >>> >>
> >>>
> org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived
> >>> >> (AbstractIoFilterChain.java:299)
> >>> >>        at
> >>> >> org.apache.mina.common.support.AbstractIoFilterChain.access$1100(
> >>> >> AbstractIoFilterChain.java:53)
> >>> >>        at
> >>> >>
> >>> >>
> >>>
> org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived
> >>> >> (AbstractIoFilterChain.java:648)
> >>> >>        at
> >>> >>
> >>> >>
> >>>
> org.apache.mina.common.support.AbstractIoFilterChain$HeadFilter.messageReceived
> >>> >> (AbstractIoFilterChain.java:499)
> >>> >>        at
> >>> >>
> >>> >>
> >>>
> org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived
> >>> >> (AbstractIoFilterChain.java:299)
> >>> >>        at
> >>> >>
> >>>
> org.apache.mina.common.support.AbstractIoFilterChain.fireMessageReceived(
> >>> >> AbstractIoFilterChain.java:293)
> >>> >>        at
> >>> >> org.apache.mina.transport.socket.nio.SocketIoProcessor.read(
> >>> >> SocketIoProcessor.java:211)
> >>> >>        at
> >>> >> org.apache.mina.transport.socket.nio.SocketIoProcessor.process(
> >>> >> SocketIoProcessor.java:181)
> >>> >>        at
> >>> >> org.apache.mina.transport.socket.nio.SocketIoProcessor.access$500(
> >>> >> SocketIoProcessor.java:44)
> >>> >>        at
> >>> >> org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(
> >>> >> SocketIoProcessor.java:448)
> >>> >>        at
> >>> >> org.apache.mina.util.NamePreservingRunnable.run(
> >>> >> NamePreservingRunnable.java:39)
> >>> >>        at java.lang.Thread.run(Thread.java:619)
> >>> >> DEBUG [SocketConnectorIoProcessor-1.0] (Deserializer.java:52) -
> >>> Datatype:
> >>> >> Number
> >>> >> ERROR [SocketConnectorIoProcessor-1.0] (RTMPProtocolDecoder.java
> :151)
> >>> -
> >>> >> Error decoding buffer
> >>> >> org.red5.server.net.protocol.ProtocolException: Error during
> decoding
> >>> >>        at
> >>> >> org.red5.server.net.rtmp.codec.RTMPProtocolDecoder.decode(
> >>> >> RTMPProtocolDecoder.java:215)
> >>> >>        at
> >>> >> org.red5.server.net.rtmp.codec.RTMPProtocolDecoder.decodeBuffer(
> >>> >> RTMPProtocolDecoder.java:122)
> >>> >>        at
> >>> >> org.red5.server.net.rtmp.codec.RTMPMinaProtocolDecoder.decode(
> >>> >> RTMPMinaProtocolDecoder.java:60)
> >>> >>        at
> >>> >> org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(
> >>> >> ProtocolCodecFilter.java:156)
> >>> >>        at
> >>> >>
> >>> >>
> >>>
> org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived
> >>> >> (AbstractIoFilterChain.java:299)
> >>> >>        at
> >>> >> org.apache.mina.common.support.AbstractIoFilterChain.access$1100(
> >>> >> AbstractIoFilterChain.java:53)
> >>> >>        at
> >>> >>
> >>> >>
> >>>
> org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived
> >>> >> (AbstractIoFilterChain.java:648)
> >>> >>        at
> >>> >>
> >>> >>
> >>>
> org.apache.mina.common.support.AbstractIoFilterChain$HeadFilter.messageReceived
> >>> >> (AbstractIoFilterChain.java:499)
> >>> >>        at
> >>> >>
> >>> >>
> >>>
> org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived
> >>> >> (AbstractIoFilterChain.java:299)
> >>> >>        at
> >>> >>
> >>>
> org.apache.mina.common.support.AbstractIoFilterChain.fireMessageReceived(
> >>> >> AbstractIoFilterChain.java:293)
> >>> >>        at
> >>> >> org.apache.mina.transport.socket.nio.SocketIoProcessor.read(
> >>> >> SocketIoProcessor.java:211)
> >>> >>        at
> >>> >> org.apache.mina.transport.socket.nio.SocketIoProcessor.process(
> >>> >> SocketIoProcessor.java:181)
> >>> >>        at
> >>> >> org.apache.mina.transport.socket.nio.SocketIoProcessor.access$500(
> >>> >> SocketIoProcessor.java:44)
> >>> >>        at
> >>> >> org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(
> >>> >> SocketIoProcessor.java:448)
> >>> >>        at
> >>> >> org.apache.mina.util.NamePreservingRunnable.run(
> >>> >> NamePreservingRunnable.java:39)
> >>> >>        at java.lang.Thread.run(Thread.java:619)
> >>> >> Caused by: java.nio.BufferUnderflowException
> >>> >>        at java.nio.Buffer.nextGetIndex(Buffer.java:480)
> >>> >>        at java.nio.DirectByteBuffer.getDouble(DirectByteBuffer.java
> >>> :893)
> >>> >>        at
> >>> >> org.apache.mina.common.support.BaseByteBuffer.getDouble(
> >>> >> BaseByteBuffer.java:349)
> >>> >>        at org.red5.io.amf.Input.readNumber(Input.java:187)
> >>> >>        at
> >>> org.red5.io.object.Deserializer.deserialize(Deserializer.java
> >>> >> :65)
> >>> >>        at
> >>> >>
> >>>
> org.red5.server.net.rtmp.codec.RTMPProtocolDecoder.decodeNotifyOrInvoke
> >>> (
> >>> >> RTMPProtocolDecoder.java:790)
> >>> >>        at
> >>> >> org.red5.server.net.rtmp.codec.RTMPProtocolDecoder.decodeInvoke(
> >>> >> RTMPProtocolDecoder.java:715)
> >>> >>        at
> >>> >> org.red5.server.net.rtmp.codec.RTMPProtocolDecoder.decodeMessage(
> >>> >> RTMPProtocolDecoder.java:523)
> >>> >>        at
> >>> >> org.red5.server.net.rtmp.codec.RTMPProtocolDecoder.decodePacket(
> >>> >> RTMPProtocolDecoder.java:419)
> >>> >>        at
> >>> >> org.red5.server.net.rtmp.codec.RTMPProtocolDecoder.decode(
> >>> >> RTMPProtocolDecoder.java:201)
> >>> >>        ... 15 more
> >>> >>  WARN [SocketConnectorIoProcessor-1.0] (RTMPProtocolDecoder.java
> :155)
> >>> -
> >>> >> Closing connection because decoding failed: RTMPMinaConnection from
> >>> >> 127.0.0.1:1935 to null (in: 3317, out: 3257)
> >>> >>
> >>> >> I got a look at the Red5 source code and I saw that Red5 to find
> the
> >>> >> right
> >>> >> function on the client B uses the context class loader of the
> current
> >>> >> thread
> >>> >> (Thread.currentThread().getContextClassLoader().loadClass). The
> >>> problem
> >>> >> is
> >>> >> there because this classload don't know my classes.
> >>> >> The question is. How can I use my classload or How can I add my
> >>> classes
> >>> >> to
> >>> >> Red5 class loader?
> >>> >>
> >>> >> Thanks
> >>> >>
> >>> >>  aGO!
> >>> >> --
> >>> >> View this message in context:
> >>> >> http://www.nabble.com/ClassLoader-Problem-tp15076255p15076255.html
> >>> >> Sent from the Red5 - English mailing list archive at Nabble.com.
> >>> >>
> >>> >>
> >>> >> _______________________________________________
> >>> >> Red5 mailing list
> >>> >> Red5 at osflash.org
> >>> >> http://osflash.org/mailman/listinfo/red5_osflash.org
> >>> >>
> >>> >
> >>> >
> >>> >
> >>> > --
> >>> > It is difficult to free fools from the chains they revere. -
> Voltaire
> >>> >
> >>> > _______________________________________________
> >>> > Red5 mailing list
> >>> > Red5 at osflash.org
> >>> > http://osflash.org/mailman/listinfo/red5_osflash.org
> >>> >
> >>> >
> >>>
> >>> --
> >>> View this message in context:
> >>> http://www.nabble.com/ClassLoader-Problem-tp15076255p15091008.html
> >>> Sent from the Red5 - English mailing list archive at Nabble.com.
> >>>
> >>>
> >>> _______________________________________________
> >>> Red5 mailing list
> >>> Red5 at osflash.org
> >>> http://osflash.org/mailman/listinfo/red5_osflash.org
> >>>
> >>
> >>
> >>
> >> --
> >> It is difficult to free fools from the chains they revere. - Voltaire
> >>
> >> _______________________________________________
> >> Red5 mailing list
> >> Red5 at osflash.org
> >> http://osflash.org/mailman/listinfo/red5_osflash.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/ClassLoader-Problem-tp15076255p15098248.html
> Sent from the Red5 - English mailing list archive at Nabble.com.
>
>
> _______________________________________________
> Red5 mailing list
> Red5 at osflash.org
> http://osflash.org/mailman/listinfo/red5_osflash.org
>



-- 
It is difficult to free fools from the chains they revere. - Voltaire
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/red5_osflash.org/attachments/20080125/14ce0acb/attachment-0001.html 


More information about the Red5 mailing list