Is it possible to use dagger 2 and libgdx web? The libgdx project builds fine with android and desktop. When I add a web module and run with
./gradlew html:superDev
[ERROR] Line 1: The type javax.inject.Named cannot be resolved. It is indirectly referenced from required .class files
[ERROR] Line 30: The import dagger.Lazy cannot be resolved
[ERROR] Line 32: The import javax.inject.Inject cannot be resolved
[ERROR] Line 37: Inject cannot be resolved to a type
After following this http://www.g-widgets.com/2017/06/28/dependency-injection-in-gwt-using-dagger-2 . I have in my Game.gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://www.gwtproject.org/doctype/2.8.0/gwt-module.dtd">
<module>
<inherits name="dagger.Dagger" />
<source path="com/trashmelody" />
</module>
It will throw a different error
[ERROR] Line 34: No source code is available for type com.trashmelody.di.ComponentProvider<T>; did you forget to inherit a required module?
[ERROR] Line 34: No source code is available for type com.trashmelody.di.AppComponent; did you forget to inherit a required module?
[ERROR] Line 47: No source code is available for type com.trashmelody.managers.ScreenProvider; did you forget to inherit a required module?
[ERROR] Line 177: No source code is available for type com.trashmelody.di.DaggerAppComponent; did you forget to inherit a required module?
[ERROR] Line 178: No source code is available for type com.trashmelody.di.AppModule; did you forget to inherit a required module?
Does it mean we have to inherit all the errors in the xml?
Moving my development environment to a new laptop and faced the following error (it's never no-hassle process).
So, what I have is: Windows 8, Intellij Idea 12, GWT 2.5.1, configured a simple artifact that only produces a "GWT compile output":
Information: Compilation completed with 6 errors and 0 warnings in 25 sec
Information: 6 errors
Information: 0 warnings
Error: GWT Compiler: The import com.google.gwt.user.client.UserAgentAsserter cannot be resolved
Error: GWT Compiler: UserAgentProperty cannot be resolved to a type
Error: GWT Compiler: The method create(Class<?>) from the type GWT refers to the missing type UserAgentProperty
Error: GWT Compiler: UserAgentProperty cannot be resolved to a type
Error: GWT Compiler: UserAgentProperty cannot be resolved to a type
<-> D:\Projects\MyProject\src\main\java\com\myproject\RichClient.gwt.xml
Error: GWT Compiler: Aborting compile due to errors in some input files
Build on old laptop is working fine (same environment on Win7), although I don't see any differences in my gwt.xml file. Maybe something is missing that was added to old config manually rather than through repository checkout, but now I can only guess. I have tried to remove/comment all the lines from client.gwt.xml that relate to user.agent property setting, like
<set-property name="user.agent" value="gecko1_8,safari"/>
but no changes and I still see the same "6 errors" message.
I would appreciate any clue on why this error may appear. Thanks.
UPD.
Reduced the code of my RichClient.gwt.xml file to
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd">
<module rename-to='richclient'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
</module>
(no entry point set) and still got the same error.
Found this later. Obsolete jar that was not included in the lib path for the original project but managed to sneak into the newly configured.
Validating units:
[ERROR] Errors in 'jar:file:/D:/Projects/myProject/src/main/webapp/WEB-INF/lib/css3pie-0.1.jar!/com/google/gwt/user/client/UserAgentInfo.java'
[ERROR] Line 19: The import com.google.gwt.user.client.UserAgentAsserter cannot be resolved
[ERROR] Line 23: UserAgentProperty cannot be resolved to a type
[ERROR] Line 23: The method create(Class<?>) from the type GWT refers to the missing type UserAgentProperty
[ERROR] Line 23: UserAgentProperty cannot be resolved to a type
[ERROR] Line 26: UserAgentProperty cannot be resolved to a type
[ERROR] Line 26: UserAgentProperty cannot be resolved to a type
[ERROR] Line 40: UserAgentProperty cannot be resolved to a type
Removing the jar did the trick.
I'm following this tutorial to create my ant build file that java compiles, than GWT compiles than perform the correct actions to build my .war file.
I use Eclipse and GWT-compile works, and when I run the development mode it works. I have also successfully deployed on tomcat.
The things is when I run my script, the compiles work but it fails on the gwt-compiler task. My ant build script is as follow :
<project name="vlp" default="gwt.compile" basedir=".">
<tstamp />
<!-- ################# PROPERTIES ################ -->
<!-- directory properties -->
<!-- source -->
<property name="projectName" value="VirtualLabPortal" />
<property name="src.dir" location="src" />
<property name="build.dir" location="bin" />
<property name="src.build.dir" location="${build.dir}/src" />
<property name="gwt.build.dir" location="${build.dir}/gwt" />
<property name="gwt.unitCache.dir" location="gwt-unitCache" />
<!-- libraries -->
<property name="src.lib.dir" location="war/WEB-INF/lib" />
<!-- ___________________________________________________________________
| |
| Configure path source/test |
|___________________________________________________________________|
-->
<path id="compile.path">
<fileset dir="${src.lib.dir}" includes="*.jar" />
<fileset dir="${src.lib.dir}/gwt" includes="*.jar" />
</path>
<!-- ___________________________________________________________________
| |
| Clean old compiled source/test/war |
|___________________________________________________________________|
-->
<target name="clean" description="Clean all the old build files.">
<delete dir="${build.dir}" />
<delete dir="${gwt.unitCache.dir}" />
<delete file="${projectWar}" />
<delete file="${src.lib.dir}/${projectJar}" />
</target>
<!-- ___________________________________________________________________
| |
| Compile the source |
|(should exclude gwtview code which is compiled by the gwt compiler)|
|___________________________________________________________________|
-->
<target name="src.compile" depends="clean" description="Compile the source code when everything has been cleaned.">
<mkdir dir="${src.build.dir}" />
<javac encoding="utf-8" destdir="${src.build.dir}" nowarn="true">
<src path="${src.dir}" />
<classpath refid="compile.path" />
</javac>
</target>
<!-- ___________________________________________________________________
| |
| Invoke the GWT compiler |
|___________________________________________________________________|
-->
<property name="module.gwt.xml" location="${src.dir}/com/banctecmtl/ca/vlp" />
<target name="gwt.compile" depends="src.compile">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<!-- src dir is added to ensure the module.xml file(s) are on the classpath -->
<pathelement location="${module.gwt.xml}" />
<path refid="compile.path" />
</classpath>
<jvmarg value="-Xmx512m" />
<arg line="${projectName} -logLevel ALL -style OBF -war ${build.dir}" />
</java>
</target>
<!-- ___________________________________________________________________
| |
| Copy the config files in the war directory |
|___________________________________________________________________|
-->
<property name="config.dir" location="war/config" />
<target name="copy-resources">
<copy todir="war/config" preservelastmodified="true">
<fileset dir="${config.dir}">
<include name="**.*" />
</fileset>
</copy>
</target>
<!-- ___________________________________________________________________
| |
| Create a Jar to be included in the war |
|___________________________________________________________________|
-->
<property name="projectJar" value="${projectName}.jar" />
<property name="gwt.client.dir" location="com/banctecmtl/ca/vlp/view/webview" />
<target name="jar" depends="src.compile">
<!-- should also depend on gwt.compile -->
<jar jarfile="${src.lib.dir}/${projectJar}" basedir="${src.build.dir}/">
<!-- Don't wrap any of the client only code into the JAR
<exclude name="${gwt.client.dir}/**/*.class"/> -->
<exclude name="${gwt.client.dir}/**/*.class" />
</jar>
</target>
<!-- ___________________________________________________________________
| |
| Create a War from the source |
|___________________________________________________________________|
-->
<property name="projectWar" value="${projectName}.war" />
<target name="war" depends="jar,copy-resources">
<war basedir="war" destfile="${projectWar}" webxml="war/WEB-INF/web.xml">
<exclude name="WEB-INF/**" />
<webinf dir="war/WEB-INF/">
<include name="lib/*.jar" />
<include name="classes/*.properties" />
<exclude name="**/gwt-dev.jar" />
<exclude name="**/gwt-user.jar" />
</webinf>
</war>
</target>
<!-- ___________________________________________________________________
| |
| Deploy to the production server |
|___________________________________________________________________|
-->
<!-- It is possible you can't run this from eclipse,
you need to edit the run configurations and add the
latest jsch library to the classpath -->
<property name="user" value="root" />
<property name="password" value="Banctec01" />
<property name="prodHost" value="vlp" />
<property name="dest" value="/usr/share/tomcat6/webapps/ROOT.war" />
<target name="deploy" depends="war">
<echo message="Copying to : ${user}#${prodHost}:${dest}" />
<scp file="${projectWar}" remoteTofile="${user}#${prodHost}:${dest}" password="${password}" trust="true" />
</target>
</project>
It fails with the following error :
Buildfile: D:\workspace\vlp\build.xml
clean:
[delete] Deleting directory D:\workspace\vlp\war\WEB-INF\classes
src.compile:
[mkdir] Created dir: D:\workspace\vlp\war\WEB-INF\classes
[javac] D:\workspace\vlp\build.xml:42: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 134 source files to D:\workspace\vlp\war\WEB-INF\classes
[javac] Note: D:\workspace\vlp\src\com\banctecmtl\ca\vlp\controller\schedule\ScheduledTaskManager.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
gwt.compile:
[java] Checking for updates
[java] First launch was 134c3e23387
[java] Last ping was Mon Apr 23 14:42:48 EDT 2012, min wait is 86400000ms
[java] Module location: file:/D:/workspace/vlp/src/com/banctecmtl/ca/vlp/VirtualLabPortal.gwt.xml
[java] Loading inherited module 'com.google.gwt.user.User'
[java] Module location: jar:file:/D:/workspace/vlp/war/WEB-INF/lib/gwt/gwt-user.jar!/com/google/gwt/user/User.gwt.xml
[java] Loading inherited module 'com.google.gwt.animation.Animation'
[java] Module location: jar:file:/D:/workspace/vlp/war/WEB-INF/lib/gwt/gwt-user.jar!/com/google/gwt/animation/Animation.gwt.xml
[java] Loading inherited module 'com.google.gwt.core.Core'
[java] Module location: jar:file:/D:/workspace/vlp/war/WEB-INF/lib/gwt/gwt-user.jar!/com/google/gwt/core/Core.gwt.xml
[java] Loading inherited module 'com.google.gwt.dev.jjs.intrinsic.Intrinsic'
[java] Module location: jar:file:/D:/workspace/vlp/war/WEB-INF/lib/gwt/gwt-dev.jar!/com/google/gwt/dev/jjs/intrinsic/Intrinsic.gwt.xml
[java] Loading inherited module 'com.google.gwt.lang.LongLib'
[java] Module location: jar:file:/D:/workspace/vlp/war/WEB-INF/lib/gwt/gwt-dev.jar!/com/google/gwt/lang/LongLib.gwt.xml
[java] Loading inherited module 'com.google.gwt.emul.Emulation'
[java] Module location: jar:file:/D:/workspace/vlp/war/WEB-INF/lib/gwt/gwt-user.jar!/com/google/gwt/emul/Emulation.gwt.xml
[java] Loading inherited module 'com.google.gwt.logging.LogImpl'
[java] Module location: jar:file:/D:/workspace/vlp/war/WEB-INF/lib/gwt/gwt-user.jar!/com/google/gwt/logging/LogImpl.gwt.xml
[java] Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest'
[java] Module location: jar:file:/D:/workspace/vlp/war/WEB-INF/lib/gwt/gwt-user.jar!/com/google/gwt/xhr/XMLHttpRequest.gwt.xml
[java] Loading inherited module 'com.google.gwt.core.Core'
[java] Module 'com.google.gwt.core.Core' has already been loaded and will be skipped
[java] Loading inherited module 'com.google.gwt.core.CompilerParameters'
[java] Module location: jar:file:/D:/workspace/vlp/war/WEB-INF/lib/gwt/gwt-user.jar!/com/google/gwt/core/CompilerParameters.gwt.xml
[java] [...]
[java] Loading inherited module 'com.google.gwt.user.User'
[java] Module 'com.google.gwt.user.User' has already been loaded and will be skipped
[java] Public resources found in...
[java] Translatable source found in...
[java] Persistent unit cache dir set to: D:\workspace\vlp\war\..\gwt-unitCache
[java] Compiling module VirtualLabPortal
[java] Looking for previously cached Compilation Units in D:\workspace\vlp\war\..\gwt-unitCache
[java] Loaded 0 units from persistent store.
[java] Starting UnitWriteThread.
[java] Found 0 cached units. Used 0 / 2413 units from cache.
[java] [ERROR] Unexpected internal compiler error
[java] java.lang.RuntimeException: Exception processing units
[java] at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:248)
[java] at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:447)
[java] at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:370)
[java] at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:360)
[java] at com.google.gwt.dev.Precompile.precompile(Precompile.java:252)
[java] at com.google.gwt.dev.Precompile.precompile(Precompile.java:233)
[java] at com.google.gwt.dev.Precompile.precompile(Precompile.java:145)
[java] at com.google.gwt.dev.Compiler.run(Compiler.java:232)
[java] at com.google.gwt.dev.Compiler.run(Compiler.java:198)
[java] at com.google.gwt.dev.Compiler$1.run(Compiler.java:170)
[java] at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:88)
[java] at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:82)
[java] at com.google.gwt.dev.Compiler.main(Compiler.java:177)
[java] Caused by: java.lang.NoSuchMethodError: com.google.gwt.dev.jjs.ast.JProgram.serializeTypes(Ljava/util/List;Ljava/io/ObjectOutputStream;)V
[java] at com.google.gwt.dev.javac.CompilationUnitImpl.<init>(CompilationUnitImpl.java:68)
[java] at com.google.gwt.dev.javac.SourceFileCompilationUnit.<init>(SourceFileCompilationUnit.java:48)
[java] at com.google.gwt.dev.javac.CompilationUnitBuilder$ResourceCompilationUnitBuilder.makeUnit(CompilationUnitBuilder.java:154)
[java] at com.google.gwt.dev.javac.CompilationUnitBuilder.build(CompilationUnitBuilder.java:266)
[java] at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater$1.run(CompilationStateBuilder.java:223)
BUILD FAILED
D:\workspace\vlp\build.xml:60: Java returned: 1
Total time: 36 seconds
I found that changing the gwt-compiler class name to the DevMode is building successfully. Using : classname="com.google.gwt.dev.DevMode" instead of classname="com.google.gwt.dev.Compiler".
EDIT : I refactored the XML above.
The build.xml cleans all the bin directory. I also pointer the javacto the bin/src directory and Google Web Toolkit compiler outputs to : bin/gwt. The compiler still doesn't work...
EDIT : I downloaded the latest SDK right away from google developpers site, and overrided the old librairies found in my classpath and in my eclipse plugin. Still won't work with the ant build script.
Anybody sees what could be the problem here?
All I can say is that the method com.google.gwt.dev.jjs.ast.JProgram.serializeTypes(Ljava/util/List;Ljava/io/ObjectOutputStream;)V is introduced only in gwt-dev 2.4.0. It doesn't exist in gwt-dev 2.3.0.
Which implies there are somewhere, in the classpath, two gwt-dev versions. One of them is 2.4.0, which is why com.google.gwt.dev.javac.CompilationUnitImpl is looking for that method. The other is of 2.3.0 or older, which is why that method isn't found (JProgram class was loaded by the compiler using the older version).
Try to look them up thoroughly. Or try to start a fresh environment in which you put a good eye on what's getting in.
tl;dr: this is due to differences in the linkers provided by Compiler versus DevMode in cases of insufficient or incorrect class context
Tracing the issue
I noticed that the repro you have exists in the current GWT trunk. Specifically, it's failing in this block of code:
ArrayList<CompilationUnit> resultUnits = new ArrayList<CompilationUnit>();
do {
// Compile anything that needs to be compiled.
buildQueue = new LinkedBlockingQueue<CompilationUnitBuilder>();
final ArrayList<CompilationUnit> newlyBuiltUnits = new ArrayList<CompilationUnit>();
final CompilationUnitBuilder sentinel = CompilationUnitBuilder.create((GeneratedUnit) null);
final Throwable[] workerException = new Throwable[1];
Thread buildThread = new Thread() {
#Override
public void run() {
try {
do {
CompilationUnitBuilder builder = buildQueue.take();
if (builder == sentinel) {
return;
}
// Expensive, must serialize GWT AST types to bytes.
CompilationUnit unit = builder.build(); // <-- Right here.
newlyBuiltUnits.add(unit);
} while (true);
} catch (Throwable e) {
workerException[0] = e;
}
}
};
Unwinding the stack further than your trace, we bounce through a factory and ten layers of code, until we finally hit UnifyAst.java. And, lo and behold:
...
mapApi(enclosingType);
// Now the method should be there.
method = methodMap.get(sig);
if (method == null) {
// TODO: error logging
throw new NoSuchMethodError(sig);
}
assert !method.isExternal();
return method;
...
This is the only instance of NoSuchMethodError called by the Precompilation stage of GWT.
Differences in Compiler and DevMode linking
Cool. Now that we've taken the deep dive into why this is exploding, let's figure out why DevMode works when Compiler doesn't. We note that both import the same copy of Util.java, so technically, both types are available statically to our Java compiler (just not the GWT compiler).
Inspecting the linkers, we note that Compiler uses Link.link directly:
Link.link(logger.branch(TreeLogger.TRACE, logMessage), module,
generatedArtifacts, allPerms, resultFiles, options.getWarDir(),
options.getDeployDir(), options.getExtraDir(), precompileOptions);
Whereas DevMode uses a much terser static call, with a separate pass filling in an instance of StandardLinkerContext:
link(loadLogger, module);
...
#Override
protected synchronized void produceOutput(TreeLogger logger, StandardLinkerContext linkerStack,
ArtifactSet artifacts, ModuleDef module, boolean isRelink) throws UnableToCompleteException {
...
linkerStack.produceOutput(linkLogger, artifacts, Visibility.Public, outFileSet);
linkerStack.produceOutput(linkLogger, artifacts, Visibility.Deploy, deployFileSet);
linkerStack.produceOutput(linkLogger, artifacts, Visibility.Private, extraFileSet);
...
}
Great! So, how do I fix it?
As accepted in the middle of writing this post, yair provides one such diagnosis for the issue, noting that the precompilation step is non-robust to conflicting class identities in the context of two versions of GWT. Other class visibility problems where precompilation.getGeneratedArtifacts(); pulls in wrong or insufficient objects may also cause this repro.
I will assume the issue has now been resolved, given yair was given accepted answer status. But it is conceivable for other people running across this post that other classpath or visibility issues may cause this exact issue to recur.
java.io.ObjectOutputStream class isn't supported by GWT compiler.
You have to refer to https://developers.google.com/web-toolkit/doc/latest/RefJreEmulation#Package_java_io before using Java classes to be sure GWT supports it.
You fork a JVM to run Gwt Compiler and the bin directory is in ClassPath.
As Eclipse compiles in development mode, a remaining class in bin may prevent the compiler to process properly some source files.
You should make sure the bin directory is empty before you invoke your Ant target. It may pass then.
I recommend you to use two target directories: one for classes compiled from Java sources and another one for GWT generated files. Then the target war will collect both into the WAR.
I'm new to GWT, and I'm setting up a project to hold the UI portion of a complicated application. The JPA data objects are defined in a separate project using MyBatis generated POJOs. Once I manually modify the JPA objects to include 'implements Serializable' (this is a separate problem I need to solve), the gwtc step in the build process can't continue because it needs the source code for the JPA object, but can't find them.
I've created the 'core' project's jar files so that it includes the source .java files, but this didn't work. I've tried adding a classpath element to the gwtc ant java call.
How can I make my UI project compile while keeping the JPA objects defined in a separate project?
Errors:
Buildfile: /Users/user/source/user_interface/build.xml
libs:
javac:
gwtc:
[java] Compiling module org.mysite.ui
[java] Validating newly compiled units
[java] [ERROR] Errors in 'file:/Users/user/source/user_interface/src/org/mysite/ui/client/MyService.java'
[java] [ERROR] Line 21: No source code is available for type org.mysite.core.model.Person; did you forget to inherit a required module?
[java] [ERROR] Errors in 'file:/Users/user/source/user_interface/src/org/mysite/ui/client/MyServiceAsync.java'
[java] [ERROR] Line 19: No source code is available for type org.mysite.core.model.Person; did you forget to inherit a required module?
[java] [ERROR] Errors in 'file:/Users/user/source/user_interface/src/org/mysite/ui/client/presenter/MainTabPresenter.java'
[java] [ERROR] Line 75: No source code is available for type org.mysite.core.model.Person; did you forget to inherit a required module?
[java] Scanning for additional dependencies: file:/Users/user/source/user_interface/src/org/mysite/ui/client/MyApp.java
[java] Computing all possible rebind results for 'org.mysite.ui.client.MyService'
[java] Rebinding org.mysite.ui.client.MyService
[java] Checking rule <generate-with class='com.google.gwt.user.rebind.ui.ImageBundleGenerator'/>
[java] [ERROR] Unable to find type 'org.mysite.ui.client.MyService'
[java] [ERROR] Hint: Previous compiler errors may have made this type unavailable
[java] [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
[java] [ERROR] Errors in 'file:/Users/user/source/user_interface/src/org/mysite/ui/client/MyApp.java'
[java] [ERROR] Line 23: Failed to resolve 'org.mysite.ui.client.MyService' via deferred binding
[java] [ERROR] Cannot proceed due to previous errors
BUILD FAILED
/Users/user/source/user_interface/build.xml:39: Java returned: 1
Total time: 26 seconds
Ant gwtc target:
<target name="gwtc" depends="javac" description="GWT compile to JavaScript (production mode)">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="src"/>
<pathelement location="../core/src"/>
<path refid="project.class.path"/>
</classpath>
<!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
<jvmarg value="-Xmx256M"/>
<arg line="-war"/>
<arg value="web"/>
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg line="${gwt.args}"/>
<arg value="org.mysite.ui.MyApp"/>
</java>
</target>
GWT has always had this problem.
The approach I have taken in the past is to make a .gwt.xml module in the other JAR including the JPA POJOs and putting the JPA annotation classes in an "emul" javax.persistence folder. This won't work w/ many providers that use lazy fetching of course, so Gilead (as mentioned in another answer here) will be needed.
Another way is to make copies of the JPA objects and just Dozer them before sending across RPC
Luckily, GWT 2.1 has solved this problem. Use Entity proxies and request factories. It works well.
Either use the new GWT 2.1 RequestFactory / EntityProxy approach, or
Better, ditch the JPA and use Objectify or Twig.
We use Objectify, because JPA is not a good fit for Datastore. JPA was created with SQL-based relational databases in mind, while GAE Datastore is an entirely different thing.
Google ported JPA layer to Datastore to lure in developers, pretending that Datastore is just a plain old SQL relational database. This later blows up in their faces once projects grow big.
You really need to understand the Datastore tradeoffs if you want to use AppEngine. JPA is not making you a favor here.
Your best bet if you want to serialize POJOs to GWT is to use Gilead http://noon.gilead.free.fr/gilead/
All you have to do on your POJO is extend LightEntity and implement Serializable
The tutorial is pretty straight forward in how to set up the RPC.
I can successfully compile the source, but when I hit this ant task:
<target name="gwtc" depends="javac" description="GWT compile to JavaScript">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="src"/>
<path refid="project.class.path"/>
</classpath>
<jvmarg value="-Xmx256M"/>
<arg line="${gwt.args}"/>
<arg value="com.jwavro.jaguar.jaguar"/>
</java>
</target>
I'm getting these errors:
gwtc:
[java] Compiling module com.jwavro.jaguar.jaguar
[java] Scanning for additional dependencies: generated://9161C2B729E3521B2A51CBE6F2AE8A77/com/unnison/framework/client/GeneratedGinInjector.java
[java] Computing all possible rebind results for 'com.unnison.framework.client.GeneratedGinInjector'
[java] Rebinding com.unnison.framework.client.GeneratedGinInjector
[java] Invoking generator com.google.gwt.inject.rebind.GinjectorGenerator
[java] [ERROR] Generator 'com.google.gwt.inject.rebind.GinjectorGenerator' threw an exception while rebinding 'com.unnison.framework.client.GeneratedGinInjector'
[java] com.google.inject.CreationException: Guice creation errors:
[java]
[java] 1) No implementation for javax.inject.Provider was bound.
[java] while locating javax.inject.Provider
[java] for parameter 9 at com.google.gwt.inject.rebind.BindingsProcessor.(BindingsProcessor.java:209)
[java] at com.google.gwt.inject.rebind.GinjectorGeneratorModule.configure(GinjectorGeneratorModule.java:59)
GUICE binding is supposed to be automatic, any idea how to fix it ?
Guice can not be used directly with GWT. You need to use GIN.
javax.inject is a dependency that needs to be in your classpath.
If you downloaded Guice from Google, there should be a lib folder in the exploded zip with a javax.inject.jar file, or you can download it direct from trunk.
The key is this line:
[java] 1) No implementation for javax.inject.Provider was bound.
There are two things I can think of. First of all make sure you have properly inherited the GIN module in your GWT module xml:
<module>
...
<inherits name="com.google.gwt.inject.Inject"/>
...
</module>
Secondly you have to be carefull about versions of GIN and Guice. On the GIN homepage it says:
GIN 1.0 requires ... and Guice 2.0
For Gin 1.5 you'll need to use the Guice snapshot distributed with Gin or ... Guice 3.0
So make sure you have the appropriate Guice JAR in path.