On my client I recieve this error when a message it recieved and I try to deserialize it, more specifically calling this line:
This happens when I send an object that has been retrived from the object store using:
Galaxy gal =datamanger.getBinding("smalltestgalaxy", Galaxy.class) ;
byte[] gbyte = gal.serializeIntobyteArray();
session.send(gbyte);
But when I do this:
Galaxy gal2 = new Galaxy("new gal");
byte[] gbyte = gal2.serializeIntobyteArray();
session.send(gbyte);
Then IT WORKS!!
So an object that has been through the object store cannot be send to the client??
Stacktrace
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| login ok Recieved message 647 java.io.InvalidObjectException: No transaction is active at com.sun.sgs.impl.service.data.ManagedReferenceImpl.readResolve(ManagedReferenceImpl.java:394) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at java.io.ObjectStreamClass.invokeReadResolve(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readObject(Unknown Source) at java.util.ArrayList.readObject(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at java.io.ObjectStreamClass.invokeReadObject(Unknown Source) at java.io.ObjectInputStream.readSerialData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.defaultReadFields(Unknown Source) at java.io.ObjectInputStream.readSerialData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.defaultReadFields(Unknown Source) at java.io.ObjectInputStream.readSerialData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readObject(Unknown Source) at extorris.net.nw.ExtorrisMessage.deSerializeIntoMessage(ExtorrisMessage.java:74) at extorris.net.client.junit.nw.player.client.LoginCreateplayer.receivedMessage(LoginCreateplayer.java:160) at com.sun.sgs.client.simple.SimpleClient$SimpleClientConnectionListener.handleApplicationMessage(SimpleClient.java:389) at com.sun.sgs.client.simple.SimpleClient$SimpleClientConnectionListener.receivedMessage(SimpleClient.java:343) at com.sun.sgs.impl.client.simple.SimpleClientConnection.bytesReceived(SimpleClientConnection.java:131) at com.sun.sgs.impl.io.SocketConnection.filteredMessageReceived(SocketConnection.java:108) at com.sun.sgs.impl.io.CompleteMessageFilter.processReceiveBuffer(CompleteMessageFilter.java:108) at com.sun.sgs.impl.io.CompleteMessageFilter.filterReceive(CompleteMessageFilter.java:75) at com.sun.sgs.impl.io.SocketConnectionListener.messageReceived(SocketConnectionListener.java:100) at org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(Unknown Source) at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(Unknown Source) at org.apache.mina.common.support.AbstractIoFilterChain.access$5(Unknown Source) at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(Unknown Source) at org.apache.mina.filter.executor.ExecutorFilter.processEvent(Unknown Source) at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: com.sun.sgs.app.TransactionNotActiveException: No transaction is active at com.sun.sgs.impl.service.data.DataServiceImpl.getContextNoJoin(DataServiceImpl.java:783) at com.sun.sgs.impl.service.data.ManagedReferenceImpl.readResolve(ManagedReferenceImpl.java:383) ... 44 more |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| public static ExtorrisMessage deSerializeIntoMessage(byte[] message){ ObjectInputStream in; try { in = new ObjectInputStream(new ByteArrayInputStream(message)); ExtorrisMessage mobj = (ExtorrisMessage) in.readObject(); return mobj; } catch (IOException e) { e.printStackTrace(); }catch (ClassNotFoundException e) { e.printStackTrace(); } return null; } |