NotSerializableException on QTuple$TupleImpl #640

Closed
dmiorandi opened this Issue Jan 29, 2014 · 7 comments

Comments

Projects
None yet
4 participants
@dmiorandi

I've got a business code like this

List<Tuple> domande = piTreBusinessImpl.getDomandeDaProcessare();

if i try to serialize "domande" I've got a NotSerializableException referred to

com.mysema.query.types.QTuple$TupleImpl

How can I achieve this?

All in all i need to send a tuple query result via some transports that need serialization and this issue avoid me to accomplish that task.

Tks
Denis

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Jan 30, 2014

Member

Could you try again with the latest SNAPSHOT from https://oss.sonatype.org/content/repositories/snapshots

Member

timowest commented Jan 30, 2014

Could you try again with the latest SNAPSHOT from https://oss.sonatype.org/content/repositories/snapshots

@dmiorandi

This comment has been minimized.

Show comment
Hide comment
@dmiorandi

dmiorandi Jan 31, 2014

Hi Timo,
I've tried it. It doesn't work but there is a step ahead. Now exception is on another class

java.io.NotSerializableException: com.mysema.query.sql.ColumnMetadata

What do you think about write a specific serialization test that generate a dummy tuple and try to serialize it. Something like this:

    @Test
    @Transactional
//  @Ignore
    public void testQueryDslSerialization() throws Exception {
        QSQL_PROTOPitre protoPiTre = QSQL_PROTOPitre.PROTOPitre;
        SQLQuery testQuery = queryDslJdbcTemplateViaHibernateSession
                .getQuery()
                .from(protoPiTre);
        List<Tuple> rows = testQuery.list(protoPiTre.iDPitre,protoPiTre.iDDomanda);
        serialize(rows);    
    }

    private void serialize(Object obj) throws IOException{
        ByteArrayOutputStream fileOut = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream(fileOut);
        out.writeObject(obj);
        out.close();
        fileOut.close();
    }

Have to run without exception

Hi Timo,
I've tried it. It doesn't work but there is a step ahead. Now exception is on another class

java.io.NotSerializableException: com.mysema.query.sql.ColumnMetadata

What do you think about write a specific serialization test that generate a dummy tuple and try to serialize it. Something like this:

    @Test
    @Transactional
//  @Ignore
    public void testQueryDslSerialization() throws Exception {
        QSQL_PROTOPitre protoPiTre = QSQL_PROTOPitre.PROTOPitre;
        SQLQuery testQuery = queryDslJdbcTemplateViaHibernateSession
                .getQuery()
                .from(protoPiTre);
        List<Tuple> rows = testQuery.list(protoPiTre.iDPitre,protoPiTre.iDDomanda);
        serialize(rows);    
    }

    private void serialize(Object obj) throws IOException{
        ByteArrayOutputStream fileOut = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream(fileOut);
        out.writeObject(obj);
        out.close();
        fileOut.close();
    }

Have to run without exception

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Jan 31, 2014

Member

Yes, sounds good.

Member

timowest commented Jan 31, 2014

Yes, sounds good.

timowest added a commit that referenced this issue Feb 1, 2014

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Feb 8, 2014

Member

Released in 3.3.1

Member

timowest commented Feb 8, 2014

Released in 3.3.1

@timowest timowest closed this Feb 8, 2014

@dmiorandi

This comment has been minimized.

Show comment
Hide comment
@dmiorandi

dmiorandi Feb 10, 2014

Ok it works

Ok it works

@caarlos0

This comment has been minimized.

Show comment
Hide comment
@caarlos0

caarlos0 Feb 18, 2015

Hi!

I'm using version 3.3.2, and got this:

 No serializer found for class com.mysema.query.types.QTuple$TupleImpl and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: java.util.ArrayList[0])
    at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.failForEmpty(UnknownSerializer.java:59) [jackson-databind-2.4.1.jar:2.4.1]
    at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.serialize(UnknownSerializer.java:26) [jackson-databind-2.4.1.jar:2.4.1]
    at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serializeContentsUsing(CollectionSerializer.java:145) [jackson-databind-2.4.1.jar:2.4.1]
    at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serializeContents(CollectionSerializer.java:87) [jackson-databind-2.4.1.jar:2.4.1]
    at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serializeContents(CollectionSerializer.java:23) [jackson-databind-2.4.1.jar:2.4.1]
    at com.fasterxml.jackson.databind.ser.std.AsArraySerializerBase.serialize(AsArraySerializerBase.java:183) [jackson-databind-2.4.1.jar:2.4.1]
    at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:236) [jackson-databind-2.4.1.jar:2.4.1]
    at com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.java:604) [jackson-databind-2.4.1.jar:2.4.1]
    at org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider.writeTo(ResteasyJackson2Provider.java:199) [resteasy-jackson2-provider-3.0.10.Final.jar:]
    at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.writeTo(AbstractWriterInterceptorContext.java:129) [resteasy-jaxrs-3.0.10.Final.jar:]
    at org.jboss.resteasy.core.interception.ServerWriterInterceptorContext.writeTo(ServerWriterInterceptorContext.java:62) [resteasy-jaxrs-3.0.10.Final.jar:]
    at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:118) [resteasy-jaxrs-3.0.10.Final.jar:]
    at org.jboss.resteasy.security.doseta.DigitalSigningInterceptor.aroundWriteTo(DigitalSigningInterceptor.java:143) [resteasy-crypto-3.0.10.Final.jar:]
    at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:122) [resteasy-jaxrs-3.0.10.Final.jar:]
    at org.jboss.resteasy.plugins.interceptors.encoding.GZIPEncodingInterceptor.aroundWriteTo(GZIPEncodingInterceptor.java:100) [resteasy-jaxrs-3.0.10.Final.jar:]
    at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:122) [resteasy-jaxrs-3.0.10.Final.jar:]
    at org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:99) [resteasy-jaxrs-3.0.10.Final.jar:]
    at org.jboss.resteasy.core.SynchronousDispatcher.writeResponse(SynchronousDispatcher.java:427) [resteasy-jaxrs-3.0.10.Final.jar:]
    ... 32 more

Hi!

I'm using version 3.3.2, and got this:

 No serializer found for class com.mysema.query.types.QTuple$TupleImpl and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: java.util.ArrayList[0])
    at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.failForEmpty(UnknownSerializer.java:59) [jackson-databind-2.4.1.jar:2.4.1]
    at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.serialize(UnknownSerializer.java:26) [jackson-databind-2.4.1.jar:2.4.1]
    at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serializeContentsUsing(CollectionSerializer.java:145) [jackson-databind-2.4.1.jar:2.4.1]
    at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serializeContents(CollectionSerializer.java:87) [jackson-databind-2.4.1.jar:2.4.1]
    at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serializeContents(CollectionSerializer.java:23) [jackson-databind-2.4.1.jar:2.4.1]
    at com.fasterxml.jackson.databind.ser.std.AsArraySerializerBase.serialize(AsArraySerializerBase.java:183) [jackson-databind-2.4.1.jar:2.4.1]
    at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:236) [jackson-databind-2.4.1.jar:2.4.1]
    at com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.java:604) [jackson-databind-2.4.1.jar:2.4.1]
    at org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider.writeTo(ResteasyJackson2Provider.java:199) [resteasy-jackson2-provider-3.0.10.Final.jar:]
    at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.writeTo(AbstractWriterInterceptorContext.java:129) [resteasy-jaxrs-3.0.10.Final.jar:]
    at org.jboss.resteasy.core.interception.ServerWriterInterceptorContext.writeTo(ServerWriterInterceptorContext.java:62) [resteasy-jaxrs-3.0.10.Final.jar:]
    at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:118) [resteasy-jaxrs-3.0.10.Final.jar:]
    at org.jboss.resteasy.security.doseta.DigitalSigningInterceptor.aroundWriteTo(DigitalSigningInterceptor.java:143) [resteasy-crypto-3.0.10.Final.jar:]
    at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:122) [resteasy-jaxrs-3.0.10.Final.jar:]
    at org.jboss.resteasy.plugins.interceptors.encoding.GZIPEncodingInterceptor.aroundWriteTo(GZIPEncodingInterceptor.java:100) [resteasy-jaxrs-3.0.10.Final.jar:]
    at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:122) [resteasy-jaxrs-3.0.10.Final.jar:]
    at org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:99) [resteasy-jaxrs-3.0.10.Final.jar:]
    at org.jboss.resteasy.core.SynchronousDispatcher.writeResponse(SynchronousDispatcher.java:427) [resteasy-jaxrs-3.0.10.Final.jar:]
    ... 32 more
@Shredder121

This comment has been minimized.

Show comment
Hide comment
@Shredder121

Shredder121 Feb 18, 2015

Member

It seems to me that something goes wrong with jackson and resteasy.
There seems to be a serializer, (UnknownSerializer) that just throws exceptions.

see complete backtrace here

Member

Shredder121 commented Feb 18, 2015

It seems to me that something goes wrong with jackson and resteasy.
There seems to be a serializer, (UnknownSerializer) that just throws exceptions.

see complete backtrace here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment