nmorel / gwt-jackson

gwt-jackson is a JSON parser for GWT. It uses Jackson 2.x annotations to customize the serialization/deserialization process.
Apache License 2.0
111 stars 55 forks source link

Issues when Compiling #24

Closed BenDol closed 10 years ago

BenDol commented 10 years ago

Hey I am using 0.6.2 and getting these errors on compile: http://pastebin.com/vKJneM4x Not sure why this is happening. Here is the implementation:

<module rename-to="ims">
    <!-- Inherit the core Web Toolkit stuff -->
    <inherits name="com.google.gwt.user.User" />
    <inherits name="com.google.gwt.logging.Logging"/>

    <set-property name="gwt.logging.consoleHandler" value="DISABLED"/>
    <set-property name="gwt.logging.popupHandler" value="DISABLED" />

    <extend-property name="locale" values="en"></extend-property>

    <!-- Core module inherits -->
    <inherits name="nz.co.doltech.framework.module.Framework" />
    <inherits name="nz.co.doltech.ims.Resources" />

    <!-- Theme module inherits -->
    <inherits name="nz.co.doltech.framework.themes.SyrenaTheme"/>

    <!-- GXT -->
    <!--stylesheet src="reset.css" /-->
    <!--inherits name='com.sencha.gxt.ui.GXT' /-->

    <!-- GXT Theme -->
    <!-- <inherits name='com.sencha.gxt.theme.blue.Blue'/> -->
    <!-- <inherits name='com.sencha.gxt.theme.gray.Gray' /> -->
    <!--inherits name="com.sencha.gxt.theme.neptune.Theme" /-->

    <!-- Library module inherits -->
    <inherits name="com.gwtplatform.dispatch.rest.DispatchRest"/>
    <inherits name="com.gwtplatform.mvp.Mvp"/>
    <inherits name="com.gwtplatform.dispatch.rpc.DispatchRpc"/>
    <inherits name="com.google.gwt.uibinder.UiBinder"/>
    <inherits name="com.google.gwt.query.Query"/>

    <inherits name="org.gwtbootstrap3.GwtBootstrap3CDN"/>
    <inherits name="nz.co.doltech.framework.extensions.gwtbootstrap3.datepicker.Datepicker"/>

    <inherits name="org.atmosphere.gwt.Client"/>

    <replace-with class="org.atmosphere.gwt.client.impl.IEHTMLFileCometTransport">
      <when-type-is class="org.atmosphere.gwt.client.impl.CometTransport"/>
      <any>
        <when-property-is name="user.agent" value="ie6"/>
        <when-property-is name="user.agent" value="ie8"/>
        <when-property-is name="user.agent" value="ie9"/>
      </any>
    </replace-with>

    <!-- Framework module inherits -->
    <inherits name="nz.co.doltech.framework.libraries.maydu.validation.ValidationLibrary" />
    <inherits name="nz.co.doltech.framework.libraries.chosen.Chosen" />

    <!-- Module entry point -->
    <entry-point class="nz.co.doltech.ims.client.Application"/>

    <set-configuration-property name="gin.ginjector.modules" 
        value="nz.co.doltech.ims.client.gin.ClientModule" />

    <set-configuration-property name="gwtp.bootstrapper"  
         value="nz.co.doltech.ims.client.BootstrapperImpl"/>

    <set-configuration-property name="gwtp.prebootstrapper"  
         value="nz.co.doltech.ims.client.BootstrapperImpl.PreBootstrapperImpl"/>

    <extend-configuration-property name="document.compatMode" value="BackCompat" />

    <!-- Specify the paths for translatable code -->
    <source path="client" />
    <source path="shared" />

    <generate-with class="com.google.gwt.uibinder.rebind.FixedUiBinderGenerator">
        <when-type-assignable class="com.google.gwt.uibinder.client.UiBinder"/>
    </generate-with>

    <!-- RPC Serialization Ignores -->
    <extend-configuration-property name="rpc.blacklist" value="javax.*"/>
    <extend-configuration-property name="rpc.blacklist" value="com.google.gwt.user.client.ui.*"/>
    <extend-configuration-property name="rpc.blacklist" value="com.google.gwt.query.client.*"/>
    <extend-configuration-property name="rpc.blacklist" value="com.google.gwt.aria.client.*"/>
    <extend-configuration-property name="rpc.blacklist" value="com.google.gwt.dom.client.*"/>
    <extend-configuration-property name="rpc.blacklist" value="com.google.gwt.validation.client.*"/>
    <extend-configuration-property name="rpc.blacklist" value="nz.co.doltech.framework.extensions.gwtbootstrap3.client.*"/>
    <extend-configuration-property name="rpc.blacklist" value="nz.co.doltech.framework.libraries.maydu.validation.client.*"/>
    <extend-configuration-property name="rpc.blacklist" value="nz.co.doltech.framework.themes.syrena.ui.*"/>
</module>

com.gwtplatform.dispatch.rest.DispatchRest

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.6.1//EN"
        "https://raw.githubusercontent.com/gwtproject/gwt/2.6.1/distro-source/core/src/gwt-module.dtd">
<module>
    <inherits name="com.gwtplatform.common.ClientsCommon"/>
    <inherits name="com.gwtplatform.dispatch.DispatchCommonClient"/>
    <inherits name="com.google.common.base.Base"/>
    <inherits name="com.google.common.collect.Collect"/>
    <inherits name="com.google.gwt.inject.Inject"/>

    <inherits name="com.google.gwt.http.HTTP"/>
    <inherits name="com.google.gwt.json.JSON"/>
    <inherits name="com.github.nmorel.gwtjackson.GwtJackson"/>

    <!-- Specify the paths for translatable code -->
    <source path='client'/>
    <source path='shared'/>

    <entry-point class='com.gwtplatform.dispatch.rest.client.RestDispatcherController'/>

    <extend-configuration-property name="gin.classloading.exceptedPackages" value="javax.ws.rs"/>

    <extend-configuration-property name="gin.ginjector.modules"
            value="com.gwtplatform.dispatch.rest.client.RestGinModule"/>

    <generate-with class="com.gwtplatform.dispatch.rest.rebind.VelocityGenerator">
        <when-type-is class="com.gwtplatform.dispatch.rest.client.RestDispatcherController"/>
    </generate-with>
</module>

That's it. I use Ivy dependency manager and all the jars are i the classpath and war (webapp) directory. Not sure what is going on here.

     [java]          Invoking generator com.google.gwt.inject.rebind.GinjectorGenerator
     [java]             [ERROR] Error injecting com.gwtplatform.dispatch.rest.client.ActionMetadataProvider: Unable to create or inherit binding: No @Inject or default constructor found for com.gwtplatform.dispatch.rest.client.ActionMetadataProvider
     [java]   Path to required node:
     [java] com.gwtplatform.dispatch.rest.client.RestRequestBuilderFactory [com.gwtplatform.dispatch.rest.client.gin.RestDispatchAsyncModule.configureDispatch(RestDispatchAsyncModule.java:100)]
     [java]  -> com.gwtplatform.dispatch.rest.client.DefaultRestRequestBuilderFactory [com.gwtplatform.dispatch.rest.client.gin.RestDispatchAsyncModule.configureDispatch(RestDispatchAsyncModule.java:100)]
     [java]  -> com.gwtplatform.dispatch.rest.client.ActionMetadataProvider [@Inject constructor of com.gwtplatform.dispatch.rest.client.DefaultRestRequestBuilderFactory]
     [java]             [ERROR] Error injecting com.gwtplatform.dispatch.rest.client.serialization.JacksonMapperProvider: Unable to create or inherit binding: No @Inject or default constructor found for com.gwtplatform.dispatch.rest.client.serialization.JacksonMapperProvider
     [java]   Path to required node:
     [java] com.gwtplatform.dispatch.rest.client.serialization.Serialization [com.gwtplatform.dispatch.rest.client.gin.RestDispatchAsyncModule.configureDispatch(RestDispatchAsyncModule.java:104)]
     [java]  -> com.gwtplatform.dispatch.rest.client.serialization.JsonSerialization [com.gwtplatform.dispatch.rest.client.gin.RestDispatchAsyncModule.configureDispatch(RestDispatchAsyncModule.java:104)]
     [java]  -> com.gwtplatform.dispatch.rest.client.serialization.JacksonMapperProvider [@Inject constructor of com.gwtplatform.dispatch.rest.client.serialization.JsonSerialization]
     [java]    [ERROR] Errors in 'gen/com/gwtplatform/mvp/client/DesktopGinjectorProvider.java'
     [java]       [ERROR] Line 8: Failed to resolve 'com.gwtplatform.mvp.client.DesktopGinjector' via deferred binding
nmorel commented 10 years ago

Do you have any ObjectMapper declared ? Or you get this error just when adding the com.gwtplatform.dispatch.rest.DispatchRest ?

Which version of gwtp are you using ? There was a problem with an older version when having both rpc and rest dispatcher.

BenDol commented 10 years ago

Using version 1.3.1 I am only declaring com.gwtplatform.dispatch.rest.DispatchRest module and also created some GWTP rest "services" on the client side (so the generator will pick them up). That is all.

BenDol commented 10 years ago
     [java]          Invoking generator com.google.gwt.inject.rebind.GinjectorGenerator
     [java]             [ERROR] Error injecting com.gwtplatform.dispatch.rest.client.ActionMetadataProvider: Unable to create or inherit binding: No @Inject or default constructor found for com.gwtplatform.dispatch.rest.client.ActionMetadataProvider
     [java]   Path to required node:
     [java] com.gwtplatform.dispatch.rest.client.RestRequestBuilderFactory [com.gwtplatform.dispatch.rest.client.gin.RestDispatchAsyncModule.configureDispatch(RestDispatchAsyncModule.java:100)]
     [java]  -> com.gwtplatform.dispatch.rest.client.DefaultRestRequestBuilderFactory [com.gwtplatform.dispatch.rest.client.gin.RestDispatchAsyncModule.configureDispatch(RestDispatchAsyncModule.java:100)]
     [java]  -> com.gwtplatform.dispatch.rest.client.ActionMetadataProvider [@Inject constructor of com.gwtplatform.dispatch.rest.client.DefaultRestRequestBuilderFactory]
     [java]             [ERROR] Error injecting com.gwtplatform.dispatch.rest.client.serialization.JacksonMapperProvider: Unable to create or inherit binding: No @Inject or default constructor found for com.gwtplatform.dispatch.rest.client.serialization.JacksonMapperProvider
     [java]   Path to required node:
     [java] com.gwtplatform.dispatch.rest.client.serialization.Serialization [com.gwtplatform.dispatch.rest.client.gin.RestDispatchAsyncModule.configureDispatch(RestDispatchAsyncModule.java:104)]
     [java]  -> com.gwtplatform.dispatch.rest.client.serialization.JsonSerialization [com.gwtplatform.dispatch.rest.client.gin.RestDispatchAsyncModule.configureDispatch(RestDispatchAsyncModule.java:104)]
     [java]  -> com.gwtplatform.dispatch.rest.client.serialization.JacksonMapperProvider [@Inject constructor of com.gwtplatform.dispatch.rest.client.serialization.JsonSerialization]
     [java]    [ERROR] Errors in 'gen/com/gwtplatform/mvp/client/DesktopGinjectorProvider.java'
     [java]       [ERROR] Line 8: Failed to resolve 'com.gwtplatform.mvp.client.DesktopGinjector' via deferred binding
nmorel commented 10 years ago

You also declare com.gwtplatform.dispatch.rpc.DispatchRpc in your gwt.xml. Did you try with one simple rest service first ? It seems like a configuration problem of gwtp. Maybe you should also ask on their forum.

A quick search on your error gives http://stackoverflow.com/questions/22578452/how-do-i-use-gwtp-with-ginjector-extensions.

BenDol commented 10 years ago

That stackoverflow isn't quite the same as my issue. But appreciate you taking the time to help me out here. What do you mean by try one simple rest service first?

nmorel commented 10 years ago

You said you "created some GWTP rest "services"". Did you try with only one simple rest service ? Like a service with only a get method returning a "Hello World!" ?

I didn't use a lot GWTP so I'm not sure how you should configure it. It's working on my current project and I simply followed their wiki.

i see you have <set-configuration-property name="gin.ginjector.modules" value="nz.co.doltech.ims.client.gin.ClientModule" />. From their wiki :

If you are using a generated GINjector and have something similar to
<set-configuration-property name="gin.ginjector.modules"
                            value="com.gwtplatform.carstore.client.gin.SharedModule"/>
You need to change set-configuration-property to extend-configuration-property
BenDol commented 10 years ago

I just deleted my services to just get it compiling and it still throws 100s of the same error message above. Same with extend-configuration-property, still not working.

[WARN] Unknown type 'com.github.nmorel.gwtjackson.client.ObjectWriter' specified in deferred binding rule

I don't understand this at all. I have the sources and never had troubles compiling like this before.

.. other tasks ..

<!--
  ================================
     Build Application Binaries
  ================================
  -->

  <target name="javac" depends="tests" description="Compile java source">
    <mkdir dir="war/WEB-INF/classes" />
    <javac srcdir="src" includes="**" encoding="utf-8" destdir="war/WEB-INF/classes" source="1.7" target="1.7"
        nowarn="true" debug="true" debuglevel="lines,vars,source" includeantruntime="false">
      <classpath refid="project.class.path" />
      <classpath refid="tomcat.libs"/>
    </javac>
    <copy todir="war/WEB-INF/classes">
      <fileset dir="src" excludes="**/*.java" />
      <fileset dir="resources" excludes="**/*.java" />
      <fileset dir="database" excludes="**/*.java" />
    </copy>
  </target>

  <target name="gwtc" depends="javac" description="GWT compile to JavaScript">
    <java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler" maxmemory="512m">
      <classpath>
        <pathelement location="src"/>
        <path refid="project.class.path"/>
      </classpath>
      <arg value="-war"/>
      <arg value="war"/>

      <!--arg value="-strict" /-->

      <!-- Logging level arguments -->
      <!--arg value="-logLevel" />
      <arg value="ERROR" /-->

      <!-- Optimization arguments -->
      <!--arg value="-XenableClosureCompiler"/>
      <arg value="-XdisableClassMetadata"/-->

      <!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
      <jvmarg value="-Xmx512M"/>

      <!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
      <arg value="nz.co.doltech.framework.module.Framework"/>
      <arg value="nz.co.doltech.framework.login.Login"/>
      <arg value="nz.co.doltech.ims.Ims"/>
    </java>
  </target>

  <target name="build" depends="gwtc" description="Build web application entry point"/>

.. other tasks ..

This is my build command

nmorel commented 10 years ago

Were you using GWTP rpc dispatcher and mvp module with success before ? If you remove the rest dispatcher module, your project compile ?

You should definitely ask to gwtp team. It seems you are using their ginjector generation seeing your bootstraper configuration. I only used the rest dispatcher module so I don't really know what's going on.

BenDol commented 10 years ago

Kk thanks for the help, I have contacted them and will hopefully get this sorted out :D

BenDol commented 10 years ago

Never resolved this in my old environment, but I recently moved to maven and its working fine now. No idea what was going on here.

nmorel commented 10 years ago

Maybe you had some dependencies missing if it is resolved with Maven. Did you have jackson-annotations.jar and jackson-annotations-sources.jar in your classpath before ? The later is needed by the GWT compiler.

Thanks for the report :)

BenDol commented 10 years ago

Yeah I did have them in my class path, triple checked it when I was trying to resolve the issue. But it is possible that Ivy was messing up the dependencies on the build process. Not really sure though!