You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Bryan Pendleton (JIRA)" <ji...@apache.org> on 2016/05/03 05:33:12 UTC

[jira] [Commented] (DERBY-6887) NullPointer in org.apache.derby.impl.sql.catalog.DataDictionaryImpl#getTransactionCompile

    [ https://issues.apache.org/jira/browse/DERBY-6887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15268024#comment-15268024 ] 

Bryan Pendleton commented on DERBY-6887:
----------------------------------------

Thank you for attaching the information you have available. Unfortunately, the stack
trace is truncated. Can you use the techniques described at:

    http://http://wiki.apache.org/db-derby/UnwindExceptionChain

to capture a complete stack trace?

Also, can you contribute a standalone test case which demonstrates this problem?

Since your application uses some intermediate libraries, one possibility is that
you could run your application with
{code}
-Dderby.language.logStatementText=true
{code}
and then look in your derby.log file to see what actual SQL statements are
being issued, using what transactions and connections, leading up to the problem.

That might give you some ideas about the precise aspects of the problem to
capture in your reproduction script.

Also, you might try running a tool like DDLUtils against your database, to determine
exactly what schema objects you have defined (tables, views, triggers, constraints, etc.),
as these may be crucial to demonstrating the problem.

From the stack trace that you were able to capture, it is clear that the problem
involves a "DROP SEQUENCE" operation; SEQUENCE objects are used to generate
unique values for primary key columns in your database when you use syntax
such as "GENERATED ALWAYS AS IDENTITY". But, beyond that, there is not
much information available to identify **precisely** why your DROP SEQUENCE operation failed.

> NullPointer in org.apache.derby.impl.sql.catalog.DataDictionaryImpl#getTransactionCompile
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-6887
>                 URL: https://issues.apache.org/jira/browse/DERBY-6887
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.12.1.1
>         Environment: ------------------ Java-Informationen ------------------
> Java-Version: 1.8.0_77
> Java-Anbieter: Oracle Corporation
> Java Home: /usr/lib/jvm/java-8-oracle/jre
> Java Classpath: /home/developercookie/Downloads/db-derby-10.12.1.1-bin/lib/derby.jar:/home/developercookie/Downloads/db-derby-10.12.1.1-bin/lib/derbynet.jar:/home/developercookie/Downloads/db-derby-10.12.1.1-bin/lib/derbytools.jar:/home/developercookie/Downloads/db-derby-10.12.1.1-bin/lib/derbyoptionaltools.jar:/home/developercookie/Downloads/db-derby-10.12.1.1-bin/lib/derbyclient.jar
> BS-Name: Linux
> BS-Architektur: amd64
> BS-Version: 4.4.0-21-generic
> Java-Benutzername: developercookie
> Java-Benutzer-Home: /home/developercookie
> Java-Benutzerverzeichnis: /home/developercookie/Downloads/db-derby-10.12.1.1-bin/bin
> java.specification.name: Java Platform API Specification
> java.specification.version: 1.8
> java.runtime.version: 1.8.0_77-b03
> --------- Derby-Informationen --------
> [/home/developercookie/Downloads/db-derby-10.12.1.1-bin/lib/derby.jar] 10.12.1.1 - (1704137)
> [/home/developercookie/Downloads/db-derby-10.12.1.1-bin/lib/derbytools.jar] 10.12.1.1 - (1704137)
> [/home/developercookie/Downloads/db-derby-10.12.1.1-bin/lib/derbynet.jar] 10.12.1.1 - (1704137)
> [/home/developercookie/Downloads/db-derby-10.12.1.1-bin/lib/derbyclient.jar] 10.12.1.1 - (1704137)
> [/home/developercookie/Downloads/db-derby-10.12.1.1-bin/lib/derbyoptionaltools.jar] 10.12.1.1 - (1704137)
> ------------------------------------------------------
> ----------------- Informationen zum Gebietsschema -----------------
> Aktuelles Gebietsschema:  [Deutsch/Deutschland [de_DE]]
> Folgende Gebietsschemaunterstützung gefunden: [cs]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [de_DE]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [es]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [fr]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [hu]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [it]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [ja_JP]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [ko_KR]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [pl]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [pt_BR]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [ru]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [zh_CN]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [zh_TW]
> 	 Version: 10.12.1.1 - (1704137)
> ------------------------------------------------------
> ------------------------------------------------------
>            Reporter: Developercookie
>
> Hi,
> I'm using Derby in my application. For migrating databases I use the small library Flayway. While running tests I encountered a NullPointerException when Flayway tries to drop tables for clean up. After digging into the Flayway code I found that the root cause is a NullPointerException within Derby in the method {{org.apache.derby.impl.sql.catalog.DataDictionaryImpl#getTransactionCompile}}. This method calls another method {{getLCC()}} that can return a {{null}} value and this causes the {{NullPointerException}}
> NullPointerException stacktrace:
> {code}
> org.flywaydb.core.api.FlywayException: Unable to drop "APP"."LOCATIONS"
> 	at org.flywaydb.core.internal.dbsupport.SchemaObject.drop(SchemaObject.java:82)
> 	at org.flywaydb.core.internal.dbsupport.derby.DerbySchema.doClean(DerbySchema.java:81)
> 	at org.flywaydb.core.internal.dbsupport.Schema.clean(Schema.java:148)
> 	at org.flywaydb.core.internal.command.DbClean$4.doInTransaction(DbClean.java:182)
> 	at org.flywaydb.core.internal.command.DbClean$4.doInTransaction(DbClean.java:180)
> 	at org.flywaydb.core.internal.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:72)
> 	at org.flywaydb.core.internal.command.DbClean.cleanSchema(DbClean.java:180)
> 	at org.flywaydb.core.internal.command.DbClean.clean(DbClean.java:130)
> 	at org.flywaydb.core.Flyway$3.execute(Flyway.java:1017)
> 	at org.flywaydb.core.Flyway$3.execute(Flyway.java:1013)
> 	at org.flywaydb.core.Flyway.execute(Flyway.java:1361)
> 	at org.flywaydb.core.Flyway.clean(Flyway.java:1013)
> 	at org.developercookie.account.dao.DBHelper.cleanupDatabase(DBHelper.java:64)
> 	at org.developercookie.account.dao.SingleTransactionDAOTest.cleanupDatabase(SingleTransactionDAOTest.java:235)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:498)
> 	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
> 	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
> 	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
> 	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
> 	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
> 	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
> 	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
> 	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
> 	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
> 	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
> 	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
> 	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
> 	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
> 	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
> 	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
> 	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:498)
> 	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
> 	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
> 	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
> 	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
> 	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.execute(Unknown Source)
> 	at org.flywaydb.core.internal.dbsupport.JdbcTemplate.execute(JdbcTemplate.java:219)
> 	at org.flywaydb.core.internal.dbsupport.derby.DerbyTable.doDrop(DerbyTable.java:43)
> 	at org.flywaydb.core.internal.dbsupport.SchemaObject.drop(SchemaObject.java:80)
> 	... 44 more
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> 	at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown Source)
> 	... 58 more
> Caused by: java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getTransactionCompile(Unknown Source)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getDescriptorViaIndex(Unknown Source)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getSequenceDescriptor(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.DropSequenceConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.DropTableConstantAction.dropIdentitySequence(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.DropTableConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
> 	... 50 more
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)