You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Rick Curtis (JIRA)" <ji...@apache.org> on 2012/08/02 14:42:02 UTC
[jira] [Created] (OPENJPA-2245) NotSerializableException when using
a remote QueryCache and the Criteria API
Rick Curtis created OPENJPA-2245:
------------------------------------
Summary: NotSerializableException when using a remote QueryCache and the Criteria API
Key: OPENJPA-2245
URL: https://issues.apache.org/jira/browse/OPENJPA-2245
Project: OpenJPA
Issue Type: Bug
Components: criteria, datacache, query
Affects Versions: 2.2.0, 2.3.0
Reporter: Rick Curtis
Assignee: Rick Curtis
Fix For: 2.3.0
When running with a remote QueryCache and using the Criteria API the following exception will occur:
<openjpa-2.3.0-SNAPSHOT-r422266:1367126M nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Failed to execute query "null". Check the query syntax for correctness. See nested exception for details.
at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:872)
at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:794)
at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:542)
at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:286)
at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:302)
at org.apache.openjpa.persistence.criteria.TestRemoteQueryCacheCriteriaQuery.test(TestRemoteQueryCacheCriteriaQuery.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:600)
at junit.framework.TestCase.runTest(TestCase.java:154)
at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runTest(AbstractPersistenceTestCase.java:579)
at junit.framework.TestCase.runBare(TestCase.java:127)
at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runBare(AbstractPersistenceTestCase.java:566)
at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runBare(AbstractPersistenceTestCase.java:542)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.run(AbstractPersistenceTestCase.java:206)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.RuntimeException: java.io.NotSerializableException: org.apache.openjpa.persistence.criteria.CriteriaQueryImpl
at org.apache.openjpa.persistence.criteria.SerializingConcurrentQueryCache.roundtrip(SerializingConcurrentQueryCache.java:57)
at org.apache.openjpa.persistence.criteria.SerializingConcurrentQueryCache.get(SerializingConcurrentQueryCache.java:36)
at org.apache.openjpa.datacache.QueryCacheStoreQuery.checkCache(QueryCacheStoreQuery.java:125)
at org.apache.openjpa.datacache.QueryCacheStoreQuery.access$000(QueryCacheStoreQuery.java:63)
at org.apache.openjpa.datacache.QueryCacheStoreQuery$QueryCacheExecutor.executeQuery(QueryCacheStoreQuery.java:342)
at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:1005)
at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:863)
... 27 more
Caused by: java.io.NotSerializableException: org.apache.openjpa.persistence.criteria.CriteriaQueryImpl
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1173)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:336)
at org.apache.openjpa.datacache.QueryKey.writeExternal(QueryKey.java:451)
at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1438)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1407)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1167)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:336)
at org.apache.openjpa.persistence.criteria.SerializingConcurrentQueryCache.roundtrip(SerializingConcurrentQueryCache.java:52)
... 33 more
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (OPENJPA-2245) NotSerializableException when
using a remote QueryCache and the Criteria API
Posted by "Rick Curtis (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-2245?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rick Curtis resolved OPENJPA-2245.
----------------------------------
Resolution: Fixed
Committed revision 1368438 to trunk.
> NotSerializableException when using a remote QueryCache and the Criteria API
> ----------------------------------------------------------------------------
>
> Key: OPENJPA-2245
> URL: https://issues.apache.org/jira/browse/OPENJPA-2245
> Project: OpenJPA
> Issue Type: Bug
> Components: criteria, datacache, query
> Affects Versions: 2.2.0, 2.3.0
> Reporter: Rick Curtis
> Assignee: Rick Curtis
> Fix For: 2.3.0
>
>
> When running with a remote QueryCache and using the Criteria API the following exception will occur:
> <openjpa-2.3.0-SNAPSHOT-r422266:1367126M nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Failed to execute query "null". Check the query syntax for correctness. See nested exception for details.
> at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:872)
> at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:794)
> at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:542)
> at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:286)
> at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:302)
> at org.apache.openjpa.persistence.criteria.TestRemoteQueryCacheCriteriaQuery.test(TestRemoteQueryCacheCriteriaQuery.java:42)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:600)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runTest(AbstractPersistenceTestCase.java:579)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runBare(AbstractPersistenceTestCase.java:566)
> at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runBare(AbstractPersistenceTestCase.java:542)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.run(AbstractPersistenceTestCase.java:206)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Caused by: java.lang.RuntimeException: java.io.NotSerializableException: org.apache.openjpa.persistence.criteria.CriteriaQueryImpl
> at org.apache.openjpa.persistence.criteria.SerializingConcurrentQueryCache.roundtrip(SerializingConcurrentQueryCache.java:57)
> at org.apache.openjpa.persistence.criteria.SerializingConcurrentQueryCache.get(SerializingConcurrentQueryCache.java:36)
> at org.apache.openjpa.datacache.QueryCacheStoreQuery.checkCache(QueryCacheStoreQuery.java:125)
> at org.apache.openjpa.datacache.QueryCacheStoreQuery.access$000(QueryCacheStoreQuery.java:63)
> at org.apache.openjpa.datacache.QueryCacheStoreQuery$QueryCacheExecutor.executeQuery(QueryCacheStoreQuery.java:342)
> at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:1005)
> at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:863)
> ... 27 more
> Caused by: java.io.NotSerializableException: org.apache.openjpa.persistence.criteria.CriteriaQueryImpl
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1173)
> at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:336)
> at org.apache.openjpa.datacache.QueryKey.writeExternal(QueryKey.java:451)
> at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1438)
> at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1407)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1167)
> at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:336)
> at org.apache.openjpa.persistence.criteria.SerializingConcurrentQueryCache.roundtrip(SerializingConcurrentQueryCache.java:52)
> ... 33 more
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (OPENJPA-2245) NotSerializableException when
using a remote QueryCache and the Criteria API
Posted by "Rick Curtis (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-2245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13427279#comment-13427279 ]
Rick Curtis commented on OPENJPA-2245:
--------------------------------------
Rather than making CriteriaQueryImpl and all objects it references serializable, it is much simpler to hold onto the stringified version(SQL) of the CriteriaQuery in the QueryKey.
> NotSerializableException when using a remote QueryCache and the Criteria API
> ----------------------------------------------------------------------------
>
> Key: OPENJPA-2245
> URL: https://issues.apache.org/jira/browse/OPENJPA-2245
> Project: OpenJPA
> Issue Type: Bug
> Components: criteria, datacache, query
> Affects Versions: 2.2.0, 2.3.0
> Reporter: Rick Curtis
> Assignee: Rick Curtis
> Fix For: 2.3.0
>
>
> When running with a remote QueryCache and using the Criteria API the following exception will occur:
> <openjpa-2.3.0-SNAPSHOT-r422266:1367126M nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Failed to execute query "null". Check the query syntax for correctness. See nested exception for details.
> at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:872)
> at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:794)
> at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:542)
> at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:286)
> at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:302)
> at org.apache.openjpa.persistence.criteria.TestRemoteQueryCacheCriteriaQuery.test(TestRemoteQueryCacheCriteriaQuery.java:42)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:600)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runTest(AbstractPersistenceTestCase.java:579)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runBare(AbstractPersistenceTestCase.java:566)
> at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runBare(AbstractPersistenceTestCase.java:542)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.run(AbstractPersistenceTestCase.java:206)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Caused by: java.lang.RuntimeException: java.io.NotSerializableException: org.apache.openjpa.persistence.criteria.CriteriaQueryImpl
> at org.apache.openjpa.persistence.criteria.SerializingConcurrentQueryCache.roundtrip(SerializingConcurrentQueryCache.java:57)
> at org.apache.openjpa.persistence.criteria.SerializingConcurrentQueryCache.get(SerializingConcurrentQueryCache.java:36)
> at org.apache.openjpa.datacache.QueryCacheStoreQuery.checkCache(QueryCacheStoreQuery.java:125)
> at org.apache.openjpa.datacache.QueryCacheStoreQuery.access$000(QueryCacheStoreQuery.java:63)
> at org.apache.openjpa.datacache.QueryCacheStoreQuery$QueryCacheExecutor.executeQuery(QueryCacheStoreQuery.java:342)
> at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:1005)
> at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:863)
> ... 27 more
> Caused by: java.io.NotSerializableException: org.apache.openjpa.persistence.criteria.CriteriaQueryImpl
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1173)
> at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:336)
> at org.apache.openjpa.datacache.QueryKey.writeExternal(QueryKey.java:451)
> at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1438)
> at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1407)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1167)
> at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:336)
> at org.apache.openjpa.persistence.criteria.SerializingConcurrentQueryCache.roundtrip(SerializingConcurrentQueryCache.java:52)
> ... 33 more
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira