cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amir Azmi" <>
Subject RE: Add action not working????
Date Fri, 02 Mar 2001 01:27:09 GMT
I have latest C2 CVS release, when I tried to run the sample for actions
provided in "employee.xsp" file, I was constantly getting NULL pointer
exception when I tried the "Add" action. Finally I managed putting it to
work. Following was the code that was originally their in the while loop
within "Act" method of "DatabaseAddAction" class,

            while (keys.hasNext()) {
                Configuration key = (Configuration);
                if ("manual".equals(key.getAttribute("mode",
"automatic"))) {
                    String selectQuery = this.getSelectQuery(key);

                    ResultSet set =
                    int value = set.getInt("maxid") + 1;

                    statement.setInt(currentIndex, value);



Now I think NULL pointer exception was been thrown 'coz "set" resultset
was being closed first and then the statement associated with it. So
just by swapping the position of those two statements sample worked for

Please correct me if I am wrong and did anyone had same code woking in
postgre(if yes then why do u think u didn't get an error).


-----Original Message-----
From: Berin Loritsch []
Sent: Thursday, March 01, 2001 8:41 AM
Subject: Re: Add action not working????

Allan Erskine wrote:
> how are your database tables set up?  On my postgres database I was
> the serial (autonumbering) type for my id column and had this problem
> Try changing the keys element in employee.xml to read
>     <keys>
>       <key param="employee" dbcol="id" type="int" mode="automatic"/>
>     </keys>
> or whatever's appropriate for your database.

Another thing is to make sure that your Driver allows you to use
explicit transactions.  I know that SQLServer2000 the database
can handle them, but the JdbcOdbcBridge driver won't.  You really
need a JDBC 2.0 compliant driver.

To unsubscribe, e-mail:
For additional commands, email:

View raw message