You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by David Jencks <da...@yahoo.com> on 2006/10/25 02:43:07 UTC
Sequence configuration problems
Working on the geronimo jpa support, I'm starting openjpa using
entityManagerFactory =
persistenceProvider.createContainerEntityManagerFactory
(persistenceUnitInfo, properties);
and trying to configure the default sequence using a property in the
persistenceUnitInfo corresponding to
<property name="openjpa.Sequence" value="table(Table=OPENJPASEQ,
Increment=100)"/>
I get an exception:
Caused by: java.lang.IllegalArgumentException:
java.lang.ClassNotFoundException: table in classloader
org.apache.geronimo.configs/openjpa/1.2-SNAPSHOT/car
at serp.util.Strings.toClass(Strings.java:211)
at serp.util.Strings.toClass(Strings.java:140)
at org.apache.openjpa.lib.conf.Configurations.newInstance
(Configurations.java:139)
... 63 more
at
org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll
(ConfigurationImpl.java:278)
at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll
(OpenJPAConfigurationImpl.java:1405)
at org.apache.openjpa.persistence.PersistenceProviderImpl
$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:134)
at org.apache.openjpa.persistence.PersistenceProviderImpl
$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:110)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEn
tityManagerFactory(PersistenceProviderImpl.java:96)
at
org.apache.geronimo.persistence.PersistenceUnitGBean.<init>
(PersistenceUnitGBean.java:92)
If I change to
<property name="openjpa.Sequence"
value="org.apache.openjpa.jdbc.kernel.TableJDBCSeq(Table=OPENJPASEQ,
Increment=100)"/>
I get a different exception:
java.lang.RuntimeException: There were errors initializing your
configuration: java.lang.ClassCastException:
org.apache.openjpa.conf.OpenJPAConfigurationImpl
at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.setConfiguration
(TableJDBCSeq.java:181)
at
org.apache.openjpa.lib.conf.Configurations.configureInstance
(Configurations.java:327)
at
org.apache.openjpa.lib.conf.Configurations.configureInstance
(Configurations.java:284)
at org.apache.openjpa.lib.conf.PluginValue.instantiate
(PluginValue.java:99)
at org.apache.openjpa.lib.conf.ObjectValue.instantiate
(ObjectValue.java:70)
at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.getSequenceInstance
(OpenJPAConfigurationImpl.java:1310)
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
org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll
(ConfigurationImpl.java:264)
at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll
(OpenJPAConfigurationImpl.java:1405)
at org.apache.openjpa.persistence.PersistenceProviderImpl
$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:134)
at org.apache.openjpa.persistence.PersistenceProviderImpl
$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:110)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEn
tityManagerFactory(PersistenceProviderImpl.java:96)
at
org.apache.geronimo.persistence.PersistenceUnitGBean.<init>
(PersistenceUnitGBean.java:92)
(TableJDBCSeq expects the configuration instance to be a
JDBCConfigurationImpl and apparently it isn't)
Is this as it should be? Is there some additional processing going
on when openjpa reads a persistence.xml file that should not happen
when an entityManagerFactory is created in a j2ee environment?
thanks
david jencks
Re: Sequence configuration problems
Posted by Marc Prud'hommeaux <mp...@apache.org>.
David-
Also, you might want to try with the most recent snapshot name
("0.9.6-incubating-SNAPSHOT" instead of "0.9.0-incubating-SNAPSHOT").
On Oct 25, 2006, at 9:50 AM, Abe White wrote:
> You're definitely missing the JDBC bits of OpenJPA, or at least the
> JDBCProductDerivation isn't being found. If you get the latest
> version, you can invoke the
> org.apache.openjpa.conf.ProductDerivations class's main method to
> print details about derivation loading to System.out. You might
> also want to modify that class to have a static API to return the
> same errors that you can call within a container.
> ______________________________________________________________________
> _
> Notice: This email message, together with any attachments, may
> contain
> information of BEA Systems, Inc., its subsidiaries and
> affiliated
> entities, that may be confidential, proprietary, copyrighted
> and/or
> legally privileged, and is intended solely for the use of the
> individual
> or entity named in this message. If you are not the intended
> recipient,
> and have received this message in error, please immediately return
> this
> by email and then delete it.
Re: Sequence configuration problems
Posted by Abe White <aw...@bea.com>.
> I investigated a bit further and found that if I change
> PersistenceProviderImpl.ClassTransformerImpl to use a
> JDBCConfigurationImpl instead of OpenJPAConfigurationImpl then the
> problem goes away. I'm reasonably certain that there is no need to
> use a JDBCConfigurationImpl here in the class transformer, the
> enhancing shouldn't need to know what the persistence mechanism
> is. Is it possible that the OpenJPAConfigurationImpl can ignore
> the properties it doesn't understand rather than objecting to them?
>
> I've opened https://issues.apache.org/jira/browse/OPENJPA-73 to
> track this problem, that has a little more detail. Given some
> hints I can work towards a solution but I'm not sure where the best
> place to start is.
>
> I'd really like to get this fixed ASAP in openjpa, we are hoping to
> include a jpa/openjpa preview in the next geronimo release, and
> this is the only significant problem I've encountered so far. I've
> successfully converted the Daytrader performance test app to
> container managed jpa and it seems to work fine with openjpa. Next
> step there is to get some performance numbers :-)
I believe everything will work if you just remove the call to
conf.instantiateAll() in the ClassTransformerImpl's constructor.
It's not needed since the enhancement process doesn't require any
instantiated plugins beyond the MetaDataRepository, which is already
instantiated in the constructor. (And I'm not even sure whether the
ClassTransformer has to be threadsafe anyway -- the only reason we
usually use instantiateAll() is to do up-front instantiation of
singleton plugins to avoid locking and avoid lazy-instantiation
threading issues.)
Re: Sequence configuration problems
Posted by David Jencks <da...@yahoo.com>.
On Oct 25, 2006, at 9:50 AM, Abe White wrote:
> You're definitely missing the JDBC bits of OpenJPA, or at least the
> JDBCProductDerivation isn't being found. If you get the latest
> version, you can invoke the
> org.apache.openjpa.conf.ProductDerivations class's main method to
> print details about derivation loading to System.out. You might
> also want to modify that class to have a static API to return the
> same errors that you can call within a container.
I investigated a bit further and found that if I change
PersistenceProviderImpl.ClassTransformerImpl to use a
JDBCConfigurationImpl instead of OpenJPAConfigurationImpl then the
problem goes away. I'm reasonably certain that there is no need to
use a JDBCConfigurationImpl here in the class transformer, the
enhancing shouldn't need to know what the persistence mechanism is.
Is it possible that the OpenJPAConfigurationImpl can ignore the
properties it doesn't understand rather than objecting to them?
I've opened https://issues.apache.org/jira/browse/OPENJPA-73 to track
this problem, that has a little more detail. Given some hints I can
work towards a solution but I'm not sure where the best place to
start is.
I'd really like to get this fixed ASAP in openjpa, we are hoping to
include a jpa/openjpa preview in the next geronimo release, and this
is the only significant problem I've encountered so far. I've
successfully converted the Daytrader performance test app to
container managed jpa and it seems to work fine with openjpa. Next
step there is to get some performance numbers :-)
Many thanks,
david jencks
> ______________________________________________________________________
> _
> Notice: This email message, together with any attachments, may
> contain
> information of BEA Systems, Inc., its subsidiaries and
> affiliated
> entities, that may be confidential, proprietary, copyrighted
> and/or
> legally privileged, and is intended solely for the use of the
> individual
> or entity named in this message. If you are not the intended
> recipient,
> and have received this message in error, please immediately return
> this
> by email and then delete it.
Re: Sequence configuration problems
Posted by Abe White <aw...@bea.com>.
You're definitely missing the JDBC bits of OpenJPA, or at least the
JDBCProductDerivation isn't being found. If you get the latest
version, you can invoke the
org.apache.openjpa.conf.ProductDerivations class's main method to
print details about derivation loading to System.out. You might also
want to modify that class to have a static API to return the same
errors that you can call within a container.
_______________________________________________________________________
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.
Re: Sequence configuration problems
Posted by David Jencks <da...@yahoo.com>.
On Oct 24, 2006, at 5:50 PM, Patrick Linskey wrote:
>> Is this as it should be? Is there some additional processing going
>> on when openjpa reads a persistence.xml file that should not happen
>> when an entityManagerFactory is created in a j2ee environment?
>
> Does this work when you run outside a container?
I haven't tried and I'm not entirely sure what the equivalent
environment would be. The class I'm using is the AllFieldTypes
stolen from OpenJPA
>
> It sounds like the product derivations aren't loading properly. Are
> you
> using separate OpenJPA jars, or the single OpenJPA jar?
The non-geronimo stuff in the classloader with openjpa jars is:
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-all</artifactId>
<version>0.9.0-incubating-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.sourceforge.serp</groupId>
<artifactId>serp</artifactId>
<version>1.11.0</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
> Did you create a
> single OpenJPA jar from the modules on your own? Could your security
> policy be preventing OpenJPA from accessing resources?
No security policy.
Any idea where I could look for a clue about what's going on?
thanks
david jencks
>
> -Patrick
> ______________________________________________________________________
> _
> Notice: This email message, together with any attachments, may
> contain
> information of BEA Systems, Inc., its subsidiaries and
> affiliated
> entities, that may be confidential, proprietary, copyrighted
> and/or
> legally privileged, and is intended solely for the use of the
> individual
> or entity named in this message. If you are not the intended
> recipient,
> and have received this message in error, please immediately return
> this
> by email and then delete it.
RE: Sequence configuration problems
Posted by Patrick Linskey <pl...@bea.com>.
> Is this as it should be? Is there some additional processing going
> on when openjpa reads a persistence.xml file that should not happen
> when an entityManagerFactory is created in a j2ee environment?
Does this work when you run outside a container?
It sounds like the product derivations aren't loading properly. Are you
using separate OpenJPA jars, or the single OpenJPA jar? Did you create a
single OpenJPA jar from the modules on your own? Could your security
policy be preventing OpenJPA from accessing resources?
-Patrick
_______________________________________________________________________
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.