Hi Guys,
I'm trying to use cdbgen task in my Ant script and I'm getting NPE.
Here is the ant code and the exception. Can anyone please help??
Thanks in advance.
Cheers,
Parth
From Ant build:
<target name="create-db" description="build the Coffeshop
database">
<cdbgen map="${src.dir}/CoffeshopMap.map.xml"
adapter="org.apache.cayenne.dba.sqlserver.SQLServerAdapter"
driver="om.microsoft.jdbc.sqlserver.SQLServerDriver"
url="jdbc:sqlserver://localhost:
1433;databaseName=coffeshop;SelectMethod=cursor"
username="coffeshop"
password="password"/>
</target>
Exception
generator options - [dropTables: false, dropPK: false,
createTables: true, createPK: true, createFK: true]
[cdbgen] Error generating database
BUILD FAILED
C:\dev\myEclipseTelstraWorkspace\telstra.all4biz.portal\edge-
build.xml:293: Error generating database
at
org
.apache
.cayenne.tools.DbGeneratorTask.execute(DbGeneratorTask.java:94)
at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:
288)
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:585)
at
org
.apache
.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:
1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:
1298)
at
org
.apache
.tools
.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at
org
.eclipse
.ant
.internal
.ui
.antsupport
.EclipseDefaultExecutor
.executeTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:
1181)
at
org
.eclipse
.ant
.internal
.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
at
org
.eclipse
.ant
.internal
.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
Caused by: java.lang.NullPointerException
at
org
.apache
.cayenne
.map.AshwoodEntitySorter.fillInMetadata(AshwoodEntitySorter.java:
264)
at
org
.apache
.cayenne
.map.AshwoodEntitySorter._indexSorter(AshwoodEntitySorter.java:97)
at
org
.apache
.cayenne
.map.AshwoodEntitySorter.sortDbEntities(AshwoodEntitySorter.java:
136)
at
org
.apache
.cayenne.access.DbGenerator.prepareDbEntities(DbGenerator.java:582)
at
org.apache.cayenne.access.DbGenerator.<init>(DbGenerator.java:132)
at
org.apache.cayenne.access.DbGenerator.<init>(DbGenerator.java:105)
at
org.apache.cayenne.access.DbGenerator.<init>(DbGenerator.java:93)
at
org
.apache
.cayenne.tools.DbGeneratorTask.execute(DbGeneratorTask.java:71)
... 16 more
--- Nested Exception ---
java.lang.NullPointerException
at
org
.apache
.cayenne
.map.AshwoodEntitySorter.fillInMetadata(AshwoodEntitySorter.java:
264)
at
org
.apache
.cayenne
.map.AshwoodEntitySorter._indexSorter(AshwoodEntitySorter.java:97)
at
org
.apache
.cayenne
.map.AshwoodEntitySorter.sortDbEntities(AshwoodEntitySorter.java:
136)
at
org
.apache
.cayenne.access.DbGenerator.prepareDbEntities(DbGenerator.java:582)
at
org.apache.cayenne.access.DbGenerator.<init>(DbGenerator.java:132)
at
org.apache.cayenne.access.DbGenerator.<init>(DbGenerator.java:105)
at
org.apache.cayenne.access.DbGenerator.<init>(DbGenerator.java:93)
at
org
.apache
.cayenne.tools.DbGeneratorTask.execute(DbGeneratorTask.java:71)
at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:
288)
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:585)
at
org
.apache
.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:
1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:
1298)
at
org
.apache
.tools
.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at
org
.eclipse
.ant
.internal
.ui
.antsupport
.EclipseDefaultExecutor
.executeTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:
1181)
at
org
.eclipse
.ant
.internal
.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
at
org
.eclipse
.ant
.internal
.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)