Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not Serilizable Exception: RMI transferring video Player class JMF

 
Rodrigo Jimenez
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys, Im getting an exception when i invoke a method to get a Player class with JMF

This is the Remote Method

public class DataRemote extends UnicastRemoteObject
implements IDataRemote {

public Player getPlayer() throws RemoteException {
log.entering("DataImpl", "getVideo");
@SuppressWarnings("unused")
Player result = video.getPlayer();
log.exiting("DataImpl", "getVideo");
return result;
}
}

I get


java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: com.sun.media.content.unknown.Handler
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(Unknown Source)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(Unknown Source)
at $Proxy1.getPlayer(Unknown Source)
at pfc.gui.GuiController.getPlayer(GuiController.java:105)
at pfc.gui.MainWindow$VideoApplication.actionPerformed(MainWindow.java:398)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)


How i can serialize a Pkayer class, whow i can do it ¿?

Thanks, regards Rodrigo
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy, Rodrigo. First, I'd like to give you a warm welcome to our JavaRanch!

Champion, all classes that are going to be transferred over the network have to implement java.io.Serializable. Make sure your Player class implements it and it will be fine!
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anything related to media players is probably tied either to InputStreams or to GUI components, and thus by its very nature not serializable.

What are you actually trying to do?
 
Rodrigo Jimenez
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roberto Perillo wrote:Howdy, Rodrigo. First, I'd like to give you a warm welcome to our JavaRanch!

Champion, all classes that are going to be transferred over the network have to implement java.io.Serializable. Make sure your Player class implements it and it will be fine!


Hello ROberto.

The Player class is an JMF class not mine, and can't implement the serializable class.

There is any way to get a Player class by an RMI remote method.

I cant transfor in bytes and transfer it ¿?
 
Rodrigo Jimenez
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lester Burnham wrote:Anything related to media players is probably tied either to InputStreams or to GUI components, and thus by its very nature not serializable.

What are you actually trying to do?


hello Lester yes i think that is tied either to inputStream

Really in trying to get a Player instance from the server (which reproduce a webcam connected to the server) to the client to reproduce that Player in a Jpanel at the GUI Client.

Any suggestion to do it Lester.

Thanks a lot guys.

Regards, Rodrigo
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rodrigo Jimenez wrote:Really in trying to get a Player instance from the server (which reproduce a webcam connected to the server) to the client to reproduce that Player in a Jpanel at the GUI Client.

Any suggestion to do it Lester.

You can't. You need to construct the player from scratch on the client.
 
Rodrigo Jimenez
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lester Burnham wrote:
Rodrigo Jimenez wrote:Really in trying to get a Player instance from the server (which reproduce a webcam connected to the server) to the client to reproduce that Player in a Jpanel at the GUI Client.

Any suggestion to do it Lester.

You can't. You need to construct the player from scratch on the client.


But this cant be that valid solution, I need to create the player at the server, if a created at the client, it will try to reproduce a client webcam.

We can transfer in an array of bytes ¿?, it will works fine ¿?.

Thanks Lester
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But this cant be that valid solution

Why not?

I need to create the player at the server

Why?

if a created at the client, it will try to reproduce a client webcam.

What does the location where a GUI is created have to do with what the GUI shows? So far you haven't said what you're actually trying to do; do you intend to capture video at the server and display it at the client? If so, you're looking at a streaming solution like RTP. The JMF sample code page has some client code for that; not sure about the server side.

We can transfer in an array of bytes ¿?, it will works fine ¿?

I don't see the connection between transferring a byte array and constructing a GUI.
 
Rodrigo Jimenez
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lester Burnham wrote:
But this cant be that valid solution

Why not? because i need to capture the video at the server

I need to create the player at the server

Why?

if a created at the client, it will try to reproduce a client webcam.

What does the location where a GUI is created have to do with what the GUI shows? So far you haven't said what you're actually trying to do; do you intend to capture video at the server and display it at the client? If so, you're looking at a streaming solution like RTP. The JMF sample code page has some client code for that; not sure about the server side.

Yes i want to capture the video at the server and reproduce it at the client. I try with RTP an it works fine, i dont know that there are an API for this.
We can transfer in an array of bytes ¿?, it will works fine ¿?

I don't see the connection between transferring a byte array and constructing a GUI.


Thanks a lot Lester
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic