You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Joseph Edward Boniakowski <jb...@cs.brown.edu> on 2002/01/14 22:11:45 UTC

torque-3.0-dev standalone problems (MySQL, OS X)

I've used turbine in the past and I've loved using it.  Thanks to all the
developers for making it possible generate the outlines of a database
driven web app in 10 minutes.

This is the first time I've tried to use Torque on it's own and I'm a
little unclear on things.  So far, I've built torque from the source in
CVS and unzipped it somewheres else.  

>From there, I'm trying to use the schema that it comes with about the
interplanetary civilizations.  I changed the lines torque.database.* in
Torque.properties to reflect my configuration (which works with the TDK
and with plain JDBC stuff).

I wrote a simple Test class:
public class Test{
 public static void main(String[] args){
  try{
   Torque.init("Torque.properties");
   Civilization c =  new Civilization();
   c.setName("Babel");
   c.save();
  } catch(Exception e){

Now we get into things I don't understand.  Where does Torque normally
find org.gjt.mm.mysql.Driver if the mm jar isn't explicity in the
classpath?  Cause if I don't have it in the classpath, the code exits with
a "DBConnection is null" exception, but it doesn't ever complain about not
being able to load the class.  Is this a case of one "class not found" ex
being caught and some other exception being thrown?

If I do have it in the classpath ("mm.mysql-2.0.7-bin.jar"), I get a null
pointer exception from BasePeer line 765.  At this line, there's code like
this:

        DatabaseMap dbMap = Torque.getDatabaseMap( criteria.getDbName() );
        System.out.println("dbMap: " + dbMap);
        TableMap tableMap = dbMap.getTable(tableName);
        System.out.println("tableMap: " +tableMap);
        Object keyInfo = tableMap.getPrimaryKeyMethodInfo();

When this is run, dbMap is non-null, but tableMap is.  I don't really
understand what is happening here, but it looks like torque's trying to
get some info on the table Civilization, and is being told that there is
no table Civilization.  In the db, there is.  And in the schema, there is.
And in the Peer class directory, there are all the right classes.  What
should I be looking for here?

Also, I personally was a bit confused when I decided to use Torque on it's
own about torque-2.1 and the torque in CVS.  If you look at the docs on
the webpage, it doesn't say anything about either, it just says "torque
has been decoupled from turine and the decoupled version will be used from
2.2 on".  If you read the mailing list archives though, you find a million
people saying, "don't use 2.1, get the version from cvs and build it."
Maybe a note about this would be in order?  If I personally feel the
documentation has a shortcoming, is the generally encouraged practice
"make whatever change you want to the xdoc and mail it to turbine-dev and
see what they think"?

Thanks,
jeb.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: torque-3.0-dev standalone problems (MySQL, OS X)

Posted by Eric Dobbs <er...@dobbse.net>.
On Wednesday, January 16, 2002, at 05:57  PM, Pete Kazmier wrote:

> Not to worry, its an xdoc!  I read all about jakarta-site2 when I
> started to contribute documentation changes to Velocity.  BTW, I've
> taken such a liking to jakarta-site2 that I use it to build pages for
> static content at work too!

Then you'll find this a receptive audience for your documentation
offerings.  And thanks in advance!
-Eric


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: torque-3.0-dev standalone problems (MySQL, OS X)

Posted by Pete Kazmier <pe...@kazmier.com>.
Not to worry, its an xdoc!  I read all about jakarta-site2 when I
started to contribute documentation changes to Velocity.  BTW, I've
taken such a liking to jakarta-site2 that I use it to build pages for
static content at work too!

On Wed, Jan 16, 2002 at 03:19:37PM -0700, Eric Dobbs wrote:
> On Tuesday, January 15, 2002, at 03:20  AM, Pete Kazmier wrote:
> 
> > I got stuck Sunday evening, so as a peace offering :), before I posted
> > my questions to the mailing list, I decided to start the creation of a
> > standalone Torque tutorial that hopefully might someday be included on
> > the Torque pages for new users like me.
> ...
> > http://www.kazmier.com/~kaz/torque [click on tutorial link in Guides]
> 
> Are you writing the tutorial as an xdoc and building the docs
> that you posted at that link?  In other words, have you read
> the last section of these instructions about Turbine
> documentation?
> 
> http://jakarta.apache.org/turbine/common/documentation.html
> this too: http://jakarta.apache.org/site/jakarta-site2.html
> 
> If you submit an xdoc, chances are good it'll get added to the
> site.  Documentation contributions are very welcome, but the
> committers are often too busy to convert submissions to xdoc.
> So if you offer an xdoc, it can be committed quickly.
> 
> -Eric
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 

-- 
Peter Kazmier                                 http://www.kazmier.com
PGP Fingerprint   4FE7 8DA3 D0B5 9CAA 69DC  7243 1855 BC2E 4B43 5654

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: torque-3.0-dev standalone problems (MySQL, OS X)

Posted by Eric Dobbs <er...@dobbse.net>.
On Tuesday, January 15, 2002, at 03:20  AM, Pete Kazmier wrote:

> I got stuck Sunday evening, so as a peace offering :), before I posted
> my questions to the mailing list, I decided to start the creation of a
> standalone Torque tutorial that hopefully might someday be included on
> the Torque pages for new users like me.
...
> http://www.kazmier.com/~kaz/torque [click on tutorial link in Guides]

Are you writing the tutorial as an xdoc and building the docs
that you posted at that link?  In other words, have you read
the last section of these instructions about Turbine
documentation?

http://jakarta.apache.org/turbine/common/documentation.html
this too: http://jakarta.apache.org/site/jakarta-site2.html

If you submit an xdoc, chances are good it'll get added to the
site.  Documentation contributions are very welcome, but the
committers are often too busy to convert submissions to xdoc.
So if you offer an xdoc, it can be committed quickly.

-Eric

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: torque-3.0-dev standalone problems (MySQL, OS X)

Posted by Pete Kazmier <pe...@kazmier.com>.
On Mon, Jan 14, 2002 at 04:11:45PM -0500, Joseph Edward Boniakowski wrote:
> I wrote a simple Test class:
> public class Test{
>  public static void main(String[] args){
>   try{
>    Torque.init("Torque.properties");
>    Civilization c =  new Civilization();
>    c.setName("Babel");
>    c.save();
>   } catch(Exception e){
>
> [snip]
> 
> If I do have it in the classpath ("mm.mysql-2.0.7-bin.jar"), I get a null
> pointer exception from BasePeer line 765.  At this line, there's code like
> this:
> 
>         DatabaseMap dbMap = Torque.getDatabaseMap( criteria.getDbName() );
>         System.out.println("dbMap: " + dbMap);
>         TableMap tableMap = dbMap.getTable(tableName);
>         System.out.println("tableMap: " +tableMap);
>         Object keyInfo = tableMap.getPrimaryKeyMethodInfo();

I'd be interested in hearing responses to this as well, I'm using a
bookstore in my test, but the error is the same (RH7.2, Torque3-dev,
MySQL).  I am having the same problem as well.  When I call c.save(), I
get the following stack trace:

java.lang.NullPointerException
        at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:762)
        at com.kazmier.om.BaseAuthorPeer.doInsert(BaseAuthorPeer.java:169)
        at com.kazmier.om.BaseAuthorPeer.doInsert(BaseAuthorPeer.java:435)
        at com.kazmier.om.BaseAuthor.save(BaseAuthor.java:337)
        at com.kazmier.om.BaseAuthor.save(BaseAuthor.java:302)
        at com.kazmier.om.BaseAuthor.save(BaseAuthor.java:285)
        at com.kazmier.MyTest.main(MyTest.java:19)

However, if I replace c.save(), with AutherPeer.doInsert(c), everything
works ok.  So I would speculate that if you replace your c.save() with
CivilizationPeer.doInsert(c), that it would work.  Torque is completely
new to me, but I was able to build the source, get it to create my
database, but I get stuck with my simple test app.  Any suggestions?
I've searched the archives for help, but I haven't found anything yet.

In addition, I am also a little confused with the concept of the
"default" database in the Torque properties file.  I explicitly set the
database name in my schema file, then added appropriate lines to my
torque properties file, but the id-table-schema.xml doesn't explicitly
define a database name in the <database> tag, so in my sql/create-db.sql
file, I had a lines like this:

drop database if exists default;
create database default;
drop database if exists bookstore;
create database bookstore;

I'm using MySQL and it seems that MySQL gags on the keyword "default".
So I just added a name to the id-table-schema <database> tag to be
"bookstore" and everything was ok.  Is this what I should do?  Or is the
behavior I saw the result of an error on my part?

> Also, I personally was a bit confused when I decided to use Torque on it's
> own about torque-2.1 and the torque in CVS.  If you look at the docs on
> the webpage, it doesn't say anything about either, it just says "torque
> has been decoupled from turine and the decoupled version will be used from
> 2.2 on".  If you read the mailing list archives though, you find a million
> people saying, "don't use 2.1, get the version from cvs and build it."
> Maybe a note about this would be in order?  If I personally feel the
> documentation has a shortcoming, is the generally encouraged practice
> "make whatever change you want to the xdoc and mail it to turbine-dev and
> see what they think"?

I got stuck Sunday evening, so as a peace offering :), before I posted
my questions to the mailing list, I decided to start the creation of a
standalone Torque tutorial that hopefully might someday be included on
the Torque pages for new users like me.  I was going to complete as much
as possible before posting to prove that I am not just a leech, but when
I saw this post, I figured I'd chime in here.  To prove that I'm not
blowing smoke, here is the start of the tutorial and the general outline
of it.  Once I get my first Torque app running, I should be able to
complete it.  

http://www.kazmier.com/~kaz/torque [click on tutorial link in Guides]

Any comments would be welcome, there isn't much there yet, but I tried
to outline what I thought would be in the tutorial, if I am missing
something, then let me know.

Thanks!
Pete

-- 
Peter Kazmier                                 http://www.kazmier.com
PGP Fingerprint   4FE7 8DA3 D0B5 9CAA 69DC  7243 1855 BC2E 4B43 5654

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>