GWT compile fails in IDEA: UserAgentAsserter cannot be resolved - gwt

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.

Related

Missing requirement for filter properties ~= $0

I've the following error while building an RCP app with Maven Tycho:
[ERROR] Cannot resolve target definition:
[ERROR] Software being installed: org.eclipse.equinox.p2.core.feature.feature.group 1.6.900.v20210227-0235
[ERROR] Missing requirement for filter properties ~= $0: org.eclipse.equinox.p2.core.feature.feature.group 1.6.900.v20210227-0235 requires 'org.eclipse.equinox.p2.iu; org.eclipse.equinox.security.macosx [1.101.300.v20210212-1601,1.101.300.v20210212-1601]' but it could not be found
This questions seems similar to Tycho missing plugin when building an update site, but the solution there doesn't work. If I unselect the double packages in target the error remains.
I've tried to build an ARM package on an Intel Mac. Here's the pom snippet:
<environment>
<os>macosx</os>
<ws>cocoa</ws>
<arch>aarch64</arch>
</environment>
Or is this not possible at all?
Any hints are welcome.
Regards,
Ralf.

How to fix Missing requirement for javax.imageio while building Eclipse-CDT using Maven?

I downloaded the eclipse cdt source package org.eclipse.cdt-CDT_9_8_1.tar.xz from https://git.eclipse.org/c/cdt/org.eclipse.cdt.git and using maven 3.6.1 i tried to build it with command mvn clean install. Some packages were downloaded from repos and at the end it exited with the below error message
I need to build cdt from source as i want some changes in CDT source code. I am not an expert in Maven, not sure what's going wrong. Please help to resolve the issue
[INFO] Resolving dependencies of MavenProject: org.eclipse.cdt:org.eclipse.cdt.build.gcc.core:1.0.1-SNAPSHOT # D:\Eclipse\Sources\CDT9.8.1_GIT\cdt-releng\org.eclipse.cdt\build\org.eclipse.cdt.build.gcc.core.polyglot.build.properties
[ERROR] Cannot resolve target definition:
[ERROR] Software being installed: com.sun.xml.bind 2.2.0.v201505121915
[ERROR] Missing requirement: com.sun.xml.bind 2.2.0.v201505121915 requires 'java.package; javax.imageio 0.0.0' but it could not be found
[ERROR] Failed to resolve target definition D:\Eclipse\Sources\CDT9.8.1_GIT\cdt-releng\org.eclipse.cdt\releng\org.eclipse.cdt.target\cdt.target: See log for details -> [Help 1]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MavenExecutionException
The issue here is, that some plugins do not define a RequiredExecutionEnvironment. If such a plugin depends on a JRE package the build fails with the given error.
In Tycho it is possible to define such an environment:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho.version}</version>
<configuration>
<!-- needed as some plugins do not set a execution environment they would fail to get jre packages (eg. javax.imageio) -->
<executionEnvironment>JavaSE-1.8</executionEnvironment>
</configuration>
</plugin>

Dagger and libgdx

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?

error when building a GWT app after updating GWT

after updating GWT2.0 to the GWT2.4, eclipse shows error message when building GWT app with ant.
here is the message:
[java] Compiling module com.certus.noc.noc
[java] Validating newly compiled units
[java] [ERROR] Errors in 'jar:file:/D:/EX-GWT/gwt-2.4.0/gwt-user.jar!/com/google/gwt/user/client/ui/HasDirectionalSafeHtml.java'
[java] [ERROR] Line 26: No source code is available for type com.google.gwt.safehtml.client.HasSafeHtml; did you forget to inherit a required module?
[java] [ERROR] Line 33: No source code is available for type com.google.gwt.safehtml.shared.SafeHtml; did you forget to inherit a required module?
[java] [ERROR] Errors in 'jar:file:/D:/EX-GWT/gwt-2.4.0/gwt-user.jar!/com/google/gwt/event/shared/SimpleEventBus.java'
[java] [ERROR] Line 27: No source code is available for type com.google.web.bindery.event.shared.SimpleEventBus; did you forget to inherit a required module?
[java] [ERROR] Line 32: Cannot cast from GwtEvent.Type<H> to Event.Type<H>
[java] [ERROR] Line 32: No source code is available for type com.google.web.bindery.event.shared.Event<H>.Type<H>; did you forget to inherit a required module?
[java] [ERROR] Line 36: No source code is available for type com.google.web.bindery.event.shared.HandlerRegistration; did you forget to inherit a required module?
[java] [ERROR] Line 42: Cannot cast from GwtEvent.Type<H> to Event.Type<H>
[java] [ERROR] Line 51: No source code is available for type com.google.web.bindery.event.shared.Event<H>; did you forget to inherit a required module?
[java] [ERROR] Errors in 'jar:file:/D:/EX-GWT/gwt-2.4.0/gwt-user.jar!/com/google/gwt/user/client/ui/DirectionalTextHelper.java'
[java] [ERROR] Line 32: No source code is available for type com.google.gwt.i18n.shared.HasDirectionEstimator; did you forget to inherit a required module?
and the inherites module in gwt.xml file
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.extjs.gxt.ui.GXT'/>
<inherits name='com.extjs.gxt.desktop.WebDesktop' />
<inherits name='com.certus.noc.resources.Resources' />
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.certus.noc.resources.Resources' />
<inherits name='com.google.gwt.user.theme.standard.Standard'/>
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<inherits name='com.extjs.gxt.themes.Themes' />
<inherits name='com.google.gwt.i18n.I18N' />
<inherits name='com.extjs.gxt.charts.Chart' />
Thanks in advance for any answer
Try to add
<inherits name="com.google.web.bindery.event.Event"/>
to your main <project>.gwt.xml it should solve Events problems
Also try to place your gwt jars before gxt jars in your classpath
And check that HasDirectionalSafeHtml take HasSafeHtml and SafeHtml from gwt-servlet-2.4.0.jar, or event check if gwt-servlet-2.4.0.jar exists in your classpath.
This should solve HasDirectionalSafeHtml problems
I have solved the problem.
delete all the jars in the WEB-INF/lib, and then copy the new jar from APP Engine and other
userful . then it works

How do you use JPA objects with GWT in a different project?

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.