Unmarshalling with Toplink + Eclipse + MySQL

V

Volker Mueller

Hi there,

I don't know, if I'm right here in this group - if not please tell me
the better choice. The group c.l.j.beans seams to be dead.

I'm just trying out OC4J-Standallone-10.1.3n in an environment as
described in the subject.

In principle the environment "works" - that means I have a working
Datasource (proven by writing an entity - the same one that I now try to
read back - into the DB).

But: When I try to read the entity back:

<code>
@Stateless
public class BookmarkBean implements BookmarkBeanRemote, BookmarkBeanLocal {

[...]
@PersistenceContext EntityManager em;

public void getOneUnitEntry() {
Unit u = null;

Query q = em.createQuery("UNIT u from UNIT as u");
// List<?> resultList = q.getResultList();
// for (Object e : resultList) {
// if (e instanceof Unit) {
// u = (Unit) e;
// }
// }

//return u;
}
[...]
</code>

I get the Exception that I pasted at the end of this message (on client
side - the server side exception is quite short and doesn't explain
anything for me).

Does anybody know what to do to get it working?

TIA, Bye, Volker

This is the exception I get (no matter what I write as Query String).

java.rmi.UnmarshalException: Error deserializing exception-value:
writing aborted; java.io.NotSerializableException:
persistence.antlr.CommonToken; nested exception is:
java.io.WriteAbortedException: writing aborted;
java.io.NotSerializableException: persistence.antlr.CommonToken
at
com.evermind.server.rmi.RMIClientConnection.handleMethodInvocationResponse(RMIClientConnection.java:920)
at
com.evermind.server.rmi.RMIClientConnection.handleOrmiCommandResponse(RMIClientConnection.java:341)
at
com.evermind.server.rmi.RMIClientConnection.dispatchResponse(RMIClientConnection.java:296)
at
com.evermind.server.rmi.RMIClientConnection.processReceivedCommand(RMIClientConnection.java:278)
at
com.evermind.server.rmi.RMIConnection.handleCommand(RMIConnection.java:152)
at
com.evermind.server.rmi.RMIConnection.listenForOrmiCommands(RMIConnection.java:127)
at com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:107)
at
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:825)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.io.WriteAbortedException: writing aborted;
java.io.NotSerializableException: persistence.antlr.CommonToken
at java.io_ObjectInputStream.readObject0(ObjectInputStream.java:1309)
at java.io_ObjectInputStream.defaultReadFields(ObjectInputStream.java:1910)
at java.io_ObjectInputStream.readSerialData(ObjectInputStream.java:1834)
at
java.io_ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io_ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io_ObjectInputStream.defaultReadFields(ObjectInputStream.java:1910)
at java.io_ObjectInputStream.readSerialData(ObjectInputStream.java:1834)
at
java.io_ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io_ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io_ObjectInputStream.defaultReadFields(ObjectInputStream.java:1910)
at java.io_ObjectInputStream.readSerialData(ObjectInputStream.java:1834)
at
java.io_ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io_ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io_ObjectInputStream.defaultReadFields(ObjectInputStream.java:1910)
at java.io_ObjectInputStream.readSerialData(ObjectInputStream.java:1834)
at
java.io_ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io_ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io_ObjectInputStream.defaultReadFields(ObjectInputStream.java:1910)
at java.io_ObjectInputStream.readSerialData(ObjectInputStream.java:1834)
at
java.io_ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io_ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io_ObjectInputStream.readObject(ObjectInputStream.java:348)
at
com.evermind.server.rmi.RMIClientConnection.handleMethodInvocationResponse(RMIClientConnection.java:910)
... 8 more
Caused by: java.io.NotSerializableException: persistence.antlr.CommonToken
at java.io_ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
at
java.io_ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io_ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at
java.io_ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io_ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at
java.io_ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at
java.io_ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:391)
at java.lang.Throwable.writeObject(Throwable.java:649)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at java.io_ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:917)
at java.io_ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1339)
at
java.io_ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io_ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at
java.io_ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at
java.io_ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:391)
at java.lang.Throwable.writeObject(Throwable.java:649)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at java.io_ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:917)
at java.io_ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1339)
at
java.io_ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io_ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at
java.io_ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io_ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at
java.io_ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io_ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at
java.io_ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at
java.io_ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:391)
at java.lang.Throwable.writeObject(Throwable.java:649)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at java.io_ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:917)
at java.io_ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1339)
at
java.io_ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io_ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io_ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
at
com.evermind.server.rmi.RMIOutputStream.writeException(RMIOutputStream.java:31)
at
com.evermind.server.rmi.ServerRmiMessageHandler.writeExceptionResponse(ServerRmiMessageHandler.java:671)
at
com.evermind.server.rmi.ServerRmiMessageHandler.returnException(ServerRmiMessageHandler.java:625)
at com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:58)
at
com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
... 1 more
Exception in thread "main"
com.evermind.reflect.UndeclaredExceptionTypeException:
oracle.oc4j.rmi.OracleRemoteException
at __Proxy1.getOneUnitEntry(Unknown Source)
at de.flinux.empolis.bookmark.BookmarkClient.main(BookmarkClient.java:21)
oracle.oc4j.rmi.OracleRemoteException: Invocation error:
java.rmi.UnmarshalException: Error deserializing exception-value:
writing aborted; java.io.NotSerializableException:
persistence.antlr.CommonToken; nested exception is:
java.io.WriteAbortedException: writing aborted;
java.io.NotSerializableException: persistence.antlr.CommonToken
at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:143)
at
com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:571)
at
com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:515)
at
com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
at
com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
at
com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
at __Proxy1.getOneUnitEntry(Unknown Source)
at de.flinux.empolis.bookmark.BookmarkClient.main(BookmarkClient.java:21)

Nested exception is:
java.rmi.UnmarshalException: Error deserializing exception-value:
writing aborted; java.io.NotSerializableException:
persistence.antlr.CommonToken; nested exception is:
java.io.WriteAbortedException: writing aborted;
java.io.NotSerializableException: persistence.antlr.CommonToken
at
com.evermind.server.rmi.RMIClientConnection.handleMethodInvocationResponse(RMIClientConnection.java:920)
at
com.evermind.server.rmi.RMIClientConnection.handleOrmiCommandResponse(RMIClientConnection.java:341)
at
com.evermind.server.rmi.RMIClientConnection.dispatchResponse(RMIClientConnection.java:296)
at
com.evermind.server.rmi.RMIClientConnection.processReceivedCommand(RMIClientConnection.java:278)
at
com.evermind.server.rmi.RMIConnection.handleCommand(RMIConnection.java:152)
at
com.evermind.server.rmi.RMIConnection.listenForOrmiCommands(RMIConnection.java:127)
at com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:107)
at
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:825)
at java.lang.Thread.run(Thread.java:595)
at
com.evermind.server.rmi.RMICall.warningExceptionOriginatesFromTheRemoteServer(RMICall.java:109)
at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:129)
at
com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:571)
at
com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:515)
at
com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
at
com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
at
com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
at __Proxy1.getOneUnitEntry(Unknown Source)
at de.flinux.empolis.bookmark.BookmarkClient.main(BookmarkClient.java:21)
Caused by: java.io.WriteAbortedException: writing aborted;
java.io.NotSerializableException: persistence.antlr.CommonToken
at java.io_ObjectInputStream.readObject0(ObjectInputStream.java:1309)
at java.io_ObjectInputStream.defaultReadFields(ObjectInputStream.java:1910)
at java.io_ObjectInputStream.readSerialData(ObjectInputStream.java:1834)
at
java.io_ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io_ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io_ObjectInputStream.defaultReadFields(ObjectInputStream.java:1910)
at java.io_ObjectInputStream.readSerialData(ObjectInputStream.java:1834)
at
java.io_ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io_ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io_ObjectInputStream.defaultReadFields(ObjectInputStream.java:1910)
at java.io_ObjectInputStream.readSerialData(ObjectInputStream.java:1834)
at
java.io_ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io_ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io_ObjectInputStream.defaultReadFields(ObjectInputStream.java:1910)
at java.io_ObjectInputStream.readSerialData(ObjectInputStream.java:1834)
at
java.io_ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io_ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io_ObjectInputStream.defaultReadFields(ObjectInputStream.java:1910)
at java.io_ObjectInputStream.readSerialData(ObjectInputStream.java:1834)
at
java.io_ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io_ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io_ObjectInputStream.readObject(ObjectInputStream.java:348)
at
com.evermind.server.rmi.RMIClientConnection.handleMethodInvocationResponse(RMIClientConnection.java:910)
at
com.evermind.server.rmi.RMIClientConnection.handleOrmiCommandResponse(RMIClientConnection.java:341)
at
com.evermind.server.rmi.RMIClientConnection.dispatchResponse(RMIClientConnection.java:296)
at
com.evermind.server.rmi.RMIClientConnection.processReceivedCommand(RMIClientConnection.java:278)
at
com.evermind.server.rmi.RMIConnection.handleCommand(RMIConnection.java:152)
at
com.evermind.server.rmi.RMIConnection.listenForOrmiCommands(RMIConnection.java:127)
at com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:107)
at
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:825)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.io.NotSerializableException: persistence.antlr.CommonToken
at java.io_ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
at
java.io_ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io_ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at
java.io_ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io_ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at
java.io_ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at
java.io_ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:391)
at java.lang.Throwable.writeObject(Throwable.java:649)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at java.io_ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:917)
at java.io_ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1339)
at
java.io_ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io_ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at
java.io_ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at
java.io_ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:391)
at java.lang.Throwable.writeObject(Throwable.java:649)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at java.io_ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:917)
at java.io_ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1339)
at
java.io_ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io_ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at
java.io_ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io_ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at
java.io_ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io_ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at
java.io_ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at
java.io_ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:391)
at java.lang.Throwable.writeObject(Throwable.java:649)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at java.io_ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:917)
at java.io_ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1339)
at
java.io_ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io_ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io_ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
at
com.evermind.server.rmi.RMIOutputStream.writeException(RMIOutputStream.java:31)
at
com.evermind.server.rmi.ServerRmiMessageHandler.writeExceptionResponse(ServerRmiMessageHandler.java:671)
at
com.evermind.server.rmi.ServerRmiMessageHandler.returnException(ServerRmiMessageHandler.java:625)
at com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:58)
at
com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
... 1 more
 
V

Volker Mueller

Volker Mueller schrieb:
[... snipped ...]

extension:

u = em.find(Unit.class, "la-le-lu");

works and has the expected result (the Unit with PK "la-le-lu"). So the
problem really seems to be in em.createQuery().

Any help?

TIA! Volker
 
A

Arved Sandstrom

Volker said:
Hi there,

I don't know, if I'm right here in this group - if not please tell me
the better choice. The group c.l.j.beans seams to be dead.

I'm just trying out OC4J-Standallone-10.1.3n in an environment as
described in the subject.

In principle the environment "works" - that means I have a working
Datasource (proven by writing an entity - the same one that I now try to
read back - into the DB).

But: When I try to read the entity back:

<code>
@Stateless
public class BookmarkBean implements BookmarkBeanRemote, BookmarkBeanLocal {

[...]
@PersistenceContext EntityManager em;

public void getOneUnitEntry() {
Unit u = null;

Query q = em.createQuery("UNIT u from UNIT as u");
// List<?> resultList = q.getResultList();
// for (Object e : resultList) {
// if (e instanceof Unit) {
// u = (Unit) e;
// }
// }

//return u;
}
[...]
</code>

I get the Exception that I pasted at the end of this message (on client
side - the server side exception is quite short and doesn't explain
anything for me).

Does anybody know what to do to get it working?

TIA, Bye, Volker

This is the exception I get (no matter what I write as Query String).

java.rmi.UnmarshalException: Error deserializing exception-value:
writing aborted; java.io.NotSerializableException:
persistence.antlr.CommonToken; nested exception is:
[ SNIP ]

Hi, Volker

I could be wrong, but it seems to me that it would indeed matter what
you write as the query string, since if there were no problem with the
query you'd have no exception. The stack trace is indicating that
persistence.antlr.CommonToken is not Serializable - it's not - and the
only reason that token is there is because it's included in exception
information being returned from the invocation of that SLSB method.

Did you try a query string like

"select u from Unit u"?

Arved
 
V

Volker Mueller

Volker said:
Volker Mueller schrieb:
[... snipped ...]
[... snipped again ...]

as so often the mistake sits between monitor and chair.

It was a matter of CASE - the query requires to be written as
Query q =
em.createQuery("select u from Unit as u"); // not "unit" or "UNIT"

.... i just ask myself if I should have had been able to read this from
the exceptions stacktrace ... :-(

Thanks for all who read my posting(s) and thought about solutions.

Bye, Volker
 
V

Volker Mueller

Arved Sandstrom schrieb:
[...]
Did you try a query string like

"select u from Unit u"?

Yes, and - as described in my post from 12:22 - it solved my problem.

I was just not able to interpret the stacktrace. It seems that I need
more background knowledge ...

Thanks and bye, Volker
 
L

Lew

Arved Sandstrom schrieb:
[...]
Did you try a query string like
"select u from Unit u"?

Yes, and - as described in my post from 12:22 - it solved my problem.

I was just not able to interpret the stacktrace. It seems that I need
more background knowledge ...

Thanks and bye, Volker

As you discovered, "UNIT u from UNIT as u" is not valid JQL syntax.
You can bone up on your JQL here:
<http://java.sun.com/javaee/5/docs/tutorial/doc/bnbtg.html>
 
V

Volker Mueller

Lew said:
Arved Sandstrom schrieb:
[...]
Did you try a query string like
"select u from Unit u"?
Yes, and - as described in my post from 12:22 - it solved my problem.

I was just not able to interpret the stacktrace. It seems that I need
more background knowledge ...

Thanks and bye, Volker

As you discovered, "UNIT u from UNIT as u" is not valid JQL syntax.
You can bone up on your JQL here:
<http://java.sun.com/javaee/5/docs/tutorial/doc/bnbtg.html>

Yes - thank you.

Volker
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top