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

GWT compilation fails with com.fasterxml.jackson.annotation.ObjectIdGenerators.Base is not visible #23

Closed
ismagilov opened this issue Jul 22, 2014 · 2 comments
Assignees
Labels

Comments

@ismagilov
Copy link

After we added gwtp-dispatch-rest which depends on gwt-jackson our project GWT compilation started failing with these messages:

[INFO]       Rebinding se.homework.hwbs.common.client.rpc.ProblemReportingRpcService
[INFO]          Invoking generator com.google.gwt.user.rebind.rpc.ServiceInterfaceProxyGenerator
[INFO]             Generating client proxy for remote service interface 'se.homework.hwbs.common.client.rpc.ProblemReportingRpcService'
[INFO]                Analyzing 'se.homework.hwbs.common.client.rpc.ProblemReportingRpcService' for serializable types
[INFO]                   Analyzing methods:
[INFO]                      public abstract void reportProblem(java.lang.String browser, java.lang.String os, java.lang.String userAgent, java.lang.String stepsToReproduce, java.lang.String clientStackTrace, com.allen_sauer.gwt.log.shared.WrappedClientThrowable exception, com.google.gwt.core.client.GwtContext context)
[INFO]                         Parameter: com.google.gwt.core.client.GwtContext context
[INFO]                            com.google.gwt.core.client.GwtContext
[INFO]                               Verifying instantiability
[INFO]                                  com.google.gwt.core.client.GwtContext
[INFO]                                     Analyzing the fields of type 'com.google.gwt.core.client.GwtContext' that qualify for serialization
[INFO]                                        private java.util.List<java.io.Serializable> log
[INFO]                                           java.util.List<java.io.Serializable>
[INFO]                                              Verifying instantiability
[INFO]                                                 java.util.Collections.SingletonList<java.io.Serializable>
[INFO]                                                    Checking parameters of 'java.util.Collections.SingletonList<java.io.Serializable>'
[INFO]                                                       Checking type argument 0 of type 'java.util.Collections.SingletonList<E>' because it is directly exposed in this type or in one of its subtypes
[INFO]                                                          java.io.Serializable
[INFO]                                                             Verifying instantiability
[INFO]                                                                com.google.common.collect.RegularImmutableSortedMap<? extends java.lang.Object, ? extends java.lang.Object>
[INFO]                                                                   [WARN] Checking all subtypes of Object which qualify for serialization
[INFO]                                                                      com.fasterxml.jackson.annotation.ObjectIdGenerator<T>
[INFO]                                                                         Verifying instantiability
[INFO]                                                                            com.fasterxml.jackson.annotation.ObjectIdGenerators.UUIDGenerator
[INFO]                                                                               Analyzing the fields of type 'com.fasterxml.jackson.annotation.ObjectIdGenerators.Base<java.util.UUID>' that qualify for serialization
[INFO]                                                                                  [WARN] Field 'protected final java.lang.Class<?> _scope' will not be serialized because it is final
[INFO]                                                                            com.fasterxml.jackson.annotation.ObjectIdGenerators.IntSequenceGenerator
[INFO]                                                                               Analyzing the fields of type 'com.fasterxml.jackson.annotation.ObjectIdGenerators.Base<java.lang.Integer>' that qualify for serialization
[INFO]                                                                                  [WARN] Field 'protected final java.lang.Class<?> _scope' will not be serialized because it is final
[INFO]                                                                      java.lang.Exception
[INFO]                                                                         Verifying instantiability
[INFO]                                                                            se.homework.hwbs.domain.shared.OutdatedProxyVersionException
[INFO]                                                                               Analyzing the fields of type 'se.homework.hwbs.domain.shared.OutdatedProxyVersionException' that qualify for serialization
[INFO]                                                                                  [WARN] Field 'public final boolean optimisticLocking' will not be serialized because it is final
[INFO]                                                                      se.homework.hwbs.domain.shared.util.FunctionUtils.Constant<Q, E>
[INFO]                                                                         Verifying instantiability
[INFO]                                                                            se.homework.hwbs.domain.shared.util.FunctionUtils.Constant<Q, E>
[INFO]                                                                               Analyzing the fields of type 'se.homework.hwbs.domain.shared.util.FunctionUtils.Constant<Q, E>' that qualify for serialization
[INFO]                                                                                  [WARN] Field 'private final E value' will not be serialized because it is final
[INFO]                                                                      com.google.gwt.validation.client.impl.PathImpl
[INFO]                                                                         Verifying instantiability
[INFO]                                                                            com.google.gwt.validation.client.impl.PathImpl
[INFO]                                                                               Analyzing the fields of type 'com.google.gwt.validation.client.impl.PathImpl' that qualify for serialization
[INFO]                                                                                  [WARN] Field 'private final java.util.List<javax.validation.Path.Node> nodes' will not be serialized because it is final
[INFO]                                                                se.homework.hwbs.domain.shared.util.FunctionUtils.Constant<? extends java.lang.Object, ? extends java.lang.Object>
[INFO]                                                                   Analyzing the fields of type 'se.homework.hwbs.domain.shared.util.FunctionUtils.Constant<? extends java.lang.Object, ? extends java.lang.Object>' that qualify for serialization
[INFO]                                                                      [WARN] Field 'private final E value' will not be serialized because it is final
[INFO]    Adding '879' new generated units
[INFO]       Validating units:
[INFO]          [ERROR] Errors in '.../target/.generated/com/fasterxml/jackson/annotation/ObjectIdGenerators_Base_FieldSerializer.java'
[INFO]             [ERROR] Line 10: The type com.fasterxml.jackson.annotation.ObjectIdGenerators.Base is not visible
[INFO]             [ERROR] Line 15: The type com.fasterxml.jackson.annotation.ObjectIdGenerators.Base is not visible
[INFO]             See snapshot: /tmp/com.fasterxml.jackson.annotation.ObjectIdGenerators_Base_FieldSerializer1719221523098467839.java
[INFO]    [ERROR] Errors in '.../target/.generated/com/fasterxml/jackson/annotation/ObjectIdGenerators_Base_FieldSerializer.java'
[INFO]       [ERROR] Line 10: The type com.fasterxml.jackson.annotation.ObjectIdGenerators.Base is not visible
[INFO]       [ERROR] Line 15: The type com.fasterxml.jackson.annotation.ObjectIdGenerators.Base is not visible
[INFO]       See snapshot: /tmp/com.fasterxml.jackson.annotation.ObjectIdGenerators_Base_FieldSerializer8805528719787639687.java

