GWT 2.8.2 compiler exception - java

com.google.gwt.dev.PrecompilationContextCreator$1.getAllPossibleRebindAnswers(PrecompilationContextCreator.java:86)
at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.createStaticRebindExpression(UnifyAst.java:519)
at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.createRebindExpression(UnifyAst.java:487)
at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.maybeHandleMagicMethodCall(UnifyAst.java:415)
at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.visit(UnifyAst.java:402)
at com.google.gwt.dev.jjs.ast.JMethodCall.traverse(JMethodCall.java:265)
at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
... 45 more
[ERROR] at GridView.java(1351): GWT.create(GridTemplates.class)
com.google.gwt.dev.jjs.ast.JMethodCall
[ERROR] at GridView.java(1351): (GridTemplates) GWT.create(GridTemplates.class)
com.google.gwt.dev.jjs.ast.JCastOperation
[ERROR] at GridView.java(1351): this.templates = (GridTemplates) GWT.create(GridTemplates.class)
com.google.gwt.dev.jjs.ast.JBinaryOperation
[ERROR] at GridView.java(1351): this.templates = (GridTemplates) GWT.create(GridTemplates.class)
com.google.gwt.dev.jjs.ast.JExpressionStatement
[ERROR] at GridView.java(1350): {
this.templates = (GridTemplates) GWT.create(GridTemplates.class);
}
com.google.gwt.dev.jjs.ast.JBlock
[ERROR] at GridView.java(1350): {
this.templates = (GridTemplates) GWT.create(GridTemplates.class);
}
com.google.gwt.dev.jjs.ast.JMethodBody
[ERROR] at GridView.java(1350): com.extjs.gxt.ui.client.widget.grid.GridView.initTemplates()V
com.google.gwt.dev.jjs.ast.JMethod

What version of GXT are you using? When updating from 2.0-2.1 to 2.2 and beyond, there is a custom GXT 2 jar that must be used, labeled gxt-version-gwt22.jar, so that it works correctly. You may well have other jars on your classpath that needs updating (and should be documented as such) to correctly move to the latest.
For example, if using gxt 2.3.1, you'll need to switch from the gxt-2.3.1.jar to gxt-2.3.1-gwt22.jar. If you are using a version of GXT 2 older than 2.2.0, you may simply need to update to a newer version of GXT before continuing.

Related

maven build failure on org.codehaus.mojo:jaxb2-maven-plugin:2.3.1:xjc [duplicate]

This question already has answers here:
java.lang.ClassNotFoundException: com.sun.codemodel.CodeWriter with JDK9
(4 answers)
Closed 2 years ago.
Please help identify the root cause and possible solutions to this.
Please help me fix the below issue. I have no idea if this is related to java code not supporting that specifi problem any more.
Please see the below CONSOLE output that describes my issue:
[ERROR] Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:2.3.1:xjc (default) on project library-common-audit-monitor: Execution default of goal org.codehaus.mojo:jaxb2-maven-plugin:2.3.1:xjc failed: A required class was missing while executing org.codehaus.mojo:jaxb2-maven-plugin:2.3.1:xjc: com/sun/codemodel/CodeWriter
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.codehaus.mojo:jaxb2-maven-plugin:2.3.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/WKM/.m2/repository/org/codehaus/mojo/jaxb2-maven-plugin/2.3.1/jaxb2-maven-plugin-2.3.1.jar
[ERROR] urls[1] = file:/C:/Users/WKM/.m2/repository/javax/xml/bind/jaxb-api/2.2.11/jaxb-api-2.2.11.jar
[ERROR] urls[2] = file:/C:/Users/WKM/.m2/repository/org/glassfish/jaxb/jaxb-core/2.2.11/jaxb-core-2.2.11.jar
[ERROR] urls[3] = file:/C:/Users/WKM/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.2.11/jaxb-runtime-2.2.11.jar
[ERROR] urls[4] = file:/C:/Users/WKM/.m2/repository/org/glassfish/jaxb/jaxb-xjc/2.2.11/jaxb-xjc-2.2.11.jar
[ERROR] urls[5] = file:/C:/Users/WKM/.m2/repository/org/glassfish/jaxb/jaxb-jxc/2.2.11/jaxb-jxc-2.2.11.jar
[ERROR] urls[6] = file:/C:/Users/WKM/.m2/repository/com/thoughtworks/qdox/qdox/2.0-M3/qdox-2.0-M3.jar
[ERROR] urls[7] = file:/C:/Users/WKM/.m2/repository/org/sonatype/sisu/sisu-inject-bean/2.3.0/sisu-inject-bean-2.3.0.jar
[ERROR] urls[8] = file:/C:/Users/WKM/.m2/repository/org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-3.1.0-no_aop.jar
[ERROR] urls[9] = file:/C:/Users/WKM/.m2/repository/org/sonatype/sisu/sisu-guava/0.9.9/sisu-guava-0.9.9.jar
[ERROR] urls[10] = file:/C:/Users/WKM/.m2/repository/org/sonatype/aether/aether-util/1.13.1/aether-util-1.13.1.jar
[ERROR] urls[11] = file:/C:/Users/WKM/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
[ERROR] urls[12] = file:/C:/Users/WKM/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[13] = file:/C:/Users/WKM/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[14] = file:/C:/Users/WKM/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[15] = file:/C:/Users/WKM/.m2/repository/org/codehaus/plexus/plexus-compiler-api/2.5/plexus-compiler-api-2.5.jar
[ERROR] urls[16] = file:/C:/Users/WKM/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar
[ERROR] urls[17] = file:/C:/Users/WKM/.m2/repository/org/sonatype/plexus/plexus-build-api/0.0.7/plexus-build-api-0.0.7.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------: com.sun.codemodel.CodeWriter
I had the same problem with Java 11. Started to work when I reverted back to Java 8.

How to reference a Widget in GWT UiBinder?

Is it possible to reference a UiBinder created widget and pass is to a setter of other widget in *.ui.xml file?
I've tried following code to create a label (CustomLabel) that can listen to and follow the state of form widget (CustomWidget). The problem is that GWT compilation fails with:
[ERROR] Exception in thread "main" java.lang.StackOverflowError
[ERROR] at sun.nio.cs.UTF_8$Encoder.encodeLoop(UTF_8.java:691)
[ERROR] at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:579)
[ERROR] at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:271)
[ERROR] at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125)
[ERROR] at java.io.OutputStreamWriter.write(OutputStreamWriter.java:207)
[ERROR] at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:129)
[ERROR] at java.io.BufferedWriter.flush(BufferedWriter.java:253)
[ERROR] at java.io.PrintWriter.newLine(PrintWriter.java:482)
[ERROR] at java.io.PrintWriter.println(PrintWriter.java:629)
[ERROR] at java.io.PrintWriter.println(PrintWriter.java:740)
[ERROR] at com.google.gwt.dev.util.log.PrintWriterTreeLogger.doLog(PrintWriterTreeLogger.java:79)
[ERROR] at com.google.gwt.dev.util.log.PrintWriterTreeLogger.doCommitBranch(PrintWriterTreeLogger.java:65)
[ERROR] at com.google.gwt.dev.util.log.AbstractTreeLogger.commitMyBranchEntryInMyParentLogger(AbstractTreeLogger.java:256)
[ERROR] at com.google.gwt.dev.util.log.AbstractTreeLogger.branch(AbstractTreeLogger.java:167)
[ERROR] at com.google.gwt.core.ext.TreeLogger.branch(TreeLogger.java:212)
[ERROR] at com.google.gwt.editor.rebind.model.EditorModel.createEditorData(EditorModel.java:381)
[ERROR] at com.google.gwt.editor.rebind.model.EditorModel.createEditorData(EditorModel.java:390)
[ERROR] at com.google.gwt.editor.rebind.model.EditorModel.createEditorData(EditorModel.java:390)
View.ui.xml:
<g:HTMLPanel>
<x:CustomLabel forTarget={widget} />
<x:CustomWidget ui:field="widget" />
</g:HTMLPanel>
View.java:
#UiField
CustomWidget widget;
CustomLabel.java:
public void setForTarged(CustomWidget forTarget) {
this.forTarget = forTarget
}
In principle this should work. I use similar references in my code.
In your View.java:
#UiField
CustomWidget customWidget;
should be
#UiField
CustomWidget widget;
No, you cannot do it this way - no widget is available yet when your setForTarget method is called by UiBinder.
You can call this method in your code after your custom widget has been initialized.

