You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Erik de Hair <e....@pocos.nl> on 2018/03/14 08:35:14 UTC

Exception for Blob property

Hi,

I'm having troubles with Blob fields after upgrading to Apache Isis 
1.16.2 (not sure if this was also the case for 1.16.[0-1]). The feature 
is using existing data we had no problems with before upgrading.

My field definition:

@javax.jdo.annotations.Persistent(defaultFetchGroup="false", columns = {
               @javax.jdo.annotations.Column(name = "file_name", 
allowsNull = "false"),
               @javax.jdo.annotations.Column(name = "file_mimetype", 
allowsNull = "false"),
               @javax.jdo.annotations.Column(name = "file_bytes", 
jdbcType="BLOB", sqlType = "BLOB", allowsNull = "false")
           })
     @Property(editing=Editing.DISABLED, optionality=Optionality.MANDATORY)
     @Getter @Setter
     private Blob file;

Caused by: javax.jdo.JDOFatalUserException: StreamCorruptedException: 
object is corrupted
NestedThrowables:
java.io.StreamCorruptedException: invalid stream header: 47657370
     at 
org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:606)
     at 
org.datanucleus.api.jdo.JDOAdapter.getApiExceptionForNucleusException(JDOAdapter.java:677)
     at 
org.datanucleus.state.StateManagerImpl.isLoaded(StateManagerImpl.java:2929)
     at nl.pocos.dom.doclib.Document.dnGetfile(Document.java)
     at nl.pocos.dom.doclib.Document.getFile(Document.java:86)

I've changed the sqlType to "LONGVARBINARY" but this didn't help. I 
can't reproduce this issue in the quickstart app. Was there any change 
in Datanucleus version? Will have another look at the change logs.

Anyone having an idea?

Thanks,
Erik

Re: Exception for Blob property

Posted by Erik de Hair <e....@pocos.nl>.
Hi Dan,

Thanks, I will try to get the answers on your questions.

 > - is this failing for every entity instance/row? StreamCorrupted 
suggestsa probably with an individual field
It is failing for each row

 > - does the 1.15.x version of your app work with this specific entity 
instance/row
Yes it does work

 > - is this entity instance particularly large? is there a limit being hit?
I even fails for very small files

A first difference I see between our app based on 1.15.x and 1.16.2:

When retrieving a Blob these are the select statements
1.15.x:
SELECT A0.file_name,A0.file_mimetype,A0.file_bytes FROM LibraryDocuments 
A0 WHERE A0.id = <225>

1.16.2:
SELECT A0.file_name FROM LibraryDocuments A0 WHERE A0.id = <225> (So the 
actual bytes are not selected)

I have the same issue when saving a new document to the database:
INSERT INTO LibraryDocuments (creation_date,file_name,DISCRIMINATOR) 
VALUES (?,?,?)" failed : Field 'file_bytes' doesn't have a default value

As if the file_bytes and file_mimetype columns are ignored.

Will try to get more answers.

Erik


On 03/14/2018 09:48 AM, Dan Haywood wrote:
> Hi Erik,
>
> Short answer is, no, we haven't changed the DN versions for this release -
> that's gonna happen in Isis 2.0.0-M1 but not before.  And I can't, off the
> top of my head, think of anything in Isis 1.16.x that's changed in this
> area.
>
> Some questions/suggestions:
> - is this failing for every entity instance/row?  StreamCorrupted suggests
> a probably with an individual field
> - does the 1.15.x version of your app work with this specific entity
> instance/row
> - is this entity instance particularly large? is there a limit being hit?
> - if you write a simple DN-only app (no Isis) to retrieve the row, does it
> work or fail?
> - if 1.15.x works but 1.16.x, can you isolate from the stack trace where
> 1.16.x is throwing an exception whereas 1.15.x continues happily?
>
> Sorry don't have an immediate solution for you...
>
> Dan
>
> On Wed, 14 Mar 2018, 08:35 Erik de Hair, <e....@pocos.nl> wrote:
>
>> Hi,
>>
>> I'm having troubles with Blob fields after upgrading to Apache Isis
>> 1.16.2 (not sure if this was also the case for 1.16.[0-1]). The feature
>> is using existing data we had no problems with before upgrading.
>>
>> My field definition:
>>
>> @javax.jdo.annotations.Persistent(defaultFetchGroup="false", columns = {
>>                 @javax.jdo.annotations.Column(name = "file_name",
>> allowsNull = "false"),
>>                 @javax.jdo.annotations.Column(name = "file_mimetype",
>> allowsNull = "false"),
>>                 @javax.jdo.annotations.Column(name = "file_bytes",
>> jdbcType="BLOB", sqlType = "BLOB", allowsNull = "false")
>>             })
>>       @Property(editing=Editing.DISABLED, optionality=Optionality.MANDATORY)
>>       @Getter @Setter
>>       private Blob file;
>>
>> Caused by: javax.jdo.JDOFatalUserException: StreamCorruptedException:
>> object is corrupted
>> NestedThrowables:
>> java.io.StreamCorruptedException: invalid stream header: 47657370
>>       at
>>
>> org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:606)
>>       at
>>
>> org.datanucleus.api.jdo.JDOAdapter.getApiExceptionForNucleusException(JDOAdapter.java:677)
>>       at
>> org.datanucleus.state.StateManagerImpl.isLoaded(StateManagerImpl.java:2929)
>>       at nl.pocos.dom.doclib.Document.dnGetfile(Document.java)
>>       at nl.pocos.dom.doclib.Document.getFile(Document.java:86)
>>
>> I've changed the sqlType to "LONGVARBINARY" but this didn't help. I
>> can't reproduce this issue in the quickstart app. Was there any change
>> in Datanucleus version? Will have another look at the change logs.
>>
>> Anyone having an idea?
>>
>> Thanks,
>> Erik
>>


Re: Exception for Blob property

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Erik,

Short answer is, no, we haven't changed the DN versions for this release -
that's gonna happen in Isis 2.0.0-M1 but not before.  And I can't, off the
top of my head, think of anything in Isis 1.16.x that's changed in this
area.

Some questions/suggestions:
- is this failing for every entity instance/row?  StreamCorrupted suggests
a probably with an individual field
- does the 1.15.x version of your app work with this specific entity
instance/row
- is this entity instance particularly large? is there a limit being hit?
- if you write a simple DN-only app (no Isis) to retrieve the row, does it
work or fail?
- if 1.15.x works but 1.16.x, can you isolate from the stack trace where
1.16.x is throwing an exception whereas 1.15.x continues happily?

Sorry don't have an immediate solution for you...

Dan

On Wed, 14 Mar 2018, 08:35 Erik de Hair, <e....@pocos.nl> wrote:

> Hi,
>
> I'm having troubles with Blob fields after upgrading to Apache Isis
> 1.16.2 (not sure if this was also the case for 1.16.[0-1]). The feature
> is using existing data we had no problems with before upgrading.
>
> My field definition:
>
> @javax.jdo.annotations.Persistent(defaultFetchGroup="false", columns = {
>                @javax.jdo.annotations.Column(name = "file_name",
> allowsNull = "false"),
>                @javax.jdo.annotations.Column(name = "file_mimetype",
> allowsNull = "false"),
>                @javax.jdo.annotations.Column(name = "file_bytes",
> jdbcType="BLOB", sqlType = "BLOB", allowsNull = "false")
>            })
>      @Property(editing=Editing.DISABLED, optionality=Optionality.MANDATORY)
>      @Getter @Setter
>      private Blob file;
>
> Caused by: javax.jdo.JDOFatalUserException: StreamCorruptedException:
> object is corrupted
> NestedThrowables:
> java.io.StreamCorruptedException: invalid stream header: 47657370
>      at
>
> org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:606)
>      at
>
> org.datanucleus.api.jdo.JDOAdapter.getApiExceptionForNucleusException(JDOAdapter.java:677)
>      at
> org.datanucleus.state.StateManagerImpl.isLoaded(StateManagerImpl.java:2929)
>      at nl.pocos.dom.doclib.Document.dnGetfile(Document.java)
>      at nl.pocos.dom.doclib.Document.getFile(Document.java:86)
>
> I've changed the sqlType to "LONGVARBINARY" but this didn't help. I
> can't reproduce this issue in the quickstart app. Was there any change
> in Datanucleus version? Will have another look at the change logs.
>
> Anyone having an idea?
>
> Thanks,
> Erik
>