pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
RE: [INTERFACES] Large Object Exception/Serializing Java Objects
4+ messages / 2 participants
[nested] [flat]

* RE: [INTERFACES] Large Object Exception/Serializing Java Objects
@ 1999-12-10 07:38 Peter Mount <petermount@it.maidstone.gov.uk>
  1999-12-11 06:47 ` Re: [INTERFACES] Large Object Exception/Serializing Java Objects Joe Shevland <shevlandj@kpi.com.au>
  0 siblings, 1 reply; 4+ messages in thread

From: Peter Mount @ 1999-12-10 07:38 UTC (permalink / raw)
  To: 'Joe Shevland' <shevlandj@kpi.com.au>; pgsql-interfaces

Joe, what version of the driver are you using?

The Z error I thought was fixed some time ago. Originally the fastpath
code was based on libpq, but I found that the backend also send a packet
labeled Z, so added a check for it.

Peter

-- 
Peter Mount
Enterprise Support
Maidstone Borough Council
Any views stated are my own, and not those of Maidstone Borough Council.



-----Original Message-----
From: Joe Shevland [mailto:shevlandj@kpi.com.au]
Sent: Friday, December 10, 1999 7:35 PM
To: pgsql-interfaces@postgreSQL.org
Subject: [INTERFACES] Large Object Exception/Serializing Java Objects


Hi all,

I'm trying to persist some Java objects in a PostgreSQL database using
JDBC
(2.0).

I get the following error:

Fri Dec 10 11:26:15 PST 1999 - [copyright] EJBoss - The EJB Open Source
Server v0.9
Fri Dec 10 11:26:48 PST 1999 - [Exception]
Fri Dec 10 11:26:48 PST 1999 - FastPath protocol error: Z
FastPath protocol error: Z
 at postgresql.fastpath.Fastpath.fastpath(Fastpath.java:159)
 at postgresql.fastpath.Fastpath.fastpath(Fastpath.java:188)
 at postgresql.fastpath.Fastpath.getInteger(Fastpath.java:200)
 at
postgresql.largeobject.LargeObjectManager.create(LargeObjectManager.java
:176
)
 at
org.ejboss.storage.PGSecondaryStorage.serialize(PGSecondaryStorage.java:
245)
 at
org.ejboss.storage.PGSecondaryStorage.store(PGSecondaryStorage.java:117)
 at
org.ejboss.ejb.EnterpriseBeanWrapper.passivate(EnterpriseBeanWrapper.jav
a:34
3)
 at
org.ejboss.managers.EnterpriseBeanWrapperManager$LRUThread.run(Enterpris
eBea
nWrapperManager.java:403)
 at java.lang.Thread.run(Thread.java:479)

This occurs upon trying to create the large object... before going to
the
source I just wanted to check that this is supposed to work and all
that.

Out of interest, here's the offending code fragment (it may be just
plain
wrong... any ideas appreciated!):

    private int serialize(EnterpriseBean bean)
        throws IOException, SQLException
    {
        ByteArrayOutputStream   byte_out = new ByteArrayOutputStream();
        ByteArrayInputStream    byte_in;
        ObjectOutputStream      obj_out = new
ObjectOutputStream(byte_out);

        byte[]                  classbytes;
        byte                    buf[] = new byte[2048];
        int                     read=0;

        // lobj was created in the constructor...

        // Create the ejb object using the PostgreSQL specific blob
support
        int oid =
lobj.create(LargeObjectManager.READ|LargeObjectManager.WRITE);

        LargeObject obj = lobj.open(oid,LargeObjectManager.WRITE);
        DriverManager.println("[PGSecondaryStorage] Got large object
obj="+obj);

        // Copy the EJB to a temporary byte array
        obj_out.writeObject( bean );
        obj_out.flush();
        classbytes = byte_out.toByteArray();
        byte_in = new ByteArrayInputStream(classbytes);

        // Copy the data to the large object
        while((read=byte_in.read(buf,0,2048))>0) {
          obj.write(buf,0,read);
        }

        obj.close();

        return oid;
    }


Thanks,
Joe.


---
Joe Shevland
Principal Consultant
KPI Logistics Pty Ltd
mailto:shevlandj@kpi.com.au
http://www.kpi.com.au


************



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [INTERFACES] Large Object Exception/Serializing Java Objects
  1999-12-10 07:38 RE: [INTERFACES] Large Object Exception/Serializing Java Objects Peter Mount <petermount@it.maidstone.gov.uk>
@ 1999-12-11 06:47 ` Joe Shevland <shevlandj@kpi.com.au>
  0 siblings, 0 replies; 4+ messages in thread

