Error using existing JPA annotated classes: contains a (potentially indirect) looping

We are using SmartGWT 2.5 (nightly build). Has anyone seen errors like this:

=== 2011-06-02 17:54:54,863 [l0-4] WARN JSTranslater - com.paceap.eden.smartjpa.SKU_$$javassist_17 contains a (potentially indirect) looping reference to itself. Returning null for recursed value.
=== 2011-06-02 17:54:54,863 [l0-4] WARN JSTranslater - com.paceap.eden.smartjpa.Publisher
$$javassist_18 contains a (potentially indirect) looping reference to itself. Returning null for recursed value.
=== 2011-06-02 17:54:54,863 [l0-4] WARN JSTranslater - com.paceap.eden.smartjpa.Publisher
$$javassist_18 contains a (potentially indirect) looping reference to itself. Returning null for recursed value.
=== 2011-06-02 17:54:54,863 [l0-4] WARN JSTranslater - com.paceap.eden.smartjpa.Publisher
$$javassist_18 contains a (potentially indirect) looping reference to itself. Returning null for recursed value.
=== 2011-06-02 17:54:54,863 [l0-4] WARN JSTranslater - com.paceap.eden.smartjpa.SKU
$$javassist_17 contains a (potentially indirect) looping reference to itself. Returning null for recursed value.
=== 2011-06-02 17:54:54,863 [l0-4] WARN JSTranslater - com.paceap.eden.smartjpa.AuthorizationDef
$$_javassist_37 contains a (potentially indirect) looping reference to itself. Returning null for recursed value.

And, if so, any advice on fixing this?

You’re passing an object model with circular references to DSResponse.setData(). Most likely, you do not want to send subobjects at all, and if so, set dropExtraFields=“true” on the <DataSource> tag to ensure you send only the fields you’ve declared (generally all simple types).

Thanks for the quick reply, however it doesn’t really address our problem.

The entities do not contain “circular” references. One of our entities, SKU has a toMany relationship to other SKUs (subskus), but this set never includes a reference back to the same SKU. None of our existing business logic has any problem with these constructs.

What is more disturbing is that when loading a particular entity, of which there are only 19 in the DB we get page after page of these warnings, each saying “… returning null for recursed value”. The warnings only stop when the java heap space is exhausted, currently set at 1024m.

That aside, we are including the “dropExtraFields=true” setting in the <DataSource> tag and it seems to have no effect on this behavior.

For now we have abandoned the JPA connector, cannot easily use the Hibernate connector and aren’t sure we really want to allow the client direct SQL connectivity (for writes) to the DB, since that would bypass our envers auditing mechanisms. That leaves us with several possibilities, either let the client use the SQL connector for reads and perform inserts & updates through the invocation of server methods or implement a custom DMI based connector that will marshal both reads and writes through our existing JPA annotated classes.

  • Joel -

Just look at the logs:

com.paceap.eden.smartjpa.Publisher_$$_javassist_18

It’s not circularity in the SKUs as such. You’re trying to serialize some internal artifacts (Publisher_$$_javassist_18) related to bytecode generation - could be JPA or something else you’re using, but whatever it is, it’s adding its artifacts as public Java getter/setter pairs, which means that any system that uses Java reflection is going to find them.

If you know what subsystem is doing this, you may be able to get it to stop.

Otherwise, dropExtraFields will work, but only if you are not using schemaBean to automatically generate fields (we can’t auto-generate reasonable fields for you if there’s a bunch of injected artifacts in your beans, indistinguishable from your real properties).