Interesting, our java Serialization integration tests work smoothly. Is
Storm using standard Java Serialization? Could you perhaps show a minimal
example that reproduces this behaviour on your side? Here's our current
integration test, for the record:

    public void testSerialisation() throws Exception {
        jOOQAbstractTest.reset = false;

        Select<A> q =
create().selectFrom(TAuthor()).orderBy(TAuthor_LAST_NAME());

        // Serialising the unexecuted query
        //
---------------------------------------------------------------------
        q = runSerialisation(q);

        try {
            q.execute();
            fail();
        } catch (DetachedException expected) {}

        // Serialising the executed query
        //
---------------------------------------------------------------------
        create().attach(q);
        assertEquals(2, q.execute());
        assertEquals("Coelho", q.getResult().getValue(0,
TAuthor_LAST_NAME()));
        assertEquals("Orwell", q.getResult().getValue(1,
TAuthor_LAST_NAME()));

        q = runSerialisation(q);
        assertEquals("Coelho", q.getResult().getValue(0,
TAuthor_LAST_NAME()));
        assertEquals("Orwell", q.getResult().getValue(1,
TAuthor_LAST_NAME()));

        Result<A> result = q.getResult();
        result = runSerialisation(result);
        assertEquals("Coelho", result.getValue(0, TAuthor_LAST_NAME()));
        assertEquals("Orwell", result.getValue(1, TAuthor_LAST_NAME()));

        try {
            result.get(1).setValue(TAuthor_FIRST_NAME(), "Georgie");
            result.get(1).store();
            fail();
        } catch (DetachedException expected) {}

        create().attach(result);
        assertEquals(1, result.get(1).store());
        assertEquals("Georgie", create()
                .fetchOne(TAuthor(), TAuthor_LAST_NAME().equal("Orwell"))
                .getValue(TAuthor_FIRST_NAME()));

        // [#1191] Check execution capabilities with new features in
ExecuteListener
        ConnectionProviderListener.c =
create().configuration().connectionProvider().acquire();
        try {
            DSLContext create = create(new ConnectionProviderListener());
            q = create
                    .selectFrom(TAuthor())
                    .orderBy(TAuthor_LAST_NAME());
            q = runSerialisation(q);
            q.execute();

            result = q.getResult();
            result = runSerialisation(result);
            assertEquals("Coelho", result.getValue(0, TAuthor_LAST_NAME()));
            assertEquals("Orwell", result.getValue(1, TAuthor_LAST_NAME()));

            result.get(1).setValue(TAuthor_FIRST_NAME(), "Gee-Gee");
            result.get(1).store();
        }
        finally {

create().configuration().connectionProvider().release(ConnectionProviderListener.c);
            ConnectionProviderListener.c = null;
        }

        // [#1071] Check sequences
        if (cSequences() == null) {
            log.info("SKIPPING", "sequences test");
        }
        else {
            Select<?> s;

            s = create().select(SAuthorID().nextval(),
SAuthorID().currval());
            s = runSerialisation(s);
        }
    }

    public static class ConnectionProviderListener extends
DefaultExecuteListener {

        /**
         * Generated UID
         */
        private static final long serialVersionUID = 7399239846062763212L;

        static Connection c;

        @Override
        public void start(ExecuteContext ctx) {
            ctx.connectionProvider(new DefaultConnectionProvider(c));
        }
    }

    @SuppressWarnings("unchecked")
    private <Z> Z runSerialisation(Z value) throws Exception {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ObjectOutputStream o = new ObjectOutputStream(out);
        o.writeObject(value);
        o.flush();

        ByteArrayInputStream in = new
ByteArrayInputStream(out.toByteArray());
        ObjectInputStream i = new ObjectInputStream(in);
        return (Z) i.readObject();
    }



2015-06-11 17:41 GMT+02:00 Daniel Barbato <[email protected]>:

> Hi,
>
> I'm needing to run JOOQ inside a storm cluster. Storm requires that all
> classes are fully serializable. When attempting to deserialize
> DefaultDSLContext I get the following error:
>
> java.lang.RuntimeException: java.io.InvalidClassException:
> org.jooq.impl.DefaultDSLContext; no valid constructor
>     at
> backtype.storm.serialization.DefaultSerializationDelegate.deserialize(DefaultSerializationDelegate.java:56)
> ~[storm-core-0.9.4.jar:0.9.4] ...
>
> I believe that this is due to org.jooq.impl.AbstractScope vontaining state
> and not having a no-args constructor while not implementing Serializable.
>
> I haven't looked through other class files to see if this is the case
> elsewhere, I also couldn't see anyone else reporting the issue.
>
> Is there a known work around, other than using a third party serialization
> tool?
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to