You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Krzysztof <ya...@gmail.com> on 2011/03/01 17:34:25 UTC

2.1.0 from maven repository woes

Hello,
We experience quite cryptic exception about the "Sequence" option while
using maven fetched jars from time to time. 2.1.0 jars broke code that
worked with 2.0.1. 
Layout of both seems the same at first glance, I cannot see any missing
packages in new jars.

Actually, it does not look like being dependent on the code at all as it
seems purely openjpa configuration problem. 

For example: code, persistence.xml that worked with 2.0.1 ivy dependencies
like:
<ivy.xml>
...

		<dependency org="org.apache.openjpa" name="openjpa-jdbc"
			rev="2.0.1" />
		<dependency org="org.apache.openjpa" name="openjpa-kernel"
			rev="2.0.1" />
		<dependency org="org.apache.openjpa" name="openjpa-lib"
			rev="2.0.1" />
		<dependency org="org.apache.openjpa" name="openjpa-persistence"
			rev="2.0.1" />
		<dependency org="org.apache.openjpa" name="openjpa-persistence-jdbc"
			rev="2.0.1" />
		<dependency org="org.apache.openjpa" name="openjpa-slice"
			rev="2.0.1" />
		<dependency org="org.apache.openjpa" name="openjpa-xmlstore"
			rev="2.0.1" />
...
</ivy.xml>

 - causes error when version is replaced with 2.1.0, as shown below. This
error also happened in the past and was dependent on the order of jars on
the classpath. This time, reordering, adding/removing openjpa-all does not
help. 

Environment: MacOS 10.6, JVM1.6-64bit.

There was an old Jira and a thread once with similar error, but not sure if
that issue could be linked with this one.
 
(http://markmail.org/thread/maoxchxfxx73cwjv#query:+page:1+mid:qvknf6hvxq23hv6h+state:results)
(https://issues.apache.org/jira/browse/OPENJPA-73)

Should I open Jira for this as it re-occurs from time to time causing major
headaches?

<error>
5  pu-name  TRACE  [main] openjpa.Runtime - Setting the following properties
from "file:code/conf/META-INF/persistence.xml" into configuration:
{openjpa.BrokerFact
ory=jdbc, openjpa.DynamicDataStructs=true,
openjpa.RuntimeUnenhancedClasses=supported,
javax.persistence.provider=org.apache.openjpa.persistence.PersistenceProviderImpl,
openjpa.jdbc.Schema=user, openjpa.jdbc.SchemaFactory=nati
ve(foreignKeys=true), openjpa.jdbc.FetchDirection=forward,
openjpa.Log=DefaultLevel=TRACE, Runtime=TRACE, Tool=INFO, SQL=TRACE,
openjpa.jdbc.DBDictionary=batchLimit=500, PersistenceVersion=1.0,
openjpa.ConnectionUserName=user, 
openjpa.Id=pu-name,
openjpa.jdbc.SynchronizeMappings=buildSchema(SchemaAction='drop,add',primaryKeys=true,foreignKeys=true,indexes=true),
openjpa.jdbc.LRSSize=last, openjpa.ConnectionPassword=pwd, openj
pa.ConnectionDriverName=org.postgresql.Driver,
openjpa.jdbc.ResultSetType=forward-only,
openjpa.MetaDataFactory=jpa(Types=gaia.cu7.om.AbstractCatalog;gaia.cu7.om.Catalog;gaia.cu7.om.SurveyCatalog;gaia.cu7.om.Survey;gaia.cu7.om.inp
ut.TimeSeriesType;gaia.cu7.om.input.Source;gaia.cu7.om.input.ObservedSource;gaia.cu7.om.input.TimeSeries),
openjpa.Sequence=native(Allocate=500, Increment=1),
openjpa.FetchBatchSize=-1, openjpa.jdbc.MappingDefaults=ForeignKeyDelet
eAction=cascade,
JoinForeignKeyDeleteAction=cascade,IndexLogicalForeignKeys=true,
openjpa.ProxyManager=AssertAllowedType=false,
openjpa.ConnectionURL=jdbc:postgresql://db:5433/schema}
28  pu-name  TRACE  [main] openjpa.Runtime -
org.apache.openjpa.enhance.InstrumentationFactory.getInstrumentation()
_inst:null _dynamicallyInstall:true
29  pu-name  TRACE  [main] openjpa.Runtime -
org.apache.openjpa.enhance.InstrumentationFactory.findToolsJar() -- couldn't
find default
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/tool
s.jar
30  pu-name  TRACE  [main] openjpa.Runtime -
org.apache.openjpa.enhance.InstrumentationFactory.findToolsJar() -- found
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar
1  pu-name  TRACE  [main] openjpa.Runtime - Setting the following properties
from "file:code/conf/META-INF/persistence.xml" into configuration:
{openjpa.DynamicDat
aStructs=true, openjpa.RuntimeUnenhancedClasses=supported,
javax.persistence.provider=org.apache.openjpa.persistence.PersistenceProviderImpl,
openjpa.jdbc.Schema=user,
openjpa.jdbc.SchemaFactory=native(foreignKeys=true), openjp
a.jdbc.FetchDirection=forward, openjpa.Log=DefaultLevel=TRACE,
Runtime=TRACE, Tool=INFO, SQL=TRACE,
openjpa.jdbc.DBDictionary=batchLimit=500, PersistenceVersion=1.0,
openjpa.ConnectionUserName=user, openjpa.Id=mapping-user-s
urveys-gd0-2,
openjpa.jdbc.SynchronizeMappings=buildSchema(SchemaAction='drop,add',primaryKeys=true,foreignKeys=true,indexes=true),
openjpa.jdbc.LRSSize=last, openjpa.ConnectionPassword=userpwd,
openjpa.ConnectionDriverName=org.
postgresql.Driver, openjpa.jdbc.ResultSetType=forward-only,
openjpa.MetaDataFactory=jpa(Types=gaia.cu7.om.AbstractCatalog;gaia.cu7.om.Catalog;gaia.cu7.om.SurveyCatalog;gaia.cu7.om.Survey;gaia.cu7.om.input.TimeSeriesType;gaia.cu7.o
m.input.Source;gaia.cu7.om.input.ObservedSource;gaia.cu7.om.input.TimeSeries),
openjpa.Sequence=native(Allocate=500, Increment=1),
openjpa.FetchBatchSize=-1,
openjpa.jdbc.MappingDefaults=ForeignKeyDeleteAction=cascade, JoinForeign
KeyDeleteAction=cascade,IndexLogicalForeignKeys=true,
openjpa.ProxyManager=AssertAllowedType=false,
openjpa.ConnectionURL=jdbc:postgresql://db:5433/surveys}
409  pu-name  ERROR  [main] openjpa.Runtime - Failed to create a provider
for "pu-name".
java.lang.RuntimeException: There were errors initializing your
configuration: org.apache.openjpa.lib.util.ParseException: There was an
error while setting up the configuration plugin option "Sequence". The
plugin was of type "org
.apache.openjpa.kernel.TimeSeededSeq". Setter methods for the following
plugin properties were not available in that type: [Allocate]. Possible
plugin properties are: [Increment, TYPE_CONTIGUOUS, TYPE_DEFAULT,
TYPE_NONTRANSACTIONA
L, TYPE_TRANSACTIONAL, Type].
Ensure that your plugin configuration string uses key values that correspond
to setter methods in the plugin class.
	at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:515)
	at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:443)
	at
org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:104)
	at org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
	at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.getSequenceInstance(OpenJPAConfigurationImpl.java:1400)
	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:597)
	at
