You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by sa...@04web.com on 2004/06/18 17:33:46 UTC

+1 outdated info?

  Thanks Tom but now I am having another problem :(

 When using this task I am receiving a

"
   The 'project-sql' target is deprecated. Please use the 'sql' target
instead.
"

  Velocity continues anyway but after some instructions it gives me a:
"
build-torque.xml:214: Exception thrown by 'properties.load'. For more
information consult the velocity log, or invoke ant with the -debug flag.
"
  (the error is the same if I use the undeprecate sql target)

  The velocity report last logs

2004-06-18 16:00:27,459 - Velocimacro : initialization complete.
2004-06-18 16:00:27,459 - Velocity successfully started.
2004-06-18 16:00:27,912 - ResourceManager : found sql/base/Control.vm with
loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
2004-06-18 16:00:27,927 - Method load threw exception for reference
$properties in template sql/base/Control.vm at  [2,19]

  I have been looking for the sql/base/Control.vm and found it inside the
Torque jar (this was different from the previous versions of Torque :( )
  I think it is this line...

#set ( $dbprops = $properties.load("sql/base/$targetDatabase/db.props") )

  I checked the OJB documentation and I verified that these statements
were on my build.xml.

    <property file="build.properties"/>
    <property file="mysql.profile"/>
    <!--
      shouldn't this be     <property file="profile/mysql.profile"/>
      I tried both alternatives and the error continued to persist
     -->

  These were included... next

  I tried adding the properties directly to the target

        <ant dir="${plugin.ojb}"
            antfile="build-torque.xml"
            target="project-sql">

            <property file="build.properties"/>
            <property file="profile/mysql.profile"/>

            ...
        </ant>
    </target>

  didn't work either

  Tried uncommenting the mysql.profile line on the build.properties and
that didnt work either.

  I am really making an effort here to solve this one by my own but I am
becoming out of ideas.

  Thank you,

Pedro Salgado








---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: +1 outdated info?

Posted by Thomas Dudziak <to...@first.fhg.de>.
Pedro Salgado wrote:

> In the documentation:
> 
> <path id="build-classpath">
>     <fileset dir="lib/xdoclet"><!-- HERE -->
>         <include name="**/*.jar"/>
>     </fileset>
> </path>

I'll change that.

> I didn't realize there was a project-blank to startup with :(.
> Sorry for the wasted time.

No problem, that there is a ojb-blank has become clearer with the new 
documentation.

Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: +1 outdated info?

Posted by Pedro Salgado <sa...@04web.com>.
On 04/06/20 9:59, "Thomas Dudziak" <to...@first.fhg.de> wrote:

> Pedro Salgado wrote:
> 
>>   Another problem:
>>   The classpath element should include all of the libs required to run
>> xdoclet (not only the xdoclet*.jar, but also xjavadoc and the dependencies
>> like commons-collections, etc)... Since I don¹t really know the dependencies
>> it is better to include all stuff on the ojb/lib directory.
>> 
>>     <path id="classpath.ojb">
>>         <fileset dir="${tool.ojb}/lib">
>>             <include name="**/*.jar"/>
>>         </fileset>
>>     </path>

In the documentation:

<path id="build-classpath">
    <fileset dir="lib/xdoclet"><!-- HERE -->
        <include name="**/*.jar"/>
    </fileset>
</path>

> 
> Yes, but it does so in every build file in OJB ?! That's the common way
> to specify the classpath with Ant.
> 
>>   The rest well... Your property file seems to have made wonders but... I
>> think it bypassed the problems (this good... in a way).
>>   Still:
>> 
>>   - the database name that I insert on your cvs build.properties must exist
>> because otherwise I get a SQLException on executing the target create-db,
>>   - the SQLException is also thrown if I don¹t use the cvs build.properties
>> (see below),
>>   - I needed to add torque.schema.dir and torque.sql.dir (schemaDir and
>> outputDirectory didn¹t work... ) to the torque ant calls.
>>   - Torque is using the driver and database connection settings that are
>> specified on the mysql.profile that, of course are different from the ones I
>> specified on the cvs  build.properties. Question: why are these cvs
>> build.properties settings:
>> 
>> dbmsName=MySQL
>> jdbcLevel=3.0
>> jdbcRuntimeDriver=com.mysql.jdbc.Driver
>> urlProtocol=jdbc
>> urlSubprotocol=mysql
>> urlDbalias=//localhost/${databaseName}
>> 
>>  doing?).
>>   It seems that I need to setup my database settings on the mysql.profile
>> (correct me if I am wrong).
> 
> You're essentially mixing up two different things here. The two files
> that I pointed you to, are the build files of the ojb-blank project
> which is a skeleton project for users to get started with OJB. As such
> this project only requires the configuration for one database which is
> quite different from OJB whose unit tests shall run under every
> supported database. Therefore, the build script for the ojb-blank
> project only needs build.properties which contains among other stuff the
> database settings. The OJB build file on the other hand also requires
> profiles for the individual databases, and its build.properties file
> only references the profile to use but otherwise doesn't contain any
> database settings. My advise is that you're better off with the
> ojb-blank build files as a starting point because most of the stuff in
> OJB's build files shouldn't be relevant for you.
> 
> The other problem that the setup-db target (in the ojb-blank build
> script) solves, is that the Torque settings are not used by OJB, so we
> have to setup the environment for Torque before using its build file to
> create the database etc. This is essentially what the setup-db task
> does. However, as I can see from your build file, you used the old stuff
> from the XDoclet docs (which I changed in CVS) but not the changed stuff
> from the ojb-blank build script (setup-db target). You should use the
> latter because Torque now requires some more settings that we have to
> supply prior to calling any targets in the Torque build file.
> 
> 
>>   There is no problem with this... I just wonder what does the cvs
>> properties sets up after all? If I removed them then the following exception
>> appears:
>> 
>> Target create-db
>> Task torque-data-model
>> Task echo
>> Task sql
>> build-torque.xml:321: java.sql.SQLException: General error,  message from
>> server: "Unknown database 'ojb'"
>> 
>>   This shouldn't appear because:
>>   1- I am not using a database yet... I want to create the required database
>> if it doesn¹t exist
>>   2- anyway, the database name should come from the schema file
> 
> In the ojb-blank file, you define the database name in the
> build.properties file, and the build script will setup both the jdbc
> connection descriptor and the schema file (via the xdoclet target) with
> the correct name.
> 
>>   3- I don't have an ojb value for any of the properties I set (not on my
>> build.xml, not on my cvs build.properties, not even on the mysql.profile)
>> where does this "ojb" come from?
>> 
>> 
>>   Below is my working build.xml file.
>>   It is still missing the repository.xml and repository_database.xml
>> generation.
> 
> Please use the ojb-blank build files as the basis for your project, not
> OJB's build files. This will make it a lot easier for you.

I didn't realize there was a project-blank to startup with :(.
Sorry for the wasted time.


Thank you Tom,

Pedro Salgado



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: +1 outdated info?

Posted by Thomas Dudziak <to...@first.fhg.de>.
Pedro Salgado wrote:

>   Another problem:
>   The classpath element should include all of the libs required to run
> xdoclet (not only the xdoclet*.jar, but also xjavadoc and the dependencies
> like commons-collections, etc)... Since I don¹t really know the dependencies
> it is better to include all stuff on the ojb/lib directory.
> 
>     <path id="classpath.ojb">
>         <fileset dir="${tool.ojb}/lib">
>             <include name="**/*.jar"/>
>         </fileset>
>     </path>

Yes, but it does so in every build file in OJB ?! That's the common way 
to specify the classpath with Ant.

>   The rest well... Your property file seems to have made wonders but... I
> think it bypassed the problems (this good... in a way).
>   Still:
> 
>   - the database name that I insert on your cvs build.properties must exist
> because otherwise I get a SQLException on executing the target create-db,
>   - the SQLException is also thrown if I don¹t use the cvs build.properties
> (see below),
>   - I needed to add torque.schema.dir and torque.sql.dir (schemaDir and
> outputDirectory didn¹t work... ) to the torque ant calls.
>   - Torque is using the driver and database connection settings that are
> specified on the mysql.profile that, of course are different from the ones I
> specified on the cvs  build.properties. Question: why are these cvs
> build.properties settings:
> 
> dbmsName=MySQL
> jdbcLevel=3.0
> jdbcRuntimeDriver=com.mysql.jdbc.Driver
> urlProtocol=jdbc
> urlSubprotocol=mysql
> urlDbalias=//localhost/${databaseName}
> 
>  doing?).
>   It seems that I need to setup my database settings on the mysql.profile
> (correct me if I am wrong).

You're essentially mixing up two different things here. The two files 
that I pointed you to, are the build files of the ojb-blank project 
which is a skeleton project for users to get started with OJB. As such 
this project only requires the configuration for one database which is 
quite different from OJB whose unit tests shall run under every 
supported database. Therefore, the build script for the ojb-blank 
project only needs build.properties which contains among other stuff the 
database settings. The OJB build file on the other hand also requires 
profiles for the individual databases, and its build.properties file 
only references the profile to use but otherwise doesn't contain any 
database settings. My advise is that you're better off with the 
ojb-blank build files as a starting point because most of the stuff in 
OJB's build files shouldn't be relevant for you.

The other problem that the setup-db target (in the ojb-blank build 
script) solves, is that the Torque settings are not used by OJB, so we 
have to setup the environment for Torque before using its build file to 
create the database etc. This is essentially what the setup-db task 
does. However, as I can see from your build file, you used the old stuff 
from the XDoclet docs (which I changed in CVS) but not the changed stuff 
from the ojb-blank build script (setup-db target). You should use the 
latter because Torque now requires some more settings that we have to 
supply prior to calling any targets in the Torque build file.


>   There is no problem with this... I just wonder what does the cvs
> properties sets up after all? If I removed them then the following exception
> appears:
> 
> Target create-db
> Task torque-data-model
> Task echo
> Task sql
> build-torque.xml:321: java.sql.SQLException: General error,  message from
> server: "Unknown database 'ojb'"
> 
>   This shouldn't appear because:
>   1- I am not using a database yet... I want to create the required database
> if it doesn¹t exist
>   2- anyway, the database name should come from the schema file

In the ojb-blank file, you define the database name in the 
build.properties file, and the build script will setup both the jdbc 
connection descriptor and the schema file (via the xdoclet target) with 
the correct name.

>   3- I don't have an ojb value for any of the properties I set (not on my
> build.xml, not on my cvs build.properties, not even on the mysql.profile)
> where does this "ojb" come from?
> 
> 
>   Below is my working build.xml file.
>   It is still missing the repository.xml and repository_database.xml
> generation.

Please use the ojb-blank build files as the basis for your project, not 
OJB's build files. This will make it a lot easier for you.

>   I am reasonably acquainted with Torque (done severall repository and
> transfer object generations would minor settings/problems that I was able to
> solve by my own) and this Xdoclet approach is better but, this OJB-Torque
> integration still needs a whole lot of testing and documentation :(.

Some of the Torque recently changed and the doc on the website is not 
yet up-to-date (as you correctly pointed out). However, the usage of 
Torque within OJB is limited and will likely be replaced with something 
more usable in the the near future (after the 1.0) because using 
Torque's build file is complicated.

Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: +1 outdated info?

Posted by Pedro Salgado <sa...@04web.com>.
  Another problem:
  The classpath element should include all of the libs required to run
xdoclet (not only the xdoclet*.jar, but also xjavadoc and the dependencies
like commons-collections, etc)... Since I don¹t really know the dependencies
it is better to include all stuff on the ojb/lib directory.

    <path id="classpath.ojb">
        <fileset dir="${tool.ojb}/lib">
            <include name="**/*.jar"/>
        </fileset>
    </path>


  The rest well... Your property file seems to have made wonders but... I
think it bypassed the problems (this good... in a way).
  Still:

  - the database name that I insert on your cvs build.properties must exist
because otherwise I get a SQLException on executing the target create-db,
  - the SQLException is also thrown if I don¹t use the cvs build.properties
(see below),
  - I needed to add torque.schema.dir and torque.sql.dir (schemaDir and
outputDirectory didn¹t work... ) to the torque ant calls.
  - Torque is using the driver and database connection settings that are
specified on the mysql.profile that, of course are different from the ones I
specified on the cvs  build.properties. Question: why are these cvs
build.properties settings:

dbmsName=MySQL
jdbcLevel=3.0
jdbcRuntimeDriver=com.mysql.jdbc.Driver
urlProtocol=jdbc
urlSubprotocol=mysql
urlDbalias=//localhost/${databaseName}

 doing?).
  It seems that I need to setup my database settings on the mysql.profile
(correct me if I am wrong).

  There is no problem with this... I just wonder what does the cvs
properties sets up after all? If I removed them then the following exception
appears:

Target create-db
Task torque-data-model
Task echo
Task sql
build-torque.xml:321: java.sql.SQLException: General error,  message from
server: "Unknown database 'ojb'"

  This shouldn't appear because:
  1- I am not using a database yet... I want to create the required database
if it doesn¹t exist
  2- anyway, the database name should come from the schema file
  3- I don't have an ojb value for any of the properties I set (not on my
build.xml, not on my cvs build.properties, not even on the mysql.profile)
where does this "ojb" come from?


  Below is my working build.xml file.
  It is still missing the repository.xml and repository_database.xml
generation.

  I am reasonably acquainted with Torque (done severall repository and
transfer object generations would minor settings/problems that I was able to
solve by my own) and this Xdoclet approach is better but, this OJB-Torque
integration still needs a whole lot of testing and documentation :(.

Thank you for your help and sorry for the long email,

Pedro Salgado

<project default="repository-files">
    <!-- OJB tool blank project properties -->
    <property file="build.properties"/>


    <!-- Project specific properties -->

    <property name="dir.src" location="src"/>
    <property name="dir.java" location="${dir.src}/java"/>
    <property name="dir.sql" location="${dir.src}/sql"/>


    <!-- Metadata information -->

    <property name="dir.commons.validator"
location="${dir.src}/metadata/commons/validator"/>
    <property name="dir.horizon" location="${dir.src}/metadata/horizon"/>
    <property name="dir.ojb"     location="${dir.src}/metadata/ojb"/>
    <property name="dir.struts"  location="${dir.src}/metadata/struts"/>
    <property name="dir.taglibs" location="${dir.src}/metadata/taglibs"/>
    <property name="dir.tiles"   location="${dir.src}/metadata/tiles"/>
    <property name="dir.tomcat"  location="${dir.src}/metadata/tomcat"/>


    <!-- Code generation tools -->

    <property name="dir.tools" location="tools"/>

    <property
        name="tool.ojb"
        location="${dir.tools}/db-ojb-1.0.rc7"
        description="OJB/Torque/XDoclet code generation tool location."
    />

    <!-- OJB/Torque/XDoclet -->

    <property file="${tool.ojb}/profile/mysql.profile"/>

    <path id="classpath.ojb"
        description="The classpath to be used with the OJB model generation
tool."
    >
        <fileset dir="${tool.ojb}/lib">
            <include name="**/*.jar"/>
        </fileset>
    </path>



    <!-- Project: targets -->


    <!-- OJB/Torque/XDoclet/ tool: targets -->

    <target name="repository-files"
        description="Generates OJB and Torque metadata."
        >

        <taskdef name="ojbdoclet"
            classname="xdoclet.modules.ojb.OjbDocletTask"
            classpathref="classpath.ojb"/>

        <ojbdoclet destdir="${dir.ojb}">
            <fileset dir="${dir.java}"/>
            <ojbrepository destinationFile="repository_project.xml"/>
            <torqueschema databaseName="dbname"
destinationFile="project-schema.xml"/>
        </ojbdoclet>

    </target>

    <target name="init-db"
        description="Generates the SQL statements and creates the database
and tables."
        depends="repository-files"
        >

        <ant dir="${tool.ojb}"
            antfile="build-torque.xml"
            target="create-db"
            >
            <property name="torque.schema.dir" value="${dir.ojb}"/>
            <property name="torque.sql.dir" value="${dir.sql}"/>
        </ant>

        <ant dir="${tool.ojb}"
            antfile="build-torque.xml"
            target="sql"
            >
            <property name="torque.schema.dir" value="${dir.ojb}"/>
            <property name="torque.sql.dir" value="${dir.sql}"/>
        </ant>

        <ant dir="${tool.ojb}"
            antfile="build-torque.xml"
            target="insert-sql"
            >
            <property name="torque.schema.dir" value="${dir.java}"/>
            <property name="torque.sql.dir" value="${dir.sql}"/>
        </ant>

    </target>

</project>


> 
> http://cvs.apache.org/viewcvs.cgi/db-ojb/src/ojb-blank/build.xml?rev=1.2&view=
> markup
> http://cvs.apache.org/viewcvs.cgi/db-ojb/src/ojb-blank/build.properties?rev=1.
> 2&view=markup
> 
> Tom
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: +1 outdated info?

Posted by Thomas Dudziak <to...@first.fhg.de>.
salgado.pc@04web.com wrote:
>   Thanks Tom but now I am having another problem :(
> 
>  When using this task I am receiving a
> 
> "
>    The 'project-sql' target is deprecated. Please use the 'sql' target
> instead.
> "
> 
>   Velocity continues anyway but after some instructions it gives me a:
> "
> build-torque.xml:214: Exception thrown by 'properties.load'. For more
> information consult the velocity log, or invoke ant with the -debug flag.
> "
>   (the error is the same if I use the undeprecate sql target)
> 
>   The velocity report last logs
> 
> 2004-06-18 16:00:27,459 - Velocimacro : initialization complete.
> 2004-06-18 16:00:27,459 - Velocity successfully started.
> 2004-06-18 16:00:27,912 - ResourceManager : found sql/base/Control.vm with
> loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
> 2004-06-18 16:00:27,927 - Method load threw exception for reference
> $properties in template sql/base/Control.vm at  [2,19]
> 
>   I have been looking for the sql/base/Control.vm and found it inside the
> Torque jar (this was different from the previous versions of Torque :( )
>   I think it is this line...
> 
> #set ( $dbprops = $properties.load("sql/base/$targetDatabase/db.props") )
> 
>   I checked the OJB documentation and I verified that these statements
> were on my build.xml.
> 
>     <property file="build.properties"/>
>     <property file="mysql.profile"/>
>     <!--
>       shouldn't this be     <property file="profile/mysql.profile"/>
>       I tried both alternatives and the error continued to persist
>      -->
> 
>   These were included... next
> 
>   I tried adding the properties directly to the target
> 
>         <ant dir="${plugin.ojb}"
>             antfile="build-torque.xml"
>             target="project-sql">
> 
>             <property file="build.properties"/>
>             <property file="profile/mysql.profile"/>
> 
>             ...
>         </ant>
>     </target>
> 
>   didn't work either
> 
>   Tried uncommenting the mysql.profile line on the build.properties and
> that didnt work either.
> 
>   I am really making an effort here to solve this one by my own but I am
> becoming out of ideas.

Yesterday, I enhanced the ojb-blank build file with an xdoclet and 
torque target which you'll might find useful. You can view it here:

http://cvs.apache.org/viewcvs.cgi/db-ojb/src/ojb-blank/build.xml?rev=1.2&view=markup
http://cvs.apache.org/viewcvs.cgi/db-ojb/src/ojb-blank/build.properties?rev=1.2&view=markup

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org