You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Dominic Reynolds <do...@lantnern.com> on 2002/07/29 22:23:52 UTC

ESQL erros - cocoon2.0.3

I am trying to use ESQL (basic xsp page modelled on the samples).

my problem is that I get the following null pointer exception:

Original exception : java.lang.NullPointerException
        at 
org.apache.cocoon.components.language.markup.xsp.EsqlQuery.&lt;init&gt;(EsqlQuery.java:99)


And looking at the source it seems that I'm not passing a connection to 
the constructor:
Esql.java -

 public EsqlQuery( EsqlConnection connection, String query ) {
    this.connection = connection;
    this.limitMethod = connection.getLimitMethod();   << line 99


Now looking at the generated java code for my xsp:
cocoon-files/org/apache/cocoon/www/upgrades/docs/upgrade_xsp.java
is see:

  private EsqlConnectionCocoon2 _esql_connection = null;
// .
// . some non-connection related java stuff......
// .
 _esql_query = new EsqlQuery( _esql_connection, String.valueOf(
      ""       + "SELECT guid FROM appliances WHERE guid="                +
        (request.getHeader("guid"))
      ) );


So the generated java code is incorrect. I know the datasource i'm using 
is ok as I am using it in an action and it works fine.
I must be doing something wrong here...but what?

Below is the xsp that is called:

<?xml version="1.0"?>
<xsp:page
      language="java"
      xmlns:xsp="http://apache.org/xsp"
      xmlns:esql="http://apache.org/cocoon/SQL/v2"
      xmlns:xsp-request="http://apache.org/xsp/request/2.0"
    >
    <esql:connection>
      <esql:pool>regdata</esql:pool>
      <esql:execute-query>
        <esql:query>SELECT guid FROM appliances WHERE 
guid=<xsp-request:get-header name="guid"/></esql:query>
        <esql:results>
          <table>
            <esql:row-results>
              <tr>
                 <td><esql:get-string column="product"/></td>
                 <!--
 <xsp:attribute name="value"><esql:get-string column="id"/></xsp:attribute>
                 -->
              </tr>
            </esql:row-results>
          </table>
   </esql:results>
        <esql:no-results>
           <p>Sorry No record</p>
        </esql:no-results>
      </esql:execute-query>
    </esql:connection>
</xsp:page>





---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

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


Re: ESQL erros - cocoon2.0.3

Posted by Dominic Reynolds <do...@lantnern.com>.
Chris,
  I have attached the output (including stack trace).

  I haven't got any esql to work. I even tried not using the datasource 
(even though it works in the actions i've created) and include the esql 
tags for drive, url, username etc. and the reult is the same: the 
compiled java doesn't seem to be supplying an ESQLConnection reference 
(thats intantiated) to the ESQLQuery class.

Thanks for your help,
dominic.

Christian Haul wrote:

>On 29.Jul.2002 -- 01:23 PM, Dominic Reynolds wrote:
>  
>
>> I am trying to use ESQL (basic xsp page modelled on the samples).
>>
>>my problem is that I get the following null pointer exception:
>>
>>Original exception : java.lang.NullPointerException
>>       at 
>>org.apache.cocoon.components.language.markup.xsp.EsqlQuery.&lt;init&gt;(EsqlQuery.java:99)
>>
>>
>>And looking at the source it seems that I'm not passing a connection to 
>>the constructor:
>>Esql.java -
>>
>>public EsqlQuery( EsqlConnection connection, String query ) {
>>   this.connection = connection;
>>   this.limitMethod = connection.getLimitMethod();   << line 99
>>
>>
>>Now looking at the generated java code for my xsp:
>>cocoon-files/org/apache/cocoon/www/upgrades/docs/upgrade_xsp.java
>>is see:
>>
>> private EsqlConnectionCocoon2 _esql_connection = null;
>>// .
>>// . some non-connection related java stuff......
>>// .
>>_esql_query = new EsqlQuery( _esql_connection, String.valueOf(
>>     ""       + "SELECT guid FROM appliances WHERE guid="                +
>>       (request.getHeader("guid"))
>>     ) );
>>
>>
>>So the generated java code is incorrect. I know the datasource i'm using 
>>is ok as I am using it in an action and it works fine.
>>I must be doing something wrong here...but what?
>>    
>>
>
>Everything looks fine. Could you produce a complete stack trace?
>Other XSPs using esql work fine, right?
>
>  
>
>>Below is the xsp that is called:
>>
>><?xml version="1.0"?>
>><xsp:page
>>     language="java"
>>     xmlns:xsp="http://apache.org/xsp"
>>     xmlns:esql="http://apache.org/cocoon/SQL/v2"
>>     xmlns:xsp-request="http://apache.org/xsp/request/2.0"
>>   >
>>   <esql:connection>
>>     <esql:pool>regdata</esql:pool>
>>     <esql:execute-query>
>>       <esql:query>SELECT guid FROM appliances WHERE 
>>guid=<xsp-request:get-header name="guid"/></esql:query>
>>       <esql:results>
>>         <table>
>>           <esql:row-results>
>>             <tr>
>>                <td><esql:get-string column="product"/></td>
>>                <!--
>><xsp:attribute name="value"><esql:get-string column="id"/></xsp:attribute>
>>             </tr>
>>           </esql:row-results>
>>         </table>
>>  </esql:results>
>>       <esql:no-results>
>>          <p>Sorry No record</p>
>>       </esql:no-results>
>>     </esql:execute-query>
>>   </esql:connection>
>></xsp:page>
>>    
>>
>
>	Chris.
>  
>



Re: ESQL erros - cocoon2.0.3

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 29.Jul.2002 -- 01:23 PM, Dominic Reynolds wrote:
> I am trying to use ESQL (basic xsp page modelled on the samples).
> 
> my problem is that I get the following null pointer exception:
> 
> Original exception : java.lang.NullPointerException
>        at 
> org.apache.cocoon.components.language.markup.xsp.EsqlQuery.&lt;init&gt;(EsqlQuery.java:99)
> 
> 
> And looking at the source it seems that I'm not passing a connection to 
> the constructor:
> Esql.java -
> 
> public EsqlQuery( EsqlConnection connection, String query ) {
>    this.connection = connection;
>    this.limitMethod = connection.getLimitMethod();   << line 99
> 
> 
> Now looking at the generated java code for my xsp:
> cocoon-files/org/apache/cocoon/www/upgrades/docs/upgrade_xsp.java
> is see:
> 
>  private EsqlConnectionCocoon2 _esql_connection = null;
> // .
> // . some non-connection related java stuff......
> // .
> _esql_query = new EsqlQuery( _esql_connection, String.valueOf(
>      ""       + "SELECT guid FROM appliances WHERE guid="                +
>        (request.getHeader("guid"))
>      ) );
> 
> 
> So the generated java code is incorrect. I know the datasource i'm using 
> is ok as I am using it in an action and it works fine.
> I must be doing something wrong here...but what?

Everything looks fine. Could you produce a complete stack trace?
Other XSPs using esql work fine, right?

> 
> Below is the xsp that is called:
> 
> <?xml version="1.0"?>
> <xsp:page
>      language="java"
>      xmlns:xsp="http://apache.org/xsp"
>      xmlns:esql="http://apache.org/cocoon/SQL/v2"
>      xmlns:xsp-request="http://apache.org/xsp/request/2.0"
>    >
>    <esql:connection>
>      <esql:pool>regdata</esql:pool>
>      <esql:execute-query>
>        <esql:query>SELECT guid FROM appliances WHERE 
> guid=<xsp-request:get-header name="guid"/></esql:query>
>        <esql:results>
>          <table>
>            <esql:row-results>
>              <tr>
>                 <td><esql:get-string column="product"/></td>
>                 <!--
> <xsp:attribute name="value"><esql:get-string column="id"/></xsp:attribute>
>              </tr>
>            </esql:row-results>
>          </table>
>   </esql:results>
>        <esql:no-results>
>           <p>Sorry No record</p>
>        </esql:no-results>
>      </esql:execute-query>
>    </esql:connection>
> </xsp:page>

	Chris.
-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

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