DataNucleus Forum

Print at Mar 10, 2010 5:00:02 AM View all posts in this thread on one page
Posted by laurentlecomte51 at Dec 24, 2006 1:34:27 AM
[DERBY][SPRING]
HI,

I try to use Apache DERBY instead of mysql.

With all the same, I encouter some problems while creating schemas.

I have this errors:
[ERROR][AWT-EventQueue-0] 01:27:42,890 JPOX.RDBMS.Schema - An exception was thrown while adding/validating class(es) : DERBY SQL error: SQLCODE: -1, SQLSTATE: 38000, SQLERRMC: java.sql.SQLException: Java exception: '0: java.lang.ArrayIndexOutOfBoundsException'.38000XJ001:java.lang.ArrayIndexOutOfBoundsException0XJ001.U
java.sql.SQLException: DERBY SQL error: SQLCODE: -1, SQLSTATE: 38000, SQLERRMC: java.sql.SQLException: Java exception: '0: java.lang.ArrayIndexOutOfBoundsException'.38000XJ001:java.lang.ArrayIndexOutOfBoundsException0XJ001.U
at org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
at org.apache.derby.client.am.DatabaseMetaData.getIndexInfo(Unknown Source)
at org.jpox.store.rdbms.adapter.DatabaseAdapter.getExistingIndexes(DatabaseAdapter.java:1583)
at org.jpox.store.rdbms.table.TableImpl.getExistingCandidateKeys(TableImpl.java:1013)
at org.jpox.store.rdbms.table.TableImpl.validateCandidateKeys(TableImpl.java:615)
at org.jpox.store.rdbms.table.TableImpl.validateConstraints(TableImpl.java:393)
at org.jpox.store.rdbms.table.ClassTable.validateConstraints(ClassTable.java:2817)
at org.jpox.store.rdbms.RDBMSManager$ClassAdder.performTablesValidation(RDBMSManager.java:3110)
at org.jpox.store.rdbms.RDBMSManager$ClassAdder.addClassTablesAndValidate(RDBMSManager.java:3313)
at org.jpox.store.rdbms.RDBMSManager$ClassAdder.run(RDBMSManager.java:2554)
at org.jpox.store.rdbms.RDBMSManager$MgmtTransaction.execute(RDBMSManager.java:2406)
at org.jpox.store.rdbms.RDBMSManager.addClasses(RDBMSManager.java:821)
at org.jpox.store.rdbms.RDBMSManager.addClass(RDBMSManager.java:835)
at org.jpox.store.StoreManager.getDatastoreClass(StoreManager.java:1151)
at org.jpox.store.rdbms.RDBMSManager.getExtent(RDBMSManager.java:1354)
at org.jpox.AbstractPersistenceManager.getExtent(AbstractPersistenceManager.java:2332)
at org.jpox.store.rdbms.query.JDOQLQuery$Compiler.compileCandidates(JDOQLQuery.java:1114)
at org.jpox.store.rdbms.query.JDOQLQuery$Compiler.executionCompile(JDOQLQuery.java:881)
at org.jpox.store.rdbms.query.JDOQLQuery.performExecute(JDOQLQuery.java:497)
at org.jpox.store.query.Query.executeWithMap(Query.java:959)
at org.jpox.store.query.Query.executeWithArray(Query.java:932)
at org.jpox.store.query.Query.execute(Query.java:855)
at org.dicom4jserver.dao.support.BaseDao.executeSelectQuery(BaseDao.java:179)
at org.dicom4jserver.dao.DicomNodeBeanDAO.getAllDicomNodes(DicomNodeBeanDAO.java:38)
at org.dicom4jserver.gui.tabpanels.DicomNodesPanel.readActionFired(DicomNodesPanel.java:108)
at org.dicom4jserver.gui.tabpanels.DicomNodesPanel.readDicomNodesFromDB(DicomNodesPanel.java:79)
at org.dicom4jserver.gui.Main.OnActiveDicomNodesTabPanel(Main.java:246)
at org.dicom4jserver.gui.Main.access$3(Main.java:244)
at org.dicom4jserver.gui.Main$TabChangeHandler.stateChanged(Main.java:219)
at javax.swing.JTabbedPane.fireStateChanged(Unknown Source)
at javax.swing.JTabbedPane$ModelListener.stateChanged(Unknown Source)
at javax.swing.DefaultSingleSelectionModel.fireStateChanged(Unknown Source)
at javax.swing.DefaultSingleSelectionModel.setSelectedIndex(Unknown Source)
at javax.swing.JTabbedPane.setSelectedIndexImpl(Unknown Source)
at javax.swing.JTabbedPane.setSelectedIndex(Unknown Source)
at javax.swing.plaf.basic.BasicTabbedPaneUI$Handler.mousePressed(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)


Here to configuration of my spring file :
<prop key="javax.jdo.PersistenceManagerFactoryClass">org.jpox.PersistenceManagerFactoryImpl</prop>
<prop key="javax.jdo.option.ConnectionURL">jdbc:derby://127.0.0.1:1527/login;create=true</prop>
<prop key="javax.jdo.option.ConnectionUserName">sa</prop>
<prop key="javax.jdo.option.ConnectionPassword">sa</prop>
<prop key="javax.jdo.option.ConnectionDriverName">org.apache.derby.jdbc.ClientDriver</prop>
<prop key="org.jpox.autoCreateSchema">true</prop>


I don't know how to resolve this issue.


Thanks in advance

Posted by andy at Dec 24, 2006 9:58:28 AM
Re: [DERBY][SPRING]
at org.apache.derby.client.am.DatabaseMetaData.getIndexInfo(Unknown Source)
I don't know how to resolve this issue.

Me neither since you dont say what version of anything. It is validating indexes, and the error is within Derby. You have logs ... JPOX and Derby.
----------------------------------------
-Andy smile


Posted by jschek at Feb 23, 2007 1:28:06 AM
confused   Re: [DERBY][SPRING]
I'm running JPOX, java5 plugin, and enhancer 1.1.6 with Derby 10.2.2...

I've been getting a similar problem when creating the schema using the schematool. I've tracked it down to the "create=true" attribute on the connection URL. The derby metadata calls (in my case, getImportedKeys) seem to fail if you create the database and create the schema at the same time... I've yet to track down the exact reason why this is.


In my case, if I use "jdbc:derby:blahblahblah;create=true" as my connection URL for JPOX Schema Tool, I get a similar ArrayIndexOutOfBoundsException... this only occurs if the database does not already exist.

Once this error occurs, the database is permanently in a corrupted state (i.e. the schema tool will never work). Calls to metadata seem to fail consistently.

If I create the database outside without JPOX's involvement, everything works fine...



The process that seems to work for me is:
1. Delete the database, if it exists.
2. Connect to the database with create=true.
3. Immediately shutdown the database (in my case, the jvm exits).
4. Run the schema creation tool.


In your case, is the physical database being created on the fly, or does it already exist?

Posted by andy at Feb 23, 2007 6:57:43 AM
Re: [DERBY][SPRING]
I've been getting a similar problem when creating the schema using the schematool.

So why not look at http://www.jpox.org/docs/bug_reporting.html and generate a testcase since I have never seen what you say, and the JDO2 TCK runs with Derby too and also never exhibits this. If you create a testcase that demonstrates it then someone has basis for comment
----------------------------------------
-Andy smile


Posted by berntm at May 9, 2007 12:58:39 PM
Re: [DERBY][SPRING]
This is an Apache Derby bug. See http://issues.apache.org/jira/browse/DERBY-2584 for details.

Posted by berntm at May 10, 2007 1:15:03 PM
Re: [DERBY][SPRING]
Is it possible to override the value of getTransactionIsolationForSchemaCreation() with some org.jpox property? That would have been a neat workaround for the bug in Derby.