You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Heather Sterling <hs...@us.ibm.com> on 2009/03/30 17:58:13 UTC

can generate DDL connectionless from cmdline but not ant task


Hi,

I consulted a bunch of the existing information regarding generating DDL
without a db connection.  I was able to successfully do this with 1.2 from
the cmdline, but it still tries to get a connection when I execute from the
ant task.  Both are pointed at the same persistence.xml and I have not
specified any db connection properties in the file.  The output looks the
same up until the very end when it tries to record the schema.  Is this a
known issue?

CMDLINE

C:\Documents and Settings\Administrator\workspace2\JPQLPrototype>java
-cp .;META
-INF\;"C:\openjpa\openjpa_binaries\apache-openjpa-1.2.0
\lib"\..\openjpa-1.2.0.ja
r;"C:\openjpa\openjpa_binaries\apache-openjpa-1.2.0
\lib"\commons-collections-3.2
.jar;"C:\openjpa\openjpa_binaries\apache-openjpa-1.2.0
\lib"\serp-1.13.1.jar;"C:\
openjpa\openjpa_binaries\apache-openjpa-1.2.0
\lib"\commons-lang-2.1.jar;"C:\open
jpa\openjpa_binaries\apache-openjpa-1.2.0
\lib"\geronimo-jpa_3.0_spec-1.0.jar;"C:
\openjpa\openjpa_binaries\apache-openjpa-1.2.0
\lib"\geronimo-jta_1.1_spec-1.1.ja
r;"C:\openjpa\derbyjars"\derbytools.jar;"C:\openjpa
\derbyjars"\derby.jar;"C:\ope
njpa\derbyjars"\derbyclient.jar;"C:\openjpa
\derbyjars"\derbynet.jar;"C:\openjpa\
derbyjars"\derbyrun.jar  org.apache.openjpa.jdbc.meta.MappingTool
-properties pe
rsistence.xml#jpqlprototype  -schemaAction build -sql create.sql
-DBDictionary d
erby


ANT

 <!-- Call this target to generate DDL for your persistent classes..  Note
that we may have to update this based on where we locate persistence.xml
files -->
 <target name="generateddl">
  <!-- define the mappingtool task -->
  <taskdef name="mappingtool"
classname="org.apache.openjpa.jdbc.ant.MappingToolTask">
      <classpath refid="jpa.tooling.classpath"/>
  </taskdef>

  <!-- invoke the mapping tool -->
  <mappingtool sqlFile="./create.sql" action="buildSchema">.
        <!-- This assumes the persistence.xml file is in the META-INF
directory of the plugin. -->
        <config propertiesFile="./META-INF/persistence.xml"
DBDictionary="derby" />
        <classpath refid="jpa.tooling.classpath"/>
  </mappingtool>
</target>



Exception

C:\persist1\BUILD\include\jpa_common_build.xml:86:
<openjpa-1.2.0-r422266:683325
 fatal user error> org.apache.openjpa.util.UserException: A JDBC Driver or
DataS
ource class name must be specified in the ConnectionDriverName property.
        at org.apache.tools.ant.ProjectHelper.addLocationToBuildException
(Projec
tHelper.java:539)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:384)
        at org.apache.tools.ant.taskdefs.CallTarget.execute
(CallTarget.java:107)

        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.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets
(Project.java:1216))
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets
(DefaultExe
cutor.java:40).
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: C:\persist1\BUILD\include\jpa_common_build.xml:86:
<openjpa-1.2.0-r42
2266:683325 fatal user error> org.apache.openjpa.util.UserException: A JDBC
Driv
er or DataSource class name must be specified in the ConnectionDriverName
proper
ty.
        at org.apache.openjpa.lib.ant.AbstractTask.execute
(AbstractTask.java:176
)
        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.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets
(Project.java:1216)
        at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets
(Single
CheckExecutor.java:37)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
        ... 13 more
Caused by: <openjpa-1.2.0-r422266:683325 fatal user error>
org.apache.openjpa.ut
il.UserException: A JDBC Driver or DataSource class name must be specified
in th
e ConnectionDriverName property.
        at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource
(DataSo
urceFactory.java:74)
        at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFa
ctory(JDBCConfigurationImpl.java:784)
        at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFacto
ry(JDBCConfigurationImpl.java:691).
        at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource
(JDBC
ConfigurationImpl.java:790)
        at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource2(JDB
CConfigurationImpl.java:797)
        at org.apache.openjpa.jdbc.schema.SchemaTool.<init>
(SchemaTool.java:127)

        at org.apache.openjpa.jdbc.meta.MappingTool.newSchemaTool
(MappingTool.ja
va:310)
        at org.apache.openjpa.jdbc.meta.MappingTool.record
(MappingTool.java:490)

        at org.apache.openjpa.jdbc.meta.MappingTool.run
(MappingTool.java:1075)
        at org.apache.openjpa.jdbc.ant.MappingToolTask.executeOn
(MappingToolTask
.java:205)
        at org.apache.openjpa.lib.ant.AbstractTask.execute
(AbstractTask.java:172
)
        ... 21 more
--- Nested Exception ---
C:\persist1\BUILD\include\jpa_common_build.xml:86:
<openjpa-1.2.0-r422266:683325
 fatal user error> org.apache.openjpa.util.UserException: A JDBC Driver or
DataS
ource class name must be specified in the ConnectionDriverName property.
        at org.apache.openjpa.lib.ant.AbstractTask.execute
(AbstractTask.java:176
)
        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.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets
(Project.java:1216)
        at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets
(Single
CheckExecutor.java:37)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
        at org.apache.tools.ant.taskdefs.CallTarget.execute
(CallTarget.java:107)

        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.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets
(Project.java:1216))
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets
(DefaultExe
cutor.java:40).
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: <openjpa-1.2.0-r422266:683325 fatal user error>
org.apache.openjpa.ut
il.UserException: A JDBC Driver or DataSource class name must be specified
in th
e ConnectionDriverName property.
        at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource
(DataSo
urceFactory.java:74)
        at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFa
ctory(JDBCConfigurationImpl.java:784)
        at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFacto
ry(JDBCConfigurationImpl.java:691).
        at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource
(JDBC
ConfigurationImpl.java:790)
        at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource2(JDB
CConfigurationImpl.java:797)
        at org.apache.openjpa.jdbc.schema.SchemaTool.<init>
(SchemaTool.java:127)

        at org.apache.openjpa.jdbc.meta.MappingTool.newSchemaTool
(MappingTool.ja
va:310)
        at org.apache.openjpa.jdbc.meta.MappingTool.record
(MappingTool.java:490)

        at org.apache.openjpa.jdbc.meta.MappingTool.run
(MappingTool.java:1075)
        at org.apache.openjpa.jdbc.ant.MappingToolTask.executeOn
(MappingToolTask
.java:205)
        at org.apache.openjpa.lib.ant.AbstractTask.execute
(AbstractTask.java:172
)
        ... 21 more


Heather Sterling
Systems Management Development
Phone:  919-254-7163 T/L: 444-7163
Cell: 919-423-3143
Email: hsterl@us.ibm.com

Re: can generate DDL connectionless from cmdline but not ant task

Posted by rpalache <ra...@oracle.com>.
Hi,

Also here is my configuration and output from both the runs:

ant task:

<target name="generateddl">
  <taskdef name="mappingtool" classname="org.apache.openjpa.jdbc.ant.MappingToolTask" 
  	   classpath="${compile.classpath}"/>
  <mappingtool schemaAction="build" sqlFile="./create.sql">
     <config propertiesFile="src/META-INF/persistence.xml" DBDictionary="derby" />
    <classpath>
            <pathelement path="${compile.classpath}"/>
      </classpath>
  </mappingtool>
</target>

Java CmdLine:

java org.apache.openjpa.jdbc.meta.MappingTool  -properties src/META-INF/persistence.xml -schemaAction build -sql create.sql

Output from above:

D:\CRWork\JIRA\Postings\Issue#1\openJPATestcase>ant
Buildfile: build.xml

generateddl:
[mappingtool] 594  querycache  INFO   [Main Thread] openjpa.jdbc.JDBC - Using dictionary class "org.
apache.openjpa.jdbc.sql.DerbyDictionary".
[mappingtool] 703  querycache  INFO   [Main Thread] openjpa.Tool - No targets were given.  Running o
n all classes listed in your configuration, or all persistent classes in the classpath if no classes
 are configured.  Use -help to display tool usage information.
[mappingtool] 812  querycache  INFO   [Main Thread] openjpa.Tool - Mapping tool running on type "cla
ss pkg.A" with action "buildSchema".
[mappingtool] 1219  querycache  INFO   [Main Thread] openjpa.Tool - Recording mapping and schema cha
nges.

BUILD SUCCESSFUL
Total time: 2 seconds

D:\CRWork\JIRA\Postings\Issue#1\openJPATestcase>java org.apache.openjpa.jdbc.meta.MappingTool  -prop
erties src/META-INF/persistence.xml -schemaAction build -sql create.sql
110  querycache  INFO   [Main Thread] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa
.jdbc.sql.OracleDictionary".
203  querycache  INFO   [Main Thread] openjpa.Tool - No targets were given.  Running on all classes
listed in your configuration, or all persistent classes in the classpath if no classes are configure
d.  Use -help to display tool usage information.
297  querycache  INFO   [Main Thread] openjpa.Tool - Mapping tool running on type "class pkg.A" with
 action "buildSchema".
735  querycache  INFO   [Main Thread] openjpa.Tool - Recording mapping and schema changes.

persistence.xml:

	<persistence-unit name="querycache">
		<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>		
		<class>pkg.A</class>
		<properties>
			<!-- Connection configuration -->
			<property name="openjpa.ConnectionURL" value=""/>
			<property name="openjpa.ConnectionDriverName" value="oracle.jdbc.driver.OracleDriver"/>
			<property name="openjpa.ConnectionUserName" value="rpalache"/>
			<property name="openjpa.ConnectionPassword" value="rpalache"/>
		</properties>
	</persistence-unit>

Regards,
Ravi.





Hi,

I consulted a bunch of the existing information regarding generating DDL
without a db connection.  I was able to successfully do this with 1.2 from
the cmdline, but it still tries to get a connection when I execute from the
ant task.  Both are pointed at the same persistence.xml and I have not
specified any db connection properties in the file.  The output looks the
same up until the very end when it tries to record the schema.  Is this a
known issue?

CMDLINE

C:\Documents and Settings\Administrator\workspace2\JPQLPrototype>java
-cp .;META
-INF\;"C:\openjpa\openjpa_binaries\apache-openjpa-1.2.0
\lib"\..\openjpa-1.2.0.ja
r;"C:\openjpa\openjpa_binaries\apache-openjpa-1.2.0
\lib"\commons-collections-3.2
.jar;"C:\openjpa\openjpa_binaries\apache-openjpa-1.2.0
\lib"\serp-1.13.1.jar;"C:\
openjpa\openjpa_binaries\apache-openjpa-1.2.0
\lib"\commons-lang-2.1.jar;"C:\open
jpa\openjpa_binaries\apache-openjpa-1.2.0
\lib"\geronimo-jpa_3.0_spec-1.0.jar;"C:
\openjpa\openjpa_binaries\apache-openjpa-1.2.0
\lib"\geronimo-jta_1.1_spec-1.1.ja
r;"C:\openjpa\derbyjars"\derbytools.jar;"C:\openjpa
\derbyjars"\derby.jar;"C:\ope
njpa\derbyjars"\derbyclient.jar;"C:\openjpa
\derbyjars"\derbynet.jar;"C:\openjpa\
derbyjars"\derbyrun.jar  org.apache.openjpa.jdbc.meta.MappingTool
-properties pe
rsistence.xml#jpqlprototype  -schemaAction build -sql create.sql
-DBDictionary d
erby


ANT

 <!-- Call this target to generate DDL for your persistent classes..  Note
that we may have to update this based on where we locate persistence.xml
files -->
 <target name="generateddl">
  <!-- define the mappingtool task -->
  <taskdef name="mappingtool"
classname="org.apache.openjpa.jdbc.ant.MappingToolTask">
      <classpath refid="jpa.tooling.classpath"/>
  </taskdef>

  <!-- invoke the mapping tool -->
  <mappingtool sqlFile="./create.sql" action="buildSchema">.
        <!-- This assumes the persistence.xml file is in the META-INF
directory of the plugin. -->
        <config propertiesFile="./META-INF/persistence.xml"
DBDictionary="derby" />
        <classpath refid="jpa.tooling.classpath"/>
  </mappingtool>
</target>



Exception

C:\persist1\BUILD\include\jpa_common_build.xml:86:
<openjpa-1.2.0-r422266:683325
 fatal user error> org.apache.openjpa.util.UserException: A JDBC Driver or
DataS
ource class name must be specified in the ConnectionDriverName property.
        at org.apache.tools.ant.ProjectHelper.addLocationToBuildException
(Projec
tHelper.java:539)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:384)
        at org.apache.tools.ant.taskdefs.CallTarget.execute
(CallTarget.java:107)

        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.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets
(Project.java:1216))
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets
(DefaultExe
cutor.java:40).
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: C:\persist1\BUILD\include\jpa_common_build.xml:86:
<openjpa-1.2.0-r42
2266:683325 fatal user error> org.apache.openjpa.util.UserException: A JDBC
Driv
er or DataSource class name must be specified in the ConnectionDriverName
proper
ty.
        at org.apache.openjpa.lib.ant.AbstractTask.execute
(AbstractTask.java:176
)
        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.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets
(Project.java:1216)
        at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets
(Single
CheckExecutor.java:37)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
        ... 13 more
Caused by: <openjpa-1.2.0-r422266:683325 fatal user error>
org.apache.openjpa.ut
il.UserException: A JDBC Driver or DataSource class name must be specified
in th
e ConnectionDriverName property.
        at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource
(DataSo
urceFactory.java:74)
        at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFa
ctory(JDBCConfigurationImpl.java:784)
        at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFacto
ry(JDBCConfigurationImpl.java:691).
        at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource
(JDBC
ConfigurationImpl.java:790)
        at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource2(JDB
CConfigurationImpl.java:797)
        at org.apache.openjpa.jdbc.schema.SchemaTool.<init>
(SchemaTool.java:127)

        at org.apache.openjpa.jdbc.meta.MappingTool.newSchemaTool
(MappingTool.ja
va:310)
        at org.apache.openjpa.jdbc.meta.MappingTool.record
(MappingTool.java:490)

        at org.apache.openjpa.jdbc.meta.MappingTool.run
(MappingTool.java:1075)
        at org.apache.openjpa.jdbc.ant.MappingToolTask.executeOn
(MappingToolTask
.java:205)
        at org.apache.openjpa.lib.ant.AbstractTask.execute
(AbstractTask.java:172
)
        ... 21 more
--- Nested Exception ---
C:\persist1\BUILD\include\jpa_common_build.xml:86:
<openjpa-1.2.0-r422266:683325
 fatal user error> org.apache.openjpa.util.UserException: A JDBC Driver or
DataS
ource class name must be specified in the ConnectionDriverName property.
        at org.apache.openjpa.lib.ant.AbstractTask.execute
(AbstractTask.java:176
)
        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.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets
(Project.java:1216)
        at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets
(Single
CheckExecutor.java:37)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
        at org.apache.tools.ant.taskdefs.CallTarget.execute
(CallTarget.java:107)

        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.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets
(Project.java:1216))
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets
(DefaultExe
cutor.java:40).
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: <openjpa-1.2.0-r422266:683325 fatal user error>
org.apache.openjpa.ut
il.UserException: A JDBC Driver or DataSource class name must be specified
in th
e ConnectionDriverName property.
        at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource
(DataSo
urceFactory.java:74)
        at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFa
ctory(JDBCConfigurationImpl.java:784)
        at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFacto
ry(JDBCConfigurationImpl.java:691).
        at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource
(JDBC
ConfigurationImpl.java:790)
        at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource2(JDB
CConfigurationImpl.java:797)
        at org.apache.openjpa.jdbc.schema.SchemaTool.<init>
(SchemaTool.java:127)

        at org.apache.openjpa.jdbc.meta.MappingTool.newSchemaTool
(MappingTool.ja
va:310)
        at org.apache.openjpa.jdbc.meta.MappingTool.record
(MappingTool.java:490)

        at org.apache.openjpa.jdbc.meta.MappingTool.run
(MappingTool.java:1075)
        at org.apache.openjpa.jdbc.ant.MappingToolTask.executeOn
(MappingToolTask
.java:205)
        at org.apache.openjpa.lib.ant.AbstractTask.execute
(AbstractTask.java:172
)
        ... 21 more


Heather Sterling
Systems Management Development
Phone:  919-254-7163 T/L: 444-7163
Cell: 919-423-3143
Email: hsterl@us.ibm.com


-- 
View this message in context: http://n2.nabble.com/can-generate-DDL-connectionless-from-cmdline-but-not-ant-task-tp2558026p2564351.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: can generate DDL connectionless from cmdline but not ant task

Posted by rpalache <ra...@oracle.com>.
Hi,

I verified the source code of MappingToolTask ( used by ant), the MappingToolTask in turn uses MappingTool ( used by cmd line). So I guess both should work exactly same.

Please make sure you use exactly same classpath both for cmdline and ant task.
Then you should see the same behavior from both cmdline and ant.

If you see different behavior even after taht, then can you please paste the output of cmdline also.

Regards,
Ravi.




Hi,

I consulted a bunch of the existing information regarding generating DDL
without a db connection.  I was able to successfully do this with 1.2 from
the cmdline, but it still tries to get a connection when I execute from the
ant task.  Both are pointed at the same persistence.xml and I have not
specified any db connection properties in the file.  The output looks the
same up until the very end when it tries to record the schema.  Is this a
known issue?

CMDLINE

C:\Documents and Settings\Administrator\workspace2\JPQLPrototype>java
-cp .;META
-INF\;"C:\openjpa\openjpa_binaries\apache-openjpa-1.2.0
\lib"\..\openjpa-1.2.0.ja
r;"C:\openjpa\openjpa_binaries\apache-openjpa-1.2.0
\lib"\commons-collections-3.2
.jar;"C:\openjpa\openjpa_binaries\apache-openjpa-1.2.0
\lib"\serp-1.13.1.jar;"C:\
openjpa\openjpa_binaries\apache-openjpa-1.2.0
\lib"\commons-lang-2.1.jar;"C:\open
jpa\openjpa_binaries\apache-openjpa-1.2.0
\lib"\geronimo-jpa_3.0_spec-1.0.jar;"C:
\openjpa\openjpa_binaries\apache-openjpa-1.2.0
\lib"\geronimo-jta_1.1_spec-1.1.ja
r;"C:\openjpa\derbyjars"\derbytools.jar;"C:\openjpa
\derbyjars"\derby.jar;"C:\ope
njpa\derbyjars"\derbyclient.jar;"C:\openjpa
\derbyjars"\derbynet.jar;"C:\openjpa\
derbyjars"\derbyrun.jar  org.apache.openjpa.jdbc.meta.MappingTool
-properties pe
rsistence.xml#jpqlprototype  -schemaAction build -sql create.sql
-DBDictionary d
erby


ANT

 <!-- Call this target to generate DDL for your persistent classes..  Note
that we may have to update this based on where we locate persistence.xml
files -->
 <target name="generateddl">
  <!-- define the mappingtool task -->
  <taskdef name="mappingtool"
classname="org.apache.openjpa.jdbc.ant.MappingToolTask">
      <classpath refid="jpa.tooling.classpath"/>
  </taskdef>

  <!-- invoke the mapping tool -->
  <mappingtool sqlFile="./create.sql" action="buildSchema">.
        <!-- This assumes the persistence.xml file is in the META-INF
directory of the plugin. -->
        <config propertiesFile="./META-INF/persistence.xml"
DBDictionary="derby" />
        <classpath refid="jpa.tooling.classpath"/>
  </mappingtool>
</target>



Exception

C:\persist1\BUILD\include\jpa_common_build.xml:86:
<openjpa-1.2.0-r422266:683325
 fatal user error> org.apache.openjpa.util.UserException: A JDBC Driver or
DataS
ource class name must be specified in the ConnectionDriverName property.
        at org.apache.tools.ant.ProjectHelper.addLocationToBuildException