org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
	at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1652)
	at
org.apache.openjpa.enhance.PCEnhancerAgent.registerClassLoadEnhancer(PCEnhancerAgent.java:185)
	at
org.apache.openjpa.enhance.PCEnhancerAgent.premain(PCEnhancerAgent.java:145)
	at
org.apache.openjpa.enhance.PCEnhancerAgent.loadDynamicAgent(PCEnhancerAgent.java:98)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl.loadAgent(PersistenceProviderImpl.java:306)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:101)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:157)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:66)
	at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:152)
	at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:72)
	at
gaia.cu7.om.dal.DbVariStore.createPersistenceFactory(DbVariStore.java:84)
	at
gaia.cu7.om.dal.test.InputOMMappingTest.PersistSourceInUnit(InputOMMappingTest.java:81)
	at
gaia.cu7.om.dal.test.InputOMMappingTest.PersistsSourcePostgres90(InputOMMappingTest.java:73)
	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:597)
	at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
	at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
	at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
	at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
	at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
	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)

	at
org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:309)
	at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1652)
	at
org.apache.openjpa.enhance.PCEnhancerAgent.registerClassLoadEnhancer(PCEnhancerAgent.java:185)
	at
org.apache.openjpa.enhance.PCEnhancerAgent.premain(PCEnhancerAgent.java:145)
	at
org.apache.openjpa.enhance.PCEnhancerAgent.loadDynamicAgent(PCEnhancerAgent.java:98)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl.loadAgent(PersistenceProviderImpl.java:306)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:101)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:157)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:66)
	at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:152)
	at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:72)

</error>

Best regards,
Krzysztof

-- 
View this message in context: http://openjpa.208410.n2.nabble.com/2-1-0-from-maven-repository-woes-tp6077834p6077834.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: 2.1.0 from maven repository woes

Posted by Krzysztof <ya...@gmail.com>.
Hello Michael,
Big thanks for the hints - yes it's bizzare it worked this way indeed. One
explanation could be I was switching to "table" generator for Postgres
sometimes as there was some problem with sequence removal during schema
cleanup ("drop" action).
But I had used this sequence definition before successfully, I had
impression.

Best regards,
Krzysztof

--
View this message in context: http://openjpa.208410.n2.nabble.com/2-1-0-jars-from-maven-repository-cause-EntityManagerFactory-initialisation-problems-tp6077834p6084069.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: 2.1.0 from maven repository woes

Posted by Michael Dick <mi...@gmail.com>.
I took another look and it looks like two different sequence classes are
bound to the alias "native". The one you want is NativeJDBSeq, but setting
that will run you into
OPENJPA-1642<https://issues.apache.org/jira/browse/OPENJPA-1642>.


A workaround suggested in the JIRA issue is to use build time enhancement,
and explicitly set the sequence to
  <property name="openjpa.Sequence"
value="org.apache.openjpa.jdbc.kernel.NativeJDBCSeq(your values go here)" />

In any case, the real fix for this problem lies with OPENJPA-1642, hopefully
the workaround will get you past the immediate problem though.

-mike

On Tue, Mar 1, 2011 at 11:32 AM, Michael Dick <mi...@gmail.com>wrote:

> Hi Krysztof,
>
> I'm not entirely sure how this ever worked for you. The TimeSequence class
> does not accept Allocate as a configuration option. I went back and tried
> with 2.0.1, 1.2.2, and 2.1.0 and got the error you posted.
>
> Could the openjpa.Schema property have changed when you upgraded?
>
> -mike
>
>
> On Tue, Mar 1, 2011 at 11:13 AM, Rick Curtis <cu...@gmail.com> wrote:
>
>> Krysztof -
>>
>> Are you using build time enhancement or are you using the dynamic
>> enhancement agent? If you don't know the answer to this question, you are
>> probably using the dynamic agent. If that is the case, I'd recommend
>> trying
>> to setup your build to use build time enhancement(Let me know if you want
>> some links). If you're already doing build time enhancement, please set
>> the
>> property openjpa.DynamicEnhancementAgent=false. Also, set
>> openjpa.RuntimeUnenhancedClasses=unsupported.
>>
>> I've found in my test environment that from time to time the Sun javaagent
>> fails for no apparent reason.
>>
>> Thanks,
>> Rick
>>
>
>

Re: 2.1.0 from maven repository woes

Posted by Krzysztof <ya...@gmail.com>.
Yes, I've been using build time enhancement - runtime was there for fast
prototyping in rare cases build time enhancement did not run for whatever
reason.
I removed it as you suggested to be consistent always.
Thanks!
Krzysztof

--
View this message in context: http://openjpa.208410.n2.nabble.com/2-1-0-jars-from-maven-repository-cause-EntityManagerFactory-initialisation-problems-tp6077834p6084079.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: 2.1.0 from maven repository woes

Posted by Michael Dick <mi...@gmail.com>.
Hi Krysztof,

I'm not entirely sure how this ever worked for you. The TimeSequence class
does not accept Allocate as a configuration option. I went back and tried
with 2.0.1, 1.2.2, and 2.1.0 and got the error you posted.

Could the openjpa.Schema property have changed when you upgraded?

-mike

On Tue, Mar 1, 2011 at 11:13 AM, Rick Curtis <cu...@gmail.com> wrote:

> Krysztof -
>
> Are you using build time enhancement or are you using the dynamic
> enhancement agent? If you don't know the answer to this question, you are
> probably using the dynamic agent. If that is the case, I'd recommend trying
> to setup your build to use build time enhancement(Let me know if you want
> some links). If you're already doing build time enhancement, please set the
> property openjpa.DynamicEnhancementAgent=false. Also, set
> openjpa.RuntimeUnenhancedClasses=unsupported.
>
> I've found in my test environment that from time to time the Sun javaagent
> fails for no apparent reason.
>
> Thanks,
> Rick
>

Re: 2.1.0 from maven repository woes

Posted by Rick Curtis <cu...@gmail.com>.
Krysztof -

Are you using build time enhancement or are you using the dynamic
enhancement agent? If you don't know the answer to this question, you are
probably using the dynamic agent. If that is the case, I'd recommend trying
to setup your build to use build time enhancement(Let me know if you want
some links). If you're already doing build time enhancement, please set the
property openjpa.DynamicEnhancementAgent=false. Also, set
openjpa.RuntimeUnenhancedClasses=unsupported.

I've found in my test environment that from time to time the Sun javaagent
fails for no apparent reason.

Thanks,
Rick