[
https://issues.apache.org/jira/browse/OPENJPA-1642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12862821#action_12862821
]
Michael Dick commented on OPENJPA-1642:
---------------------------------------
Pinaki's suggestion to enhance at build time
(http://openjpa.208410.n2.nabble.com/DataSource-initialization-error-tt4958860.html#a4980529)
should work around the problem. It's not very obvious why that's required.
The problem is that the PCAgentEnhancer (javaagent) is creates and initializes
a new instance of OpenJPAConfigurationImpl, but the Sequence plugin you're
using requires a JDBCConfigurationImpl. It's the initialization that causes the
problem - we're initializing a plugin that requires more information than we
have (e.g. JDBC knowledge).
Fixing it might be interesting - I'd be tempted to lazily initialize instead of
eagerly creating all the plugins. This might break other things though - the
code indicates that there once was a threading issue. Failing that we'd have to
make OpenJPAConfigurationImpl more fault tolerant which could get a bit thorny
too.
At any rate, please do try enhancing at build time. A good reference can be
found here :
http://webspherepersistence.blogspot.com/2009/02/openjpa-enhancement.html
> ClassCastException caused when using property 'openjpa.Sequence'
> ----------------------------------------------------------------
>
> Key: OPENJPA-1642
> URL: https://issues.apache.org/jira/browse/OPENJPA-1642
> Project: OpenJPA
> Issue Type: Bug
> Affects Versions: 1.0.3, 1.2.2, 2.0.0
> Reporter: Heath Thomann
> Assignee: Heath Thomann
>
> When setting the following property:
> <property name="openjpa.Sequence"
> value="org.apache.openjpa.jdbc.kernel.ClassTableJDBCSeq()"/>
> the following exception is caused:
> java.lang.ClassCastException:
> org.apache.openjpa.conf.OpenJPAConfigurationImpl cannot be cast to
> org.apache.openjpa.jdbc.conf.JDBCConfiguration
> The same exception is caused when using other sequence generators, for
> example 'org.apache.openjpa.jdbc.kernel.TableJDBCSeq'.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.