From: Joe Shevland @ 1999-12-11 06:47 UTC (permalink / raw)
  To: Peter Mount <petermount@it.maidstone.gov.uk>; pgsql-interfaces

I'm pretty sure I compiled it to a 1.2 version (==JDBC2.0?) although with
the requirements of gnujsp/jserv/apache I may have tied myself in a knot.

Failing that, I'm using a 1.3 vm on Windows 98 to communicate with a 1.1.8
FreeBSD JVM. That could be the prob?? (actually, having said it, it sounds
like that could well be the problem)  Its all to try and faciliate
persistance of Java objects with EJBoss (www.ejboss.org); if there's easier
options I'm happy. This is probably an effort everyone in the open source
comunity will benefit from too when you realize the benefits of EJB's...

Thanks heaps for input,

(BTW, the 'Z' error sounds ominous :)

(And also BTW, I love the way people overseas are awake when I'm busily
coding at night... Australians coders must be a dying breed :)

Cheers,
Joe


----- Original Message -----
From: "Peter Mount" <petermount@it.maidstone.gov.uk>
To: "'Joe Shevland'" <shevlandj@kpi.com.au>;
<pgsql-interfaces@postgreSQL.org>
Sent: Thursday, December 09, 1999 11:38 PM
Subject: RE: [INTERFACES] Large Object Exception/Serializing Java Objects


> Joe, what version of the driver are you using?
>
> The Z error I thought was fixed some time ago. Originally the fastpath
> code was based on libpq, but I found that the backend also send a packet
> labeled Z, so added a check for it.
>
> Peter
>
> --
> Peter Mount
> Enterprise Support
> Maidstone Borough Council
> Any views stated are my own, and not those of Maidstone Borough Council.
>
>
>
> -----Original Message-----
> From: Joe Shevland [mailto:shevlandj@kpi.com.au]
> Sent: Friday, December 10, 1999 7:35 PM
> To: pgsql-interfaces@postgreSQL.org
> Subject: [INTERFACES] Large Object Exception/Serializing Java Objects
>
>
> Hi all,
>
> I'm trying to persist some Java objects in a PostgreSQL database using
> JDBC
> (2.0).
>
> I get the following error:
>
> Fri Dec 10 11:26:15 PST 1999 - [copyright] EJBoss - The EJB Open Source
> Server v0.9
> Fri Dec 10 11:26:48 PST 1999 - [Exception]
> Fri Dec 10 11:26:48 PST 1999 - FastPath protocol error: Z
> FastPath protocol error: Z
>  at postgresql.fastpath.Fastpath.fastpath(Fastpath.java:159)
>  at postgresql.fastpath.Fastpath.fastpath(Fastpath.java:188)
>  at postgresql.fastpath.Fastpath.getInteger(Fastpath.java:200)
>  at
> postgresql.largeobject.LargeObjectManager.create(LargeObjectManager.java
> :176
> )
>  at
> org.ejboss.storage.PGSecondaryStorage.serialize(PGSecondaryStorage.java:
> 245)
>  at
> org.ejboss.storage.PGSecondaryStorage.store(PGSecondaryStorage.java:117)
>  at
> org.ejboss.ejb.EnterpriseBeanWrapper.passivate(EnterpriseBeanWrapper.jav
> a:34
> 3)
>  at
> org.ejboss.managers.EnterpriseBeanWrapperManager$LRUThread.run(Enterpris
> eBea
> nWrapperManager.java:403)
>  at java.lang.Thread.run(Thread.java:479)
>
> This occurs upon trying to create the large object... before going to
> the
> source I just wanted to check that this is supposed to work and all
> that.
>
> Out of interest, here's the offending code fragment (it may be just
> plain
> wrong... any ideas appreciated!):
>
>     private int serialize(EnterpriseBean bean)
>         throws IOException, SQLException
>     {
>         ByteArrayOutputStream   byte_out = new ByteArrayOutputStream();
>         ByteArrayInputStream    byte_in;
>         ObjectOutputStream      obj_out = new
> ObjectOutputStream(byte_out);
>
>         byte[]                  classbytes;
>         byte                    buf[] = new byte[2048];
>         int                     read=0;
>
>         // lobj was created in the constructor...
>
>         // Create the ejb object using the PostgreSQL specific blob
> support
>         int oid =
> lobj.create(LargeObjectManager.READ|LargeObjectManager.WRITE);
>
>         LargeObject obj = lobj.open(oid,LargeObjectManager.WRITE);
>         DriverManager.println("[PGSecondaryStorage] Got large object
> obj="+obj);
>
>         // Copy the EJB to a temporary byte array
>         obj_out.writeObject( bean );
>         obj_out.flush();
>         classbytes = byte_out.toByteArray();
>         byte_in = new ByteArrayInputStream(classbytes);
>
>         // Copy the data to the large object
>         while((read=byte_in.read(buf,0,2048))>0) {
>           obj.write(buf,0,read);
>         }
>
>         obj.close();
>
>         return oid;
>     }
>
>
> Thanks,
> Joe.
>
>
> ---
> Joe Shevland
> Principal Consultant
> KPI Logistics Pty Ltd
> mailto:shevlandj@kpi.com.au
> http://www.kpi.com.au
>
>
> ************
>




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* RE: [INTERFACES] Large Object Exception/Serializing Java Objects
@ 1999-12-10 11:56 Peter Mount <petermount@it.maidstone.gov.uk>
  0 siblings, 0 replies; 4+ messages in thread

From: Peter Mount @ 1999-12-10 11:56 UTC (permalink / raw)
  To: 'Joe Shevland' <shevlandj@kpi.com.au>; Peter Mount <petermount@it.maidstone.gov.uk>; pgsql-interfaces



-----Original Message-----
From: Joe Shevland [mailto:shevlandj@kpi.com.au]
Sent: Saturday, December 11, 1999 6:48 AM
To: Peter Mount; pgsql-interfaces@postgreSQL.org
Subject: Re: [INTERFACES] Large Object Exception/Serializing Java
Objects


I'm pretty sure I compiled it to a 1.2 version (==JDBC2.0?) although
with
the requirements of gnujsp/jserv/apache I may have tied myself in a
knot.

PM: Infact, the LO & Serializing code is identical in both versions, so
it shouldn't really matter in these cases (both are subpackages).

Failing that, I'm using a 1.3 vm on Windows 98 to communicate with a
1.1.8
FreeBSD JVM. That could be the prob?? (actually, having said it, it
sounds
like that could well be the problem)  Its all to try and faciliate
persistance of Java objects with EJBoss (www.ejboss.org); if there's
easier
options I'm happy. This is probably an effort everyone in the open
source
comunity will benefit from too when you realize the benefits of EJB's...

PM: I'll have to take a look at it. It's possible as 1.3 may have a
different Serialising format than 1.1.8 (the Swing docs actually state
that it would be incompatible).

Thanks heaps for input,

(BTW, the 'Z' error sounds ominous :)

(And also BTW, I love the way people overseas are awake when I'm busily
coding at night... Australians coders must be a dying breed :)

PM: It's a common knowledge that the best software code is produced at
3am - I know that mine does - too many distractions otherwise.

Cheers,
Joe


----- Original Message -----
From: "Peter Mount" <petermount@it.maidstone.gov.uk>
To: "'Joe Shevland'" <shevlandj@kpi.com.au>;
<pgsql-interfaces@postgreSQL.org>
Sent: Thursday, December 09, 1999 11:38 PM
Subject: RE: [INTERFACES] Large Object Exception/Serializing Java
Objects


> Joe, what version of the driver are you using?
>
> The Z error I thought was fixed some time ago. Originally the fastpath
> code was based on libpq, but I found that the backend also send a
packet
> labeled Z, so added a check for it.
>
> Peter
>
> --
> Peter Mount
> Enterprise Support
> Maidstone Borough Council
> Any views stated are my own, and not those of Maidstone Borough
Council.
>
>
>
> -----Original Message-----
> From: Joe Shevland [mailto:shevlandj@kpi.com.au]
> Sent: Friday, December 10, 1999 7:35 PM
> To: pgsql-interfaces@postgreSQL.org
> Subject: [INTERFACES] Large Object Exception/Serializing Java Objects
>
>
> Hi all,
>
> I'm trying to persist some Java objects in a PostgreSQL database using
> JDBC
> (2.0).
>
> I get the following error:
>
> Fri Dec 10 11:26:15 PST 1999 - [copyright] EJBoss - The EJB Open
Source
> Server v0.9
> Fri Dec 10 11:26:48 PST 1999 - [Exception]
> Fri Dec 10 11:26:48 PST 1999 - FastPath protocol error: Z
> FastPath protocol error: Z
>  at postgresql.fastpath.Fastpath.fastpath(Fastpath.java:159)
>  at postgresql.fastpath.Fastpath.fastpath(Fastpath.java:188)
>  at postgresql.fastpath.Fastpath.getInteger(Fastpath.java:200)
>  at
>
postgresql.largeobject.LargeObjectManager.create(LargeObjectManager.java
> :176
> )
>  at
>
org.ejboss.storage.PGSecondaryStorage.serialize(PGSecondaryStorage.java:
> 245)
>  at
>
org.ejboss.storage.PGSecondaryStorage.store(PGSecondaryStorage.java:117)
>  at
>
org.ejboss.ejb.EnterpriseBeanWrapper.passivate(EnterpriseBeanWrapper.jav
> a:34
> 3)
>  at
>
org.ejboss.managers.EnterpriseBeanWrapperManager$LRUThread.run(Enterpris
> eBea
> nWrapperManager.java:403)
>  at java.lang.Thread.run(Thread.java:479)
>
> This occurs upon trying to create the large object... before going to
> the
> source I just wanted to check that this is supposed to work and all
> that.
>
> Out of interest, here's the offending code fragment (it may be just
> plain
> wrong... any ideas appreciated!):
>
>     private int serialize(EnterpriseBean bean)
>         throws IOException, SQLException
>     {
>         ByteArrayOutputStream   byte_out = new
ByteArrayOutputStream();
>         ByteArrayInputStream    byte_in;
>         ObjectOutputStream      obj_out = new
> ObjectOutputStream(byte_out);
>
>         byte[]                  classbytes;
>         byte                    buf[] = new byte[2048];
>         int                     read=0;
>
>         // lobj was created in the constructor...
>
>         // Create the ejb object using the PostgreSQL specific blob
> support
>         int oid =
> lobj.create(LargeObjectManager.READ|LargeObjectManager.WRITE);
>
>         LargeObject obj = lobj.open(oid,LargeObjectManager.WRITE);
>         DriverManager.println("[PGSecondaryStorage] Got large object
> obj="+obj);
>
>         // Copy the EJB to a temporary byte array
>         obj_out.writeObject( bean );
>         obj_out.flush();
>         classbytes = byte_out.toByteArray();
>         byte_in = new ByteArrayInputStream(classbytes);
>
>         // Copy the data to the large object
>         while((read=byte_in.read(buf,0,2048))>0) {
>           obj.write(buf,0,read);
>         }
>
>         obj.close();
>
>         return oid;
>     }
>
>
> Thanks,
> Joe.
>
>
> ---
> Joe Shevland
> Principal Consultant
> KPI Logistics Pty Ltd
> mailto:shevlandj@kpi.com.au
> http://www.kpi.com.au
>
>
> ************
>



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Large Object Exception/Serializing Java Objects
@ 1999-12-10 19:34 Joe Shevland <shevlandj@kpi.com.au>
  0 siblings, 0 replies; 4+ messages in thread

From: Joe Shevland @ 1999-12-10 19:34 UTC (permalink / raw)
  To: pgsql-interfaces

Hi all,

I'm trying to persist some Java objects in a PostgreSQL database using JDBC
(2.0).

I get the following error:

Fri Dec 10 11:26:15 PST 1999 - [copyright] EJBoss - The EJB Open Source
Server v0.9
Fri Dec 10 11:26:48 PST 1999 - [Exception]
Fri Dec 10 11:26:48 PST 1999 - FastPath protocol error: Z
FastPath protocol error: Z
 at postgresql.fastpath.Fastpath.fastpath(Fastpath.java:159)
 at postgresql.fastpath.Fastpath.fastpath(Fastpath.java:188)
 at postgresql.fastpath.Fastpath.getInteger(Fastpath.java:200)
 at
postgresql.largeobject.LargeObjectManager.create(LargeObjectManager.java:176
)
 at
org.ejboss.storage.PGSecondaryStorage.serialize(PGSecondaryStorage.java:245)
 at org.ejboss.storage.PGSecondaryStorage.store(PGSecondaryStorage.java:117)
 at
org.ejboss.ejb.EnterpriseBeanWrapper.passivate(EnterpriseBeanWrapper.java:34
3)
 at
org.ejboss.managers.EnterpriseBeanWrapperManager$LRUThread.run(EnterpriseBea
nWrapperManager.java:403)
 at java.lang.Thread.run(Thread.java:479)

This occurs upon trying to create the large object... before going to the
source I just wanted to check that this is supposed to work and all that.

Out of interest, here's the offending code fragment (it may be just plain
wrong... any ideas appreciated!):

    private int serialize(EnterpriseBean bean)
        throws IOException, SQLException
    {
        ByteArrayOutputStream   byte_out = new ByteArrayOutputStream();
        ByteArrayInputStream    byte_in;
        ObjectOutputStream      obj_out = new ObjectOutputStream(byte_out);

        byte[]                  classbytes;
        byte                    buf[] = new byte[2048];
        int                     read=0;

        // lobj was created in the constructor...

        // Create the ejb object using the PostgreSQL specific blob support
        int oid =
lobj.create(LargeObjectManager.READ|LargeObjectManager.WRITE);

        LargeObject obj = lobj.open(oid,LargeObjectManager.WRITE);
        DriverManager.println("[PGSecondaryStorage] Got large object
obj="+obj);

        // Copy the EJB to a temporary byte array
        obj_out.writeObject( bean );
        obj_out.flush();
        classbytes = byte_out.toByteArray();
        byte_in = new ByteArrayInputStream(classbytes);

        // Copy the data to the large object
        while((read=byte_in.read(buf,0,2048))>0) {
          obj.write(buf,0,read);
        }

        obj.close();

        return oid;
    }


Thanks,
Joe.


---
Joe Shevland
Principal Consultant
KPI Logistics Pty Ltd
mailto:shevlandj@kpi.com.au
http://www.kpi.com.au




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~1999-12-11 06:47 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-12-10 07:38 RE: [INTERFACES] Large Object Exception/Serializing Java Objects Peter Mount <petermount@it.maidstone.gov.uk>
1999-12-11 06:47 ` Joe Shevland <shevlandj@kpi.com.au>
1999-12-10 11:56 RE: [INTERFACES] Large Object Exception/Serializing Java Objects Peter Mount <petermount@it.maidstone.gov.uk>
1999-12-10 19:34 Large Object Exception/Serializing Java Objects Joe Shevland <shevlandj@kpi.com.au>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox