Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotSerializableException on QTuple$TupleImpl #640

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

NotSerializableException on QTuple$TupleImpl #640

dmiorandi opened this issue Jan 29, 2014 · 7 comments
Milestone

Comments

@dmiorandi
Copy link

@dmiorandi dmiorandi commented Jan 29, 2014

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
Copy link
Member

@timowest timowest commented Jan 30, 2014

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

@dmiorandi
Copy link
Author

@dmiorandi dmiorandi commented 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

@timowest
Copy link
Member

@timowest timowest commented Jan 31, 2014

Yes, sounds good.

timowest added a commit that referenced this issue Feb 1, 2014
@timowest
Copy link
Member

@timowest timowest commented Feb 8, 2014

Released in 3.3.1

@timowest timowest closed this Feb 8, 2014
@dmiorandi
Copy link
Author

@dmiorandi dmiorandi commented Feb 10, 2014

Ok it works

@caarlos0
Copy link

@caarlos0 caarlos0 commented 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
@Shredder121
Copy link
Member

@Shredder121 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
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants