You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Ян Программист <we...@gmail.com> on 2010/05/14 08:47:11 UTC
Still not working
Hi. I have new errors:
193 embeddables INFO [main] openjpa.Runtime - Starting OpenJPA
2.0.0-beta3
404 embeddables INFO [main] openjpa.jdbc.JDBC - Using dictionary class
"org.apache.openjpa.jdbc.sql.HSQLDictionary".
Exception in thread "main" <openjpa-2.0.0-beta3-r422266:926797 fatal store
error> org.apache.openjpa.persistence.RollbackException: user lacks
privilege or object not found: OPENJPA_SEQUENCE_TABLE {SELECT SEQUENCE_VALUE
FROM OPENJPA_SEQUENCE_TABLE WHERE ID = ?} [code=-5501, state=42501]
at
org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:573)
at Main.init(Main.java:79)
at Main.main(Main.java:32)
Caused by: <openjpa-2.0.0-beta3-r422266:926797 fatal general error>
org.apache.openjpa.persistence.PersistenceException: user lacks privilege or
object not found: OPENJPA_SEQUENCE_TABLE {SELECT SEQUENCE_VALUE FROM
OPENJPA_SEQUENCE_TABLE WHERE ID = ?} [code=-5501, state=42501]
at
org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4827)
at
org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4787)
at
org.apache.openjpa.jdbc.sql.HSQLDictionary.newStoreException(HSQLDictionary.java:318)
at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:136)
at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:110)
at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:62)
at
org.apache.openjpa.jdbc.kernel.AbstractJDBCSeq.next(AbstractJDBCSeq.java:66)
at org.apache.openjpa.util.ImplHelper.generateValue(ImplHelper.java:160)
at
org.apache.openjpa.util.ImplHelper.generateFieldValue(ImplHelper.java:144)
at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.assignField(JDBCStoreManager.java:786)
at
org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java:487)
at
org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java:463)
at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.assignObjectId(JDBCStoreManager.java:770)
at
org.apache.openjpa.kernel.DelegatingStoreManager.assignObjectId(DelegatingStoreManager.java:134)
at
org.apache.openjpa.kernel.StateManagerImpl.assignObjectId(StateManagerImpl.java:605)
at
org.apache.openjpa.kernel.StateManagerImpl.preFlush(StateManagerImpl.java:2952)
at org.apache.openjpa.kernel.PNewState.beforeFlush(PNewState.java:40)
at
org.apache.openjpa.kernel.StateManagerImpl.beforeFlush(StateManagerImpl.java:1047)
at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2060)
at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:2020)
at
org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1938)
at
org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:81)
at org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1462)
at
org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:924)
at
org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:556)
... 2 more
Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: user lacks
privilege or object not found: OPENJPA_SEQUENCE_TABLE {SELECT SEQUENCE_VALUE
FROM OPENJPA_SEQUENCE_TABLE WHERE ID = ?} [code=-5501, state=42501]
at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:257)
at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:237)
at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$000(LoggingConnectionDecorator.java:70)
at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection.prepareStatement(LoggingConnectionDecorator.java:289)
at
org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareStatement(DelegatingConnection.java:186)
at
org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator$ConfiguringConnection.prepareStatement(ConfiguringConnectionDecorator.java:155)
at
org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareStatement(DelegatingConnection.java:175)
at
org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement(SQLBuffer.java:549)
at
org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement(SQLBuffer.java:529)
at
org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement(SQLBuffer.java:518)
at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.prepareStatement(TableJDBCSeq.java:806)
at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.getSequence(TableJDBCSeq.java:545)
at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.setSequence(TableJDBCSeq.java:587)
at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq$AllocateSequenceRunnable.run(TableJDBCSeq.java:892)
at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.allocateSequence(TableJDBCSeq.java:454)
at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.nextInternal(TableJDBCSeq.java:305)
at
org.apache.openjpa.jdbc.kernel.AbstractJDBCSeq.next(AbstractJDBCSeq.java:60)
... 20 more
Please help anyone in fixing this stuff. John
Re: Still not working
Posted by Pinaki Poddar <pp...@apache.org>.
The error stack trace points to some sort of configuration mistake. The
possible causes/resolutions are
a) persistence.xml (and hence the connection details) is not visible by the
runtime. Append the unit name as anchor. For example,
org.apache.openjpa.jdbc.kernel.TableJDBCSeq -p
${project_path}/src/META-INF/persistence.xml#XYZ
where XYZ is the persistence unit name.
b) Ensure that the requiste JDBC driver does exist in the runtime classpath.
Can not see a Derby Driver in
-classpath /home/webautomator/openjpa-all-2.0.0-beta3.jar
(or are we now packaging Derby driver in openjpa-all.jar?)
-----
Pinaki
--
View this message in context: http://openjpa.208410.n2.nabble.com/Still-not-working-tp5049761p5051307.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.
Re: Still not working
Posted by Ян Программист <we...@gmail.com>.
> You can configure OpenJPA to define this table
> 1. Use
> <property name="openjpa.jdbc.SynchronizeMappings"
> valie="buildSchema(ForeignKeys=true)"/>
>
Not "valie", but "value". Mismatch ;)
>
> in persistence.xml configuration.
Inacceptable. There is no 100% guarantee that this param would be checked at
runtime.
> 2. Or create the sequence table directly. The following DDL is for MySQL
>
> CREATE TABLE `openjpa_sequence_table` (
> `ID` tinyint(4) NOT NULL,
> `SEQUENCE_VALUE` bigint(20) default NULL,
> PRIMARY KEY (`ID`)
> )
>
> Nope. That is not acceptable due to terms of future use.
> 3. Run
> $ java org.apache.openjpa.jdbc.kernel.TableJDBCSeq
> with persistence.xml as property argument to define the table
>
> Usage: java org.apache.openjpa.jdbc.kernel.TableJDBCSeq
> [-properties/-p <properties file or resource>]
> [-<property name> <property value>]*
> -action/-a <add | drop | get | set> [value]
>
> The most stable variant of all for deployment. I created an external
Eclipse project builder. Here are the arguments:
-classpath /home/webautomator/openjpa-all-2.0.0-beta3.jar
org.apache.openjpa.jdbc.kernel.TableJDBCSeq -p
${project_path}/src/META-INF/persistence.xml
> 4. Please post your persistence.xml if none of the above works
>
> Your expectations where right. It didn't work:
Exception in thread "main" <openjpa-2.0.0-beta3-r422266:926797 fatal user
error> org.apache.openjpa.util.UserException: A JDBC Driver or DataSource
class name must be specified in the ConnectionDriverName property.
at
org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:76)
at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:836)
at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:594)
at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.addPrimaryKeyColumn(TableJDBCSeq.java:365)
at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.buildTable(TableJDBCSeq.java:403)
at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.endConfiguration(TableJDBCSeq.java:247)
at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:507)
at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:432)
at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:412)
at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.run(TableJDBCSeq.java:750)
at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.run(TableJDBCSeq.java:735)
at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq$1.run(TableJDBCSeq.java:717)
at
org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:725)
at
org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(Configurations.java:710)
at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.main(TableJDBCSeq.java:712)
My persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="1.0">
<!--
We need to enumerate each persistent class first in the
persistence.xml
See: http://issues.apache.org/jira/browse/OPENJPA-78
-->
<persistence-unit name="none" transaction-type="RESOURCE_LOCAL">
<mapping-file>reversemapping/orm.xml</mapping-file>
<class>hellojpa.Message</class>
<class>relations.Deity</class>
</persistence-unit>
<!--
A persistence unit is a set of listed persistent entities as well
the configuration of an EntityManagerFactory. We configure each
example in a separate persistence-unit.
-->
<persistence-unit name="hellojpa" transaction-type="RESOURCE_LOCAL">
<!--
The default provider can be OpenJPA, or some other product.
This element is optional if OpenJPA is the only JPA provider
in the current classloading environment, but can be specified
in cases where there are multiple JPA implementations available.
-->
<!--
<provider>
org.apache.openjpa.persistence.PersistenceProviderImpl
</provider>
-->
<!-- We must enumerate each entity in the persistence unit -->
<class>hellojpa.Message</class>
<properties>
<!--
We can configure the default OpenJPA properties here. They
happen to be commented out here since the provided examples
all specify the values via System properties.
<property name="openjpa.DynamicEnhancementAgent" value="false"/>
<property name="openjpa.RuntimeUnenhancedClasses"
value="unsupported"/>
-->
<property name="openjpa.ConnectionURL"
value="jdbc:derby:openjpa-database;create=true"/>
*<property name="openjpa.ConnectionDriverName"
value="org.apache.derby.jdbc.EmbeddedDriver"/>*
<property name="openjpa.ConnectionUserName"
value="user"/>
<property name="openjpa.ConnectionPassword"
value="secret"/>
<property name="openjpa.Sequence"
value="org.apache.openjpa.jdbc.kernel.ClassTableJDBCSeq"/>
</properties>
</persistence-unit>
<!-- persistence unit for the "relations" example -->
<persistence-unit name="relations" transaction-type="RESOURCE_LOCAL">
<class>relations.Deity</class>
</persistence-unit>
<!-- persistence unit for the "reversemapping" example -->
<persistence-unit name="reversemapping"
transaction-type="RESOURCE_LOCAL">
<mapping-file>reversemapping/orm.xml</mapping-file>
</persistence-unit>
<persistence-unit name="embeddables" transaction-type="RESOURCE_LOCAL">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<class>Address</class>
<class>ContactInfo</class>
<class>Phone</class>
<class>User</class>
</persistence-unit>
</persistence>
John
Re: Still not working
Posted by Pinaki Poddar <pp...@apache.org>.
OPENJPA_SEQUENCE_TABLE is the table to generate unique identifier for
persistent classes.
You can configure OpenJPA to define this table
1. Use
<property name="openjpa.jdbc.SynchronizeMappings"
valie="buildSchema(ForeignKeys=true)"/>
in persistence.xml configuration.
2. Or create the sequence table directly. The following DDL is for MySQL
CREATE TABLE `openjpa_sequence_table` (
`ID` tinyint(4) NOT NULL,
`SEQUENCE_VALUE` bigint(20) default NULL,
PRIMARY KEY (`ID`)
)
3. Run
$ java org.apache.openjpa.jdbc.kernel.TableJDBCSeq
with persistence.xml as property argument to define the table
Usage: java org.apache.openjpa.jdbc.kernel.TableJDBCSeq
[-properties/-p <properties file or resource>]
[-<property name> <property value>]*
-action/-a <add | drop | get | set> [value]
4. Please post your persistence.xml if none of the above works
-----
Pinaki
--
View this message in context: http://openjpa.208410.n2.nabble.com/Still-not-working-tp5049761p5049997.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.