You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Tuomo L <tl...@cc.hut.fi> on 2005/07/16 21:48:16 UTC

DatabaseReader problem with 2.1.7, help needed

Hi,

Is anyone using the DatabaseReader with Cocooon 2.1.7 ? We just cannot get
it to function. Log says "Assuming client reset stream".

If it works, could you please tell which versions of Java, Tomcat and db 
you have on what system? We're trying to figure out the source for this
problem. With Cocoon 2.1.5 everything works fine. We are using SQL Server
2000 and it's latest JDBC driver provided by MS.

-Tuomo


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: DatabaseReader problem with 2.1.7, help needed

Posted by Frank Taffelt <fr...@interface-business.de>.
Tuomo L wrote:
> We are using SQL Server 2000 and it's latest JDBC driver provided by MS.

Maybe you should give annother MSSQL JDBC Driver a try. We are using 
http://jtds.sourceforge.net/ without problems.

--
Frank 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: DatabaseReader problem with 2.1.7, help needed

Posted by Tuomo L <tl...@cc.hut.fi>.
Thanks guys for your replies so far,

I did some logging about the IOException, and here's the message:

"[Microsoft][SQLServer 2000 Driver for JDBC]Object has been closed"

The IOException occurs when Serialize -method is trying to read the 
inputstream is. Does this give you any ideas?

Why doesn't this happen with Cocoon 2.1.5???

public void serialize(Response response)
     throws IOException, SQLException {
         if (this.resource == null) {
             throw new SQLException("The Blob is empty!");
         }

         InputStream is = new BufferedInputStream(this.resource);

         long expires = parameters.getParameterAsInteger("expires", -1);

         if (expires > 0) {
             response.setDateHeader("Expires", System.currentTimeMillis() + 
expires);
         }

         response.setHeader("Accept-Ranges", "bytes");

         byte[] buffer = new byte[8192];
         int length = -1;

         while ((length = is.read(buffer)) > -1) {
                          ^^^^^^^^^^^^^^^
             out.write(buffer, 0, length);
         }
         is.close();
         out.flush();
     }

Should this be continued on dev-list only?

-Tuomo

On Sun, 17 Jul 2005, Joerg Heinicke wrote:

> On 17.07.2005 00:36, Tuomo L wrote:
>> Thanks, I tested the sample, and it does work with HSQLDB. But when I 
>> tested it against SQL Server with similar results I got before: Upload 
>> works but reading the file with DatabaseReader returns 0 bytes. :(
>> 
>> So, my guess is, something has changed between 2.1.5 and 2.1.7 that makes
>> the JDBC driver for SQL Server incompatible with Cocoon. With the jar-files 
>> from 2.1.5 (same setup otherwise) this works. What could this change be?
>> 
>> The method that throws this error "Assuming client reset stream" in 
>> DatabaseReader.java is:
>> 
>> public void generate() throws ProcessingException, SAXException, 
>> IOException {
>>         try {
>>             Response response = ObjectModelHelper.getResponse(objectModel);
>>             this.serialize(response);
>>         } catch (IOException ioe) {
>>             getLogger().warn("Assuming client reset stream");
>
> Try to log the IOException or do some remote debugging to find out the 
> reason.
>
> Joerg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

[SOLUTION] DatabaseReader problem with 2.1.7, help needed

Posted by Tuomo L <tl...@cc.hut.fi>.
Updated the JDBC-driver to the latest: "Microsoft SQL Server 2005 JDBC 
Driver Beta 1". This works fine with Cocoon 2.1.7.

-Tuomo

On Sun, 17 Jul 2005, Joerg Heinicke wrote:

> On 17.07.2005 00:36, Tuomo L wrote:
>> Thanks, I tested the sample, and it does work with HSQLDB. But when I 
>> tested it against SQL Server with similar results I got before: Upload 
>> works but reading the file with DatabaseReader returns 0 bytes. :(
>> 
>> So, my guess is, something has changed between 2.1.5 and 2.1.7 that makes
>> the JDBC driver for SQL Server incompatible with Cocoon. With the jar-files 
>> from 2.1.5 (same setup otherwise) this works. What could this change be?
>> 
>> The method that throws this error "Assuming client reset stream" in 
>> DatabaseReader.java is:
>> 
>> public void generate() throws ProcessingException, SAXException, 
>> IOException {
>>         try {
>>             Response response = ObjectModelHelper.getResponse(objectModel);
>>             this.serialize(response);
>>         } catch (IOException ioe) {
>>             getLogger().warn("Assuming client reset stream");
>
> Try to log the IOException or do some remote debugging to find out the 
> reason.
>
> Joerg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


[SOLUTION] DatabaseReader problem with 2.1.7, help needed

Posted by Tuomo L <tl...@cc.hut.fi>.
Updated the JDBC-driver to the latest: "Microsoft SQL Server 2005 JDBC 
Driver Beta 1". This works fine with Cocoon 2.1.7.

-Tuomo

On Sun, 17 Jul 2005, Joerg Heinicke wrote:

> On 17.07.2005 00:36, Tuomo L wrote:
>> Thanks, I tested the sample, and it does work with HSQLDB. But when I 
>> tested it against SQL Server with similar results I got before: Upload 
>> works but reading the file with DatabaseReader returns 0 bytes. :(
>> 
>> So, my guess is, something has changed between 2.1.5 and 2.1.7 that makes
>> the JDBC driver for SQL Server incompatible with Cocoon. With the jar-files 
>> from 2.1.5 (same setup otherwise) this works. What could this change be?
>> 
>> The method that throws this error "Assuming client reset stream" in 
>> DatabaseReader.java is:
>> 
>> public void generate() throws ProcessingException, SAXException, 
>> IOException {
>>         try {
>>             Response response = ObjectModelHelper.getResponse(objectModel);
>>             this.serialize(response);
>>         } catch (IOException ioe) {
>>             getLogger().warn("Assuming client reset stream");
>
> Try to log the IOException or do some remote debugging to find out the 
> reason.
>
> Joerg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

Re: DatabaseReader problem with 2.1.7, help needed

Posted by Tuomo L <tl...@cc.hut.fi>.
Thanks guys for your replies so far,

I did some logging about the IOException, and here's the message:

"[Microsoft][SQLServer 2000 Driver for JDBC]Object has been closed"

The IOException occurs when Serialize -method is trying to read the 
inputstream is. Does this give you any ideas?

Why doesn't this happen with Cocoon 2.1.5???

public void serialize(Response response)
     throws IOException, SQLException {
         if (this.resource == null) {
             throw new SQLException("The Blob is empty!");
         }

         InputStream is = new BufferedInputStream(this.resource);

         long expires = parameters.getParameterAsInteger("expires", -1);

         if (expires > 0) {
             response.setDateHeader("Expires", System.currentTimeMillis() + 
expires);
         }

         response.setHeader("Accept-Ranges", "bytes");

         byte[] buffer = new byte[8192];
         int length = -1;

         while ((length = is.read(buffer)) > -1) {
                          ^^^^^^^^^^^^^^^
             out.write(buffer, 0, length);
         }
         is.close();
         out.flush();
     }

Should this be continued on dev-list only?

-Tuomo

On Sun, 17 Jul 2005, Joerg Heinicke wrote:

> On 17.07.2005 00:36, Tuomo L wrote:
>> Thanks, I tested the sample, and it does work with HSQLDB. But when I 
>> tested it against SQL Server with similar results I got before: Upload 
>> works but reading the file with DatabaseReader returns 0 bytes. :(
>> 
>> So, my guess is, something has changed between 2.1.5 and 2.1.7 that makes
>> the JDBC driver for SQL Server incompatible with Cocoon. With the jar-files 
>> from 2.1.5 (same setup otherwise) this works. What could this change be?
>> 
>> The method that throws this error "Assuming client reset stream" in 
>> DatabaseReader.java is:
>> 
>> public void generate() throws ProcessingException, SAXException, 
>> IOException {
>>         try {
>>             Response response = ObjectModelHelper.getResponse(objectModel);
>>             this.serialize(response);
>>         } catch (IOException ioe) {
>>             getLogger().warn("Assuming client reset stream");
>
> Try to log the IOException or do some remote debugging to find out the 
> reason.
>
> Joerg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: DatabaseReader problem with 2.1.7, help needed

Posted by Joerg Heinicke <jo...@gmx.de>.
On 17.07.2005 00:36, Tuomo L wrote:
> Thanks, I tested the sample, and it does work with HSQLDB. But when I 
> tested it against SQL Server with similar results I got before: Upload 
> works but reading the file with DatabaseReader returns 0 bytes. :(
> 
> So, my guess is, something has changed between 2.1.5 and 2.1.7 that makes
> the JDBC driver for SQL Server incompatible with Cocoon. With the 
> jar-files from 2.1.5 (same setup otherwise) this works. What could this 
> change be?
> 
> The method that throws this error "Assuming client reset stream" in 
> DatabaseReader.java is:
> 
> public void generate() throws ProcessingException, SAXException, 
> IOException {
>         try {
>             Response response = ObjectModelHelper.getResponse(objectModel);
>             this.serialize(response);
>         } catch (IOException ioe) {
>             getLogger().warn("Assuming client reset stream");

Try to log the IOException or do some remote debugging to find out the 
reason.

Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: DatabaseReader problem with 2.1.7, help needed

Posted by Tuomo L <tl...@cc.hut.fi>.
Thanks, I tested the sample, and it does work with HSQLDB. But when I 
tested it against SQL Server with similar results I got before: Upload 
works but reading the file with DatabaseReader returns 0 bytes. :(

So, my guess is, something has changed between 2.1.5 and 2.1.7 that makes
the JDBC driver for SQL Server incompatible with Cocoon. With the 
jar-files from 2.1.5 (same setup otherwise) this works. What could this 
change be?

The method that throws this error "Assuming client reset stream" in 
DatabaseReader.java is:

public void generate() throws ProcessingException, SAXException, IOException {
         try {
             Response response = ObjectModelHelper.getResponse(objectModel);
             this.serialize(response);
         } catch (IOException ioe) {
             getLogger().warn("Assuming client reset stream");

             this.doCommit = false;
         } catch (Exception e) {
             this.doCommit = false;

             throw new ResourceNotFoundException("DatabaseReader error:", 
e);
         }
     }


-Tuomo

On Sun, 17 Jul 2005, Andrew Franz wrote:

> DatabaseReader is used in the samples:
> http://localhost:8080/cocoon/samples/blocks/databases/mod-db/file-upload-blob
> (Cocoon 2.1.7, Tomcat 5.5)
>
> After upload, this uses DatabaseReader to retrieve the image from HSQLDB.
> If this works ok, then the problems are with SQL Server maybe the column 
> definition
>
>
> Tuomo L wrote:
>
>> Hi,
>> 
>> Is anyone using the DatabaseReader with Cocooon 2.1.7 ? We just cannot get
>> it to function. Log says "Assuming client reset stream".
>> 
>> If it works, could you please tell which versions of Java, Tomcat and db 
>> you have on what system? We're trying to figure out the source for this
>> problem. With Cocoon 2.1.5 everything works fine. We are using SQL Server
>> 2000 and it's latest JDBC driver provided by MS.
>> 
>> -Tuomo
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>> 
>> 
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: DatabaseReader problem with 2.1.7, help needed

Posted by Andrew Franz <af...@optushome.com.au>.
DatabaseReader is used in the samples:
http://localhost:8080/cocoon/samples/blocks/databases/mod-db/file-upload-blob
(Cocoon 2.1.7, Tomcat 5.5)

After upload, this uses DatabaseReader to retrieve the image from HSQLDB.
If this works ok, then the problems are with SQL Server maybe the column 
definition


Tuomo L wrote:

> Hi,
>
> Is anyone using the DatabaseReader with Cocooon 2.1.7 ? We just cannot 
> get
> it to function. Log says "Assuming client reset stream".
>
> If it works, could you please tell which versions of Java, Tomcat and 
> db you have on what system? We're trying to figure out the source for 
> this
> problem. With Cocoon 2.1.5 everything works fine. We are using SQL Server
> 2000 and it's latest JDBC driver provided by MS.
>
> -Tuomo
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org