"Cannot be resolved to a type" after upgrading to GWT 2.7. and trying to compile a multi-project module - eclipse

I´ve been having trouble getting the Super-Dev-Mode to work with GWT 2.7. and GXT 3.1.x The classical Dev-Mode starts without trouble, but the Super-Dev-Mode and GWT-compile the project won`t work.
I am currently working with Eclipse 4.4.2 with Java 1.7_2 on Windows.
So let´s pretend we have 2 GWT/GXT projects (no Maven) with GWT 2.6 and GXT 3.1.x (Projects are backuped on a repository).
One is called A and the other project is called B. Project A has many packages and no entrypoint (to just work as a library/framework), just an abstract entrypoint every other project has to extend. The other one is called B and inherits from A, the entrypoint extends the entrypoint of A.
When starting the project under GWT 2.6 in classical Dev-Mode the project works fine. When upgrading to GWT 2.7. it will work fine with the classical Dev-Mode, an even in Super-Dev-Mode the Codeserver starts to run, but when compiling the module i get an error that some code seems not to live under a package 'client' so i migrated it into a own package and added the sourcepath to the A.gwt.xml.
After fixing this error and starting the Super-Dev-Mode again (and when trying to GWT-compile) I get errors like this:
Ignored 15 units with compilation errors in first pass.
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
Finding entry point classes
Tracing compile failure path for type 'com.example.b.client.B'
[ERROR] Errors in 'file:/C:/Workspace/ProjectB/src/com/example/b/client/B.java'
[ERROR] com.example.a.client.A cannot be resolved to a type
[ERROR] Errors in 'file:/C:/Workspace/ProjectA/src/com/example/a/view/ExampleLayout.java'
[ERROR] com.example.a.view.ILayout cannot be resolved to a type
[ERROR] Errors in 'file:/C:/Workspace/ProjectA/src/com/example/a/client/service/ExampleServiceAsync.java'
[ERROR] com.example.a.model.Examplemodel cannot be resolved to a type
[ERROR] Errors in 'file:/C:/Workspace/ProjectA/src/com/example/a/model/OtherExampleModel.java'
[ERROR] com.example.a.hibernate.model.ComOtherExampleModel cannot be resolved to a type
[ERROR] Errors in 'file:/C:/Workspace/ProjectB/src/com/example/b/client/service/OtherExampleServiceAsync.java'
[ERROR] com.example.a.model.NewExampleModel cannot be resolved to a type
...
(and many more)
Project A is included in the buildpath of the project B, when creating a custom run configuration where the project is added to "user entries" and adding source folders to "user" entries wont work. For the custom run configuration i used something like the following arguments:
"-src src/ -src ${workspace_loc:ProjectA} com.example.b.B"
And even:
"-src src/ -src ${workspace_loc:ProjectA} com.example.b.B com.example.a.A"
I widely searched for solutions and even tried to set up the workspace again, checkout the projects from the repository again, organize imports and even adding every package to the buildpath of A.
I also tried to add this to the .gwt.xml files didn´t work:
<add-linker name="xsiframe"/>
How can I solve the "cannot be resolved to a type" error?
I would really appreciate every form of help to get this problem done! Thanks!

One possible problem could be your version of GXT. If you are using GXT 3.1.1 (which was the latest GPL-release), then you can not use GWT 2.7.0.
Take a look at the version table:
GXT versions
As you can see, Sencha GXT 3.1.1 does not support GWT 2.7.0. The first GXT release which will support GWT 2.7.0 is GXT 3.1.2.

Related

How to resolve reference to twirl generated template class in Scala-IDE?

Using twirl for generating template class. Everything is working fine with sbt and the webpages are rendering.
I am using Scala-IDE for development. And in the Scala-IDE the reference to the template class i.e. "html.test()", test is the template name, is showing as an error.
This is the error:
Description Resource Path Location Type
missing or invalid dependency detected while loading class file 'test.class'.
Could not access term api in value .twirl, because it (or its dependencies) are missing.
Check your build definition for missing or conflicting dependencies. (Re-run with -Ylog-classpath to see the problematic classpath.) A full rebuild may help if 'test.class' was compiled against an incompatible version of .twirl. ApiService.scala /api/src/main/scala/com/komma/api/rest line 97 Scala Problem.
I did a clean and it is giving "not found: value html" error now.
Is there any way to resolve this error in the scala IDE ?
Thanks.
Re-running sbt eclipse added target/scala-2.11/twirl/main as a source folder which resolved the compilation errors for me.
For my twirl configuration, sbt eclipse did not add the twirl output directory as a source folder. Adding
target/scala-2.11/twirl/main to the eclipse project build path through the Add Folder button, under Java Build Path, by hand, was my solution.

scala & intellij : difficulties to create a runnnable jar

I can't launch a scala jar; when I launch it I get the error "Exception in thread "main" java.lang.NoClassDefFoundError: scala/collection/immutable/List" which seems to mean the scala library is not loaded...
this is a screenshot showing a lot of informations on the artifact window.
here is the manifest:
Manifest-Version: 1.0
Class-Path: libs/scala-library-2.10.0.jar libs/commons-logging-1.1.1.j
ar libs/jcip-annotations-1.0.jar libs/jwnl-1.4_rc3.jar libs/laf-plugi
n-7.2.1.jar libs/laf-widget-7.2.1.jar libs/miglayout-core-4.2.jar lib
s/miglayout-swing-4.2.jar libs/scala-actors.jar libs/scala-library.ja
r libs/scala-swing.jar libs/slf4j-api-1.6.4.jar libs/slick_2.10-1.0.0
.jar libs/sqlite-jdbc-3.7.2.jar libs/substance-7.2.1.jar libs/trident
-7.2.1-swing.jar
Main-Class: Fenetre
and when I enter "java xf myJar.jar", there are extracted files in the directory:
- .class files
- in the libs folder, there are the libraries INCLUDING scala-library.jar & scala-library-2.10.0.jar(I specified only one of these two files in the manifest to avoid conflicts)
can you help me?
I'm new to Scala and don't know what the problem is however I've been compiling "fat jars" which include all the required libs.
I've been using https://github.com/sbt/sbt-assembly to do this successfully.
Despite what your manifest is telling you, when you run the application you either do not have the scala-library included in your class path or there's some confusion when you attempt to import List. Scala should automatically import the immutable collection classes in your project with the root Predef implementation.
Predef provides type aliases for types which are commonly used, such as the immutable collection types scala.collection.immutable.Map, scala.collection.immutable.Set, and the scala.collection.immutable.List constructors (scala.collection.immutable.:: and scala.collection.immutable.Nil). The types Pair (a scala.Tuple2) and Triple (a scala.Tuple3), with simple constructors, are also provided.
Predef in core Scaladocs
Try printing the classpath from within your app to confirm.
Although not pertinent to your question, I would recommend using SBT for dependency management now that IntelliJ IDEA 13 has full SBT integration support. Your collaborators not using IntelliJ will also be happier because SBT gives them more options for build technologies, editors, and other tooling when working on the project.

Can't compile GWT project with GWTQuery in Eclipse

I'm trying to start using GWTQuery in a GWT project.
I've created sample GWT project in Eclipse
Added gwtquery-1.3.2.jar
into war/WEB-INF/lib
Edited Myproject.gwt.xml (added <inherits name='com.google.gwt.query.Query'/>)
When I compile the project it writes a lot of deffered errors but at the end it comes with:
Scanning for additional dependencies: jar:file:/C:/eclipseBacklog/Backlog/war/WEB-INF/lib/gwtquery-1.3.2.jar!/com/google/gwt/query/client/GQuery.java
Computing all possible rebind results for 'com.google.gwt.query.client.GQuery'
Rebinding com.google.gwt.query.client.GQuery
Checking rule <replace-with class='com.google.gwt.query.client.impl.SelectorEngineNativeIE8'/>
[ERROR] Errors in 'jar:file:/C:/eclipseBacklog/Backlog/war/WEB-INF/lib/gwtquery-1.3.2.jar!/com/google/gwt/query/client/Properties.java'
[ERROR] Line 20: The import com.google.gwt.core.shared cannot be resolved
[ERROR] Line 39: GWT cannot be resolved
[ERROR] Unable to find type 'com.google.gwt.query.client.GQuery'
[ERROR] Hint: Previous compiler errors may have made this type unavailable
[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
[ERROR] Errors in 'jar:file:/C:/eclipseBacklog/Backlog/war/WEB-INF/lib/gwtquery-1.3.2.jar!/com/google/gwt/query/client/GQuery.java'
[ERROR] Line 1483: Failed to resolve 'com.google.gwt.query.client.GQuery' via deferred binding
What I'm doing wrong?
Check your version of gwt, you have to update to GWT-2.5.x. because this artifact of gquery has a undesired dependency of it. There are two GWT.java classes in 2.5, and gquery is depending of the new com.google.gwt.core.shared by mistake.
Open an issue at the gwtquery site becasuse this release should work with older gwt version as well.
You could also change the gquery version to 1.3.1 or 1.4.0-SNAPSHOT
Update: I've just deprecated version 1.3.2, and released 1.3.3 which compiles with previous gwt versions

can't compile play showcase html

I installed playN however I get this error:
[INFO] --- gwt-maven-plugin:2.4.0:compile (default) # playn-showcase-html ---
[ERROR] Error: Could not find or load main class com.google.gwt.dev.Compiler
I checked the m2 repository, and the gwt jars for 2.4 2.5 gwt seem to be there.
If I try to use GWT 2.5 in the project then I get this
The GWT SDK 'C:\Users\user.m2\repository\com\google\gwt' on the project's build path is not valid (Version is not supported, must be 2.0.0 or later)
playn-showcase-html
Unknown Google Web Toolkit Problem
Does this make sense at all?
How to fix it?
Thanks
It seems that some gwt jars in the maven repository were corrupted. I deleted them, i run the playN sample again, the jars were downloaded correctly, and the whole think worked
C:\Users\user.m2 <-- this is very strange. it looks like somehow your maven repository path is munged up.
Check your environmental variables for MAVEN_REPOSITORY and see if its set to C:\Users\user. Also, find your maven installation directory, and look under the conf directory for a settings.xml, and see if you have <localRepository>${env.MAVEN_REPOSITORY}/.m2/repository</localRepository>.

GWT Development Mode with Eclipse/Maven

I am just starting with GWT. I use Eclipse and have installed the GWT plugin.
I have followed the directions here Maven GWT 2.0 and Eclipse to set up a GWT project using the gwt-maven-plugin. When I run the Maven goals gwt:compile gwt:run, GWT Development Mode is launched and I can copy the url from it to my browser and view the label.
However, the project has this problem:
Description: The web.xml file does not exist
Resource: WEB-INF
Path: /GWTExample/war
Location: Unknown
Type: Google Web App Problem
If I try to run the project as a Google Web Application, I get this warning:
[WARN] No startup URLs supplied and no plausible ones found -- use -startupUrl
I can get rid of the problem by copying the web.xml to the war directory, but I still get the URL issue when running as a Google Web App.
If I'm using Maven and GWT in Eclipse, should I just ignore the web.xml problem and always run applications in development mode via the Maven goals? Or is there a way to set things so I can run as a Google Web App?
EDIT: Related to the above, is it possible to debug a GWT app running in development mode started by gwt:compile gwt:run? I have added breakpoints to my application but it doesn't stop on them. I'm not sure if it is something I've configured wrong or if it's just not possible.
Update:
In response to Prem's answer...
When I run a compile gwt:run, the web.xml file isn't copied. When I run the install gwt:run, I get this error:
[INFO] --- gwt-maven-plugin:1.2:test (default) # SampleGWT ---
[INFO] using GWT jars from project dependencies : 2.0.4
[INFO] establishing classpath list (scope = test)
[ERROR] java.lang.NoClassDefFoundError: org/codehaus/mojo/gwt/test/MavenTestRunner
[ERROR] Caused by: java.lang.ClassNotFoundException: org.codehaus.mojo.gwt.test.MavenTestRunner
[ERROR] at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
[ERROR] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
[ERROR] Could not find the main class: org.codehaus.mojo.gwt.test.MavenTestRunner. Program will exit.
[ERROR] Exception in thread "main"
I’m guessing that bug http://jira.codehaus.org/browse/MGWT-24 is included in version 1.2 of the gwt-maven-plugin. Normally I wouldn’t run install on a project that builds a war file, but I would expect to at least get past the test phase of the build cycle.
Does anybody have any idea why I would get this error on the install but not the compile goals? Also, should I be expecting either goal to copy the web.xml file from src/main/webapp/WEB-INF/web.xml to the /war directory?
Description: The web.xml file does not exist
gwt-maven-plugin creates a project with 'war' packaging format (it's a web app so no surpirse here). Web.xml for this project will be under 'src/main/webapp' folder which will be copied to the 'war' directory (which is set as the output directory) as part of the 'resources' phase in the maven build life-cycle. You should always use
mvn compile gwt:run
or
mvn install gwt:run
so that resources are copied, all java files are compiled and gwt:compile is also invoked (since it is bound to the 'compile' phase automatically)
[WARN] No startup URLs supplied and no plausible ones found -- use -startupUrl
As per the stackoverflow link you used as reference, only your maven build file is setup with startupUrl. In order for it to work in Eclipse, you must edit the Run Configuration of your project and add the '-statupUrl' command line arguments to the existing arguments in the "Arguments" panel.
However, this is just a warning and it should not stop you from running your GWT application from eclipse. If you are facing the same "web.xml" problem here as well, it could be because you did not compile your project in your IDE before invoking "Run as Web Application". I suggest you to disable "Build Automatically" option for this project and always build it manually and invoke "GWT Compile" and then try "Run as web application"
EDIT: Related to the above, is it possible to debug a GWT app running in development mode started by gwt:compile gwt:run?
In general you must use "Remote Application" debug configuration for remote debugging a process. However I am not sure if it will work for GWT projects.
I got me too this warning:
No startup URLs supplied and no plausible ones found
when I have followed this gwt tutorial
In that screenshot there is no checkbox with "Generate sample code" . In my IDE ( sdk 2.5) it is, so I have unchecked...
It wasn't created any of the server and client packages, I have created the client manually, as the tutorial required. The tutorial until that step doesn't say I must have a server package too. That and his configuration is missing from project.
If you right-click on your project and go to Properties -> Google -> Web Application, your WAR directory might be something like either war or src/main/webapp/WEB-INF/classes.
Change that to src/main/webapp.
Also un-check the box next to "Launch and delploy from this directory..."
That's what fixed this problem for me. It also fixed the "can't find gwt-servlet.jar" problem at the same time.