how to use project/Build.scala generate java playproject?

I use playframework2.2: try to build a play support project.
in my Build.scala, I want to add play.Project.playJavaSetting:
val main = play.Project(appName, appVersion, appDependencies)
.settings(play.Project.playJavaSettings) //error here
.settings(
resolvers += "webjars" at "http://webjars.github.com/m2",
resolvers += "typesafe" at "http://repo.typesafe.com/typesafe/release"
)
the error is:
[error] F:\git\play-example-form\project\Build.scala:19: overloaded method value
settings with alternatives:
[error] (ss: sbt.Def.Setting[_]*)sbt.Project <and>
[error] => Seq[sbt.Def.Setting[_]]
[error] cannot be applied to (Seq[sbt.Setting[_]])
[error] .settings(play.Project.playJavaSettings)
[error] ^
If I do not add playJavaSetting, it give me error about wrong collection apply, I mean:
val main = play.Project(appName, appVersion, appDependencies)
//.settings(play.Project.playJavaSettings)
and the error is:
[error] required: play.api.data.Form<StudentFormData>,scala.collection.immutab
le.Map<String,Object>,scala.collection.immutable.List<String>,scala.collection.i
mmutable.Map<String,Object>,scala.collection.immutable.Map<String,Object>
[error] found: play.data.Form<StudentFormData>,java.util.Map<String,Boolean>,j
ava.util.List<String>,java.util.Map<String,Boolean>,java.util.Map<String,Boolean
you can see the framework apply the scala.collection.immutable.List instead of play.util.List, If I really want to apply the java collections how to set the environment setting in Build.scala file?
You should change
.settings(play.Project.playJavaSettings)
to
.settings(play.Project.playJavaSettings: _*)
The settings method is declared as def settings(ss: Setting[_]*), which means it takes repeated parameters of type Setting[_]. The play.Project.playJavaSettings is of type Seq[Setting[_]]. To convert one to another Scala has a special type annotation.
If you are interested in details check 4.6.2 Repeated Parameters of The Scala Language Specification

google guava with GWT when performing pattern search and range search on collections2

I want to perform search operations on Google Gauva collections in the GWT application.
Those are working correctly in standalone application.But in GWT they are producing
runtime problems.I'm showing my sample code of onModuleLoad() of EntryPoint class.
Iset the buildpath for both guava-gwt-14.0.1.jar and guava-10.0.jar
public void onModuleLoad() {
List<String> sList=new ArrayList<String>();
sList.add("arun kumar");
sList.add("ashok kumar");
sList.add("ravi kumar");
sList.add("kiran kumar");
sList.add("rama");
sList.add("ram");
sList.add("rama krishna");
sList.add("phani");
sList.add("vikram");
sList.add("veeru");
sList.add("arjun");
sList.add("naresh");
//pattern matching
Collection<String> filterdNamesKumar=Collections2.filter(sList, Predicates.containsPattern("kumar"));
//starts with
Collection<String> filterdNamesRam=Collections2.filter(sList, Predicates.containsPattern("^ram"));
Collection<String> filterdNamesAr=Collections2.filter(sList, Predicates.containsPattern("^ar"));
System.out.println(filterdNamesAr.toString());
System.out.println(filterdNamesKumar.toString());
System.out.println(filterdNamesRam.toString());
Map<String,String> emps=new HashMap<String,String>();
emps.put("emp1","01/02/2013");
emps.put("emp2", "10/12/2013");
emps.put("emp3","20/11/2013");
emps.put("emp4", "25/09/2013");
emps.put("emp5", "15/12/2013");
emps.put("emp6", "20/08/2013");
emps.put("emp7", "02/02/2012");
for(String s:emps.keySet()){
String strDate=emps.get(s);
DateTimeFormat dateFormat=DateTimeFormat.getFormat("dd/MM/yyyy");
Date empDate=dateFormat.parse(strDate);
Date startDate=dateFormat.parse("01/11/2013");
Date endDate=dateFormat.parse("31/12/2013");
Range<Date> range=Ranges.closed(startDate, endDate);
boolean b=range.apply(empDate);
if(b){
Window.alert("date found between boundaries");
}
}
}
error:
[DEBUG] [googlegauva] - Validating newly compiled units
[TRACE] [googlegauva] - Finding entry point classes
[ERROR] [googlegauva] - Errors in 'file:/D:/arun/eclipse_Myna/GoogleGauva/src/com/arun/gauva/client/GoogleGauva.java'
[ERROR] [googlegauva] - Line 57: The method containsPattern(String) is undefined for the type Predicates
[ERROR] [googlegauva] - Line 59: The method containsPattern(String) is undefined for the type Predicates
[ERROR] [googlegauva] - Line 60: The method containsPattern(String) is undefined for the type Predicates
[ERROR] [googlegauva] - Unable to find type 'com.arun.gauva.client.GoogleGauva'
[ERROR] [googlegauva] - Hint: Previous compiler errors may have made this type unavailable
[ERROR] [googlegauva] - 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] [googlegauva] - Failed to load module 'googlegauva' from user agent 'Mozilla/5.0 (Windows NT 6.1; rv:5.0.1) Gecko/20100101 Firefox/5.0.1' at 127.0.0.1:52248
[DEBUG] [googlegauva] - Validating newly compiled units
[TRACE] [googlegauva] - Finding entry point classes
[ERROR] [googlegauva] - Errors in 'file:/D:/arun/eclipse_Myna/GoogleGauva/src/com/arun/gauva/client/GoogleGauva.java'
[ERROR] [googlegauva] - Line 57: The method containsPattern(String) is undefined for the type Predicates
[ERROR] [googlegauva] - Line 59: The method containsPattern(String) is undefined for the type Predicates
[ERROR] [googlegauva] - Line 60: The method containsPattern(String) is undefined for the type Predicates
[ERROR] [googlegauva] - Unable to find type 'com.arun.gauva.client.GoogleGauva'
[ERROR] [googlegauva] - Hint: Previous compiler errors may have made this type unavailable
[ERROR] [googlegauva] - 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] [googlegauva] - Failed to load module 'googlegauva' from user agent 'Mozilla/5.0 (Windows NT 6.1; rv:5.0.1) Gecko/20100101 Firefox/5.0.1' at 127.0.0.1:52251
Patterns.containsPattern is annotated with #GwtIncompatible which means it's not in guava-gwt.
BTW, you should use the same version for guava-gwt and guava.

Play framework Documentation Task List Example Error

In Browser:
Compilation error
error: cannot find symbol
In /home/william/fmj/app/controllers/Application.java at line 28.
24 public static Result deleteTask(Long id) {
25 return TODO;
26 }
27
28 static Form<Task> taskForm = form(Task.class);
29
In Terminal:
[error] static Form<Task> taskForm = form(Task.class);
[error] ^
[error] symbol: class Task
[error] location: class Application
[error] /home/william/fmj/app/controllers/Application.java:16: error: cannot find symbol
[error] views.html.index.render(Task.all(), taskForm)
[error] ^
[error] symbol: variable Task
[error] location: class Application
[error] /home/william/fmj/app/controllers/Application.java:28: error: cannot find symbol
[error] static Form<Task> taskForm = form(Task.class);
[error] ^
[error] symbol: class Task
[error] location: class Application
[error] 3 errors
[error] {file:/home/william/fmj/}fmj/compile:compile: javac returned nonzero exit code
Any Help is greatly appreciated. I copy and pasted the code off of the tutorial (http://www.playframework.org/documentation/2.0.2/JavaTodoList) I'm not sure what's going wrong and I'd really like to learn this technology!
Apparently you didn't import Task model into your Application controller
You have 3 solutions:
Import each model manually:
import models.Task;
import exactly all models into your controller (it will be the best at the beginning, but...)
import models.*
Most recommended: Use some IDE which knows when and how to import required packages and classes and suggest you what should be imported (or not) (ie. IntelliJ Idea - just suggestion)
I got the same problem (error: cannot find symbol), sure that I have
import models.*;
but the error is still there.
I'm using eclipse 4.2, and it just suggest create new method form(Class<Task>

Categories

Resources