Meaningful project dependencies:

com.gwtplatform:gwtp-dispatch-rest:1.2.1
  com.gwtplatform:gwtp-clients-common:1.2.1
    org.apache.maven:maven-artifact:3.1.1
      org.codehaus.plexus:plexus-utils:3.0.15
  com.gwtplatform:gwtp-dispatch-common-client:1.2.1
    com.gwtplatform:gwtp-dispatch-common-shared:1.2.1
  com.github.nmorel.gwtjackson:gwt-jackson:0.4.0
    com.fasterxml.jackson.core:jackson-annotations:sources:2.3.0

Probably, this issue is somehow related to issue #3. But that was fixed in 0.2.0. Our project transitively depends on 0.4.0. We tried to fix the problem by upgrading maven dependencies to their latest releases and even snapshots, but it didn`t help.

Is it a bug or error in our configuration?

I could be wrong, but it seems like some kind JSON-related auxiliary classes are generated while GWT compiles our GWT standard RPC services. I am not sure that we actually need it. So any suggested workarounds are highly appreciated!

@nmorel
Copy link
Owner

nmorel commented Jul 22, 2014

Hi,

You have a RPC service using a java.io.Serializable. As a consequence, GWT creates serializer/deserializer for the class that implements java.io.Serializable and fails when reaching ObjectIdGenerators.Base.

As a workaround, you can blacklist the class from RPC in your *.gwt.xml :

<extend-configuration-property name="rpc.blacklist" value="com.fasterxml.*"/>

I'll add it to the GwtJackson.gwt.xml or super source the class to remove the java.io.Serializable.

@nmorel nmorel added the bug label Jul 22, 2014
@nmorel nmorel self-assigned this Jul 22, 2014
@ismagilov
Copy link
Author

Thanks a lot for quick answer! Your workaround worked like a charm :)

nmorel added a commit that referenced this issue Jul 27, 2014
ObjectIdGenerators.Base is included in GWT, implements Serializable but is not visible.
When a RPC uses Object or Serializable, it fails to generate.
To fix it, we blacklist Jackson classes from RPC.
@nmorel nmorel closed this as completed Jul 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants