DominoKit / domino-jackson

Jackson with Annotation processing
Apache License 2.0
54 stars 14 forks source link

Keep getting this error "Tracing compile failure path for type 'com.fasterxml.jackson.annotation.ObjectIdGenerators_Base_FieldSerializer'" The type com.fasterxml.jackson.annotation.ObjectIdGenerators.Base is not visible #84

Closed p4535992 closed 7 months ago

p4535992 commented 7 months ago

I Keep getting this error "Tracing compile failure path for type 'com.fasterxml.jackson.annotation.ObjectIdGenerators_Base_FieldSerializer'" but i canont understand why...

I'm using a older version 1.0.1 (because i'm still using gwt 2.9.0) maybe is that ?

[INFO]    Adding '3' new generated units
[INFO]       Tracing compile failure path for type 'com.fasterxml.jackson.annotation.ObjectIdGenerators_Base_FieldSerializer'
[INFO]          [ERROR] Errors in 'D:\ws-6.1\7.4\webdesktop-Sviluppo740\webdesktop-client\target\gwt\gen\com\fasterxml\jackson\annotation\ObjectIdGenerators_Base_FieldSerializer.java'
[INFO]             [ERROR] Line 15: The type com.fasterxml.jackson.annotation.ObjectIdGenerators.Base is not visible
[INFO]             [ERROR] Line 10: The type com.fasterxml.jackson.annotation.ObjectIdGenerators.Base is not visible
[INFO]    [ERROR] Errors in 'D:\ws-6.1\7.4\webdesktop-Sviluppo740\webdesktop-client\target\gwt\gen\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

if i add a jackson depednnecy to the pom.xml the error change to this:

[INFO]    Tracing compile failure path for type 'com.fasterxml.jackson.annotation.JsonAutoDetect'
[INFO]       [ERROR] Errors in 'jar:file:/D:/R/com/fasterxml/jackson/core/jackson-annotations/2.9.6/jackson-annotations-2.9.6-sources.jar!/com/fasterxml/jackson/annotation/JsonAutoDetect.java'
[INFO]          [ERROR] Line 323: The method format(String, JsonAutoDetect.Visibility, JsonAutoDetect.Visibility, JsonAutoDetect.Visibility, JsonAutoDetect.Visibility, JsonAutoDetect.Visibility) is undefined for the type String
[INFO]    Tracing compile failure path for type 'com.fasterxml.jackson.annotation.JsonSetter'
[INFO]       [ERROR] Errors in 'jar:file:/D:/R/com/fasterxml/jackson/core/jackson-annotations/2.9.6/jackson-annotations-2.9.6-sources.jar!/com/fasterxml/jackson/annotation/JsonSetter.java'
[INFO]          [ERROR] Line 246: The method format(String, Nulls, Nulls) is undefined for the type String
[INFO]    Tracing compile failure path for type 'com.fasterxml.jackson.annotation.ObjectIdGenerator'
[INFO]       [ERROR] Errors in 'jar:file:/D:/R/com/fasterxml/jackson/core/jackson-annotations/2.9.6/jackson-annotations-2.9.6-sources.jar!/com/fasterxml/jackson/annotation/ObjectIdGenerator.java'
[INFO]          [ERROR] Line 180: The method format(String, Object, ((type == null) ? "NONE" : type.getName()), ((scope == null) ? "NONE" : scope.getName())) is undefined for the type String
[INFO]    Tracing compile failure path for type 'com.fasterxml.jackson.annotation.JsonIgnoreProperties'
[INFO]       [ERROR] Errors in 'jar:file:/D:/R/com/fasterxml/jackson/core/jackson-annotations/2.9.6/jackson-annotations-2.9.6-sources.jar!/com/fasterxml/jackson/annotation/JsonIgnoreProperties.java'
[INFO]          [ERROR] Line 372: The method format(String, Set<String>, boolean, boolean, boolean, boolean) is undefined for the type String

did you know any work around for this ?

