openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From milotty <milo...@gmail.com>
Subject about the initialization of DB2Dictionary
Date Thu, 03 Apr 2008 00:48:01 GMT
Hi,
Now I'm encountered a problem of NullPointerException like this:
java.lang.NullPointerException
     at
org.apache.openjpa.jdbc.sql.DB2Dictionary.isDB2ZOSV8xOrLater(DB2Dictionary.java:392)

     at
org.apache.openjpa.jdbc.sql.DB2Dictionary.createIndexIfNecessary(DB2Dictionary.java:784)

     at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.addSchema(TableJDBCSeq.java:244)

     at
org.apache.openjpa.jdbc.meta.MappingTool.addSequenceComponents(MappingTool.java:609)

     at
org.apache.openjpa.jdbc.meta.MappingTool.addSequenceComponents(MappingTool.java:591)

     at
org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:477)
     at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:1075)
     at
org.apache.openjpa.jdbc.ant.MappingToolTask.executeOn(MappingToolTask.java:197)

     at
org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:172)
     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)

     at org.apache.tools.ant.Task.perform(Task.java:364)
     at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:64)

     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)

     at org.apache.tools.ant.Task.perform(Task.java:364)

The scenario is I'm only using the ant task of MappingTool to build schema
for some JDO classes.
I looked into the source code a little. The problem is when
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.addSchema() invokes
org.apache.openjpa.jdbc.sql.DB2Dictionary.createIndexIfNecessary() to create
the index for the sequence table, the databaseProductVersion and/or
databaseProductName of DB2Dictionary are needed. But these 2 variables will
not be initialized until DB2Dictionary.connectedConfiguration() is invoked,
and it need a connection to the database. But in addSchema(), there isn't
any connection yet.
MappingTool doesn't always require a connection. So it should be wrong if
simply adding a connection before addSchema() invoked.

Could anyone give me any suggestion of this problem? How to resolve this
problem in OpenJPA scope? Or, is there any method from DB2 side can be used
to get databaseProductVersion and/or databaseProductName without a
connection to database?



Thanks,
Amy

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message