(Projec
tHelper.java:539)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:384)
        at org.apache.tools.ant.taskdefs.CallTarget.execute
(CallTarget.java:107)

        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.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets
(Project.java:1216))
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets
(DefaultExe
cutor.java:40).
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: C:\persist1\BUILD\include\jpa_common_build.xml:86:
<openjpa-1.2.0-r42
2266:683325 fatal user error> org.apache.openjpa.util.UserException: A JDBC
Driv
er or DataSource class name must be specified in the ConnectionDriverName
proper
ty.
        at org.apache.openjpa.lib.ant.AbstractTask.execute
(AbstractTask.java:176
)
        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.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets
(Project.java:1216)
        at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets
(Single
CheckExecutor.java:37)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
        ... 13 more
Caused by: <openjpa-1.2.0-r422266:683325 fatal user error>
org.apache.openjpa.ut
il.UserException: A JDBC Driver or DataSource class name must be specified
in th
e ConnectionDriverName property.
        at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource
(DataSo
urceFactory.java:74)
        at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFa
ctory(JDBCConfigurationImpl.java:784)
        at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFacto
ry(JDBCConfigurationImpl.java:691).
        at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource
(JDBC
ConfigurationImpl.java:790)
        at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource2(JDB
CConfigurationImpl.java:797)
        at org.apache.openjpa.jdbc.schema.SchemaTool.<init>
(SchemaTool.java:127)

        at org.apache.openjpa.jdbc.meta.MappingTool.newSchemaTool
(MappingTool.ja
va:310)
        at org.apache.openjpa.jdbc.meta.MappingTool.record
(MappingTool.java:490)

        at org.apache.openjpa.jdbc.meta.MappingTool.run
(MappingTool.java:1075)
        at org.apache.openjpa.jdbc.ant.MappingToolTask.executeOn
(MappingToolTask
.java:205)
        at org.apache.openjpa.lib.ant.AbstractTask.execute
(AbstractTask.java:172
)
        ... 21 more
--- Nested Exception ---
C:\persist1\BUILD\include\jpa_common_build.xml:86:
<openjpa-1.2.0-r422266:683325
 fatal user error> org.apache.openjpa.util.UserException: A JDBC Driver or
DataS
ource class name must be specified in the ConnectionDriverName property.
        at org.apache.openjpa.lib.ant.AbstractTask.execute
(AbstractTask.java:176
)
        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.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets
(Project.java:1216)
        at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets
(Single
CheckExecutor.java:37)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
        at org.apache.tools.ant.taskdefs.CallTarget.execute
(CallTarget.java:107)

        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.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets
(Project.java:1216))
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets
(DefaultExe
cutor.java:40).
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: <openjpa-1.2.0-r422266:683325 fatal user error>
org.apache.openjpa.ut
il.UserException: A JDBC Driver or DataSource class name must be specified
in th
e ConnectionDriverName property.
        at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource
(DataSo
urceFactory.java:74)
        at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFa
ctory(JDBCConfigurationImpl.java:784)
        at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFacto
ry(JDBCConfigurationImpl.java:691).
        at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource
(JDBC
ConfigurationImpl.java:790)
        at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource2(JDB
CConfigurationImpl.java:797)
        at org.apache.openjpa.jdbc.schema.SchemaTool.<init>
(SchemaTool.java:127)

        at org.apache.openjpa.jdbc.meta.MappingTool.newSchemaTool
(MappingTool.ja
va:310)
        at org.apache.openjpa.jdbc.meta.MappingTool.record
(MappingTool.java:490)

        at org.apache.openjpa.jdbc.meta.MappingTool.run
(MappingTool.java:1075)
        at org.apache.openjpa.jdbc.ant.MappingToolTask.executeOn
(MappingToolTask
.java:205)
        at org.apache.openjpa.lib.ant.AbstractTask.execute
(AbstractTask.java:172
)
        ... 21 more


Heather Sterling
Systems Management Development
Phone:  919-254-7163 T/L: 444-7163
Cell: 919-423-3143
Email: hsterl@us.ibm.com


-- 
View this message in context: http://n2.nabble.com/can-generate-DDL-connectionless-from-cmdline-but-not-ant-task-tp2558026p2564275.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.