Here the full pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
      <groupId>com.xxx.webdesktop</groupId>
      <artifactId>webdesktop</artifactId>
      <version>1.0.0-SNAPSHOT</version>
  </parent>

  <groupId>com.xxx.webdesktop</groupId>
  <artifactId>webdesktop-client</artifactId>
  <packaging>gwt-app</packaging>

  <dependencyManagement>
      <dependencies>
            <dependency>
                <groupId>javax.validation</groupId>
                <artifactId>validation-api</artifactId>
                <version>${javax.validation-api-for-gwt-290.version}</version>
            </dependency>
            <dependency>
                <groupId>javax.validation</groupId>
                <artifactId>validation-api</artifactId>
                <version>${javax.validation-api-for-gwt-290.version}</version>
                <classifier>sources</classifier>
            </dependency>

            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-annotations</artifactId>
                <version>${jackson-for-gwt-290.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson-for-gwt-290.version}</version>
            </dependency>

      </dependencies>
  </dependencyManagement>

  <dependencies>

    <!-- ==================== -->
    <!-- MY DEPENDENCIES     -->
    <!-- ==================== -->

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>webdesktop-shared</artifactId>
      <version>${project.version}</version>
      <scope>compile</scope>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>webdesktop-shared</artifactId>
      <version>${project.version}</version>
      <classifier>sources</classifier>
      <scope>compile</scope>
    </dependency>

    <!-- ==================== -->
    <!-- GWT SUPPORT                 -->
    <!-- ==================== -->

    <dependency>
       <groupId>com.google.gwt</groupId>
      <artifactId>gwt-user</artifactId>
    </dependency>
    <dependency>
       <groupId>com.google.gwt</groupId>
      <artifactId>gwt-dev</artifactId>
    </dependency>

    <!-- ================================ -->
    <!-- GXT SUPPORT  -->
    <!-- ================================ -->

    <dependency>
      <groupId>com.sencha.gxt</groupId>
      <artifactId>gxt</artifactId>
      <version>${gxt.version}</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.sencha.gxt</groupId>
      <artifactId>gxt-chart</artifactId>
      <version>${gxt.version}</version>
      <scope>compile</scope>
    </dependency>
    <!-- Neptune Theme -->
    <dependency>
      <groupId>com.sencha.gxt</groupId>
      <artifactId>gxt-theme-neptune</artifactId>
      <version>${gxt.version}</version>
      <scope>compile</scope>
    </dependency>
    <!-- Triton Theme -->
    <dependency>
      <groupId>com.sencha.gxt</groupId>
      <artifactId>gxt-theme-triton</artifactId>
      <version>${gxt.version}</version>
      <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.dominokit</groupId>
        <artifactId>domino-jackson</artifactId>
    </dependency>
    <dependency>
        <groupId>org.dominokit</groupId>
        <artifactId>domino-jackson-processor</artifactId>
        <scope>provided</scope>
    </dependency>

    <!-- ================================ -->
    <!-- OTHER -->
    <!-- ================================ -->

    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava-gwt</artifactId>
      <scope>compile</scope>
    </dependency>

    <!-- ==================== -->
    <!-- TEST                 -->
    <!-- ==================== -->

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
      <version>4.13</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>net.ltgt.gwt.maven</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <configuration>
          <moduleName>com.xxx.webdesktop.DesktopApp</moduleName>
          <moduleShortName>DesktopApp</moduleShortName>
          <jvmArgs>
            <arg>-Xms1024m</arg>
            <arg>-Xmx16384m</arg>
          </jvmArgs>
          <localWorkers>5</localWorkers>
          <logLevel>WARN</logLevel>
          <style>OBF</style>
          <!--          <style>PRETTY</style>-->
          <failOnError>true</failOnError>
          <codeserverArgs>
            <arg>-strict</arg>
          </codeserverArgs>
          <devmodeArgs>
            <arg>-strict</arg>
          </devmodeArgs>
          <workDir>${basedir}/target/gwt/workDir</workDir>
          <compilerArgs>
            <arg>-gen</arg>
            <arg>${basedir}/target/gwt/gen</arg>
          </compilerArgs>
        </configuration>
      </plugin>
      <plugin>
        <groupId>pl.project13.maven</groupId>
        <artifactId>git-commit-id-plugin</artifactId>
        <version>3.0.1</version>
        <executions>
          <execution>
            <id>get-the-git-infos</id>
            <goals>
              <goal>revision</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <dotGitDirectory>${project.parent.basedir}/.git</dotGitDirectory>
          <generateGitPropertiesFile>true</generateGitPropertiesFile>
          <format>json</format>
          <gitDescribe>
            <skip>false</skip>
            <always>false</always>
            <dirty>-dirty</dirty>
          </gitDescribe>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
            <execution>
                <id>attach-sources</id>
                <goals>
                    <goal>jar</goal>
                </goals>
            </execution>
        </executions>
       </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                         <goal>war</goal>
                    </goals>
                    <phase>package</phase>
                </execution>
            </executions>
            <configuration>
                <warSourceIncludes>WEB-INF/**,META-INF/**</warSourceIncludes>
                <failOnMissingWebXml>false</failOnMissingWebXml>
                <attachClasses>true</attachClasses>
                <classesClassifier>classes</classesClassifier>
                <!--  Optionally specify extra resources to include --> 
                <!--                        
                <webResources>
                        <resource>
                          <directory>src/main/resources</directory>
                          <targetPath>WEB-INF</targetPath>
                          <includes>
                            <include>**/*</include>
                          </includes>
                        </resource>
                </webResources>     
                -->
                <!-- Exclude JCL and LOG4J since all logging should go through SLF4J. Note 
                    that we're excluding log4j-<version>.jar but keeping log4j-over-slf4j-<version>.jar -->
                <packagingExcludes>
                    WEB-INF/lib/commons-logging-*.jar,
                    %regex[WEB-INF/lib/log4j-(?!over-slf4j).*.jar]
                </packagingExcludes>                
                <archive>
                    <manifestEntries>
                        <Implementation-Version>${project.version}</Implementation-Version>
                        <Build-Date>${maven.build.timestamp}</Build-Date>
                        <Build-Name>${project.artifactId}</Build-Name>
                        <Build-Key>${project.artifactId}</Build-Key>
                        <Build-Number>${project.version}</Build-Number>
                        <Build-Revision>${project.version}</Build-Revision>
                    </manifestEntries>
                    <manifestSections>
                        <manifestSection>
                            <name>Libraries</name>
                            <manifestEntries></manifestEntries>
                        </manifestSection>
                    </manifestSections>
                    <manifest>
                        <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                    </manifest>
                </archive>                            
            </configuration>
        </plugin>
    </plugins>
  </build>

  <profiles>    
        <profile>
            <id>gwt-dev</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>net.ltgt.gwt.maven</groupId>
                        <artifactId>gwt-maven-plugin</artifactId>
                        <configuration>
                          <moduleName>com.xxx.webdesktop.DesktopApp</moduleName>
                          <moduleShortName>DesktopApp</moduleShortName>
                          <jvmArgs>
                            <arg>-Xms1024m</arg>
                            <arg>-Xmx16384m</arg>
                          </jvmArgs>
                          <localWorkers>5</localWorkers>
                          <logLevel>WARN</logLevel>
                          <style>DETAILED</style>
                          <failOnError>true</failOnError>
                          <codeserverArgs>
                            <arg>-strict</arg>
                          </codeserverArgs>
                          <devmodeArgs>
                            <arg>-strict</arg>
                          </devmodeArgs>
                          <workDir>${basedir}/target/gwt/workDir</workDir>
                          <compilerArgs>
                            <arg>-gen</arg>
                            <arg>${basedir}/target/gwt/gen</arg>
                          </compilerArgs>
                        </configuration>
                      </plugin>
                </plugins>
            </build>
        </profile>
  </profiles>
</project>
p4535992 commented 7 months ago

For anyone interested solved with this workaround: https://github.com/nmorel/gwt-jackson/issues/23

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.*"/>

niloc132 commented 7 months ago

@p4535992 can you confirm that this is only true if your RPC types are either using raw generics, or have a field of type Serializable that is reachable from your RPC types?

RPC definitely does not create serializer/deserializers for all types that implement Serializable, only the reachable ones - and using raw generics or referencing Serializable will end up greatly increasing the size of your TypeSerializer, because all the various unused, unrelated types (see for example GWT's Style.Unit and other enums, ListEditorWrapper in editors, etc). The presence of those types will make your compile take longer, and will produce larger JS output, it is better to give more accurate types/generics to avoid them.

p4535992 commented 7 months ago

I'm not sure about anything... but I haven't found another way to avoid this error. If you can point me to some reference project I can try to investigate otherwise I don't know