help me!why my project always report DOM cannot be resolved??

25 views
Skip to first unread message

yummy

unread,
Nov 28, 2006, 4:33:24 AM11/28/06
to Google Web Toolkit
when i import com.google.gwt.user.client.dom and compile ,it right
but when i run it in eclipse with jvm it report the follow error
and tell me
The method insertListItem(Element, String, String, int) is undefined
for the type DOMImpl

[ERROR] Failed to create an instance of 'com.linzhang.client.mycard1'
via deferred binding
java.lang.Error: Unresolved compilation problems:
The import com.google.gwt.user.client.DOM cannot be resolved
DOM cannot be resolved
DOM cannot be resolved
DOM cannot be resolved
DOM cannot be resolved
DOM cannot be resolved
DOM cannot be resolved
DOM cannot be resolved

at com.google.gwt.user.client.ui.Label.<init>(Label.java:18)
at com.linzhang.client.mycard1.<init>(mycard1.java:17)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at
com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:105)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:64)
at
com.google.gwt.dev.shell.BrowserWidget.attachModuleSpace(BrowserWidget.java:286)
at
com.google.gwt.dev.shell.ie.BrowserWidgetIE6.access$100(BrowserWidgetIE6.java:20)
at
com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.gwtOnLoad(BrowserWidgetIE6.java:44)

Justin Hickman

unread,
Nov 28, 2006, 10:22:20 AM11/28/06
to Google Web Toolkit
Most likely you'll need to have your module inherit from the DOM
module. Add this line to your "module".gwt.xml file

<inherits name="com.google.gwt.user.DOM"/>

yummy

unread,
Nov 28, 2006, 7:59:52 PM11/28/06
to Google Web Toolkit

"Justin Hickman 写道:

"
> Most likely you'll need to have your module inherit from the DOM
> module. Add this line to your "module".gwt.xml file
>
> <inherits name="com.google.gwt.user.DOM"/>

hi,Justin,thanks for you reply!

i add the line to my xml file like this,but error still exist
<module>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwt.user.DOM'/>
<!-- Specify the app entry point class. -->
<entry-point class='com.linzhang.client.mycard1'/>
</module>

dominik_steiner

unread,
Nov 29, 2006, 2:23:06 AM11/29/06
to Google Web Toolkit
Did you add the gwt-user.jar to your lauch classpath?

Dominik

yummy

unread,
Nov 29, 2006, 2:36:56 AM11/29/06
to Google Web Toolkit
yes i did it,<classpathentry kind="lib"
path="D:/gwt-windows-1.2.22/gwt-user.jar"/>
and i add "D:/gwt-windows-1.2.22/gwt-user.jar"to system classpath but
the same result
when i use projcetcreator and applicationcreator to create elcipse
project,the first can run success
but do some change like import dom package it report error ,sigh!

dominik_steiner

unread,
Nov 29, 2006, 3:19:25 AM11/29/06
to Google Web Toolkit
Hi yummy,

so did you actually create your project and application through the
projectcreator and applicationcreator?

I just tried it out and it works just fine, without having to inherit
any DOM package.
I just did

projectCreator.cmd -eclipse test -out ..

That created the project 'test'. And then I created the application
like this

applicationCreator.cmd -eclipse test -out .. com.bar.client.Test

That's it. I launched it through the Test-shell.cmd or the launch
configuration in eclipse.

But perhaps your problem is of another kind.

yummy

unread,
Nov 29, 2006, 7:36:09 PM11/29/06
to Google Web Toolkit
i create the project same with your method,this my code
package com.linzhang.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;


/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class mycard1 implements EntryPoint {

/**
* This is the entry point method.
*/
public void onModuleLoad() {
final Button button = new Button("Click me");
final Label label = new Label();


button.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
System.out.println("hello");

}
});


// Assume that the host HTML has elements defined whose
// IDs are "slot1", "slot2". In a real app, you probably would not
want
// to hard-code IDs. Instead, you could, for example, search for
all
// elements with a particular CSS class and replace them with
widgets.
//
RootPanel.get("slot1").add(button);
RootPanel.get("slot2").add(label);
}
}

when i run it it report:

[ERROR] Errors in
'jar:file:/D:/gwt-windows-1.2.22/gwt-user.jar!/com/google/gwt/user/client/DOM.java'
[ERROR] Line 954: The method insertListItem(Element, String, String,


int) is undefined for the type DOMImpl

[ERROR] Line 966: The method setOptionText(Element, String, int) is


undefined for the type DOMImpl

[ERROR] Unable to load module entry point class
com.linzhang.client.mycard1


java.lang.Error: Unresolved compilation problems:
The import com.google.gwt.user.client.DOM cannot be resolved
DOM cannot be resolved

at com.google.gwt.user.client.ui.Button.<init>(Button.java:18)
at com.linzhang.client.mycard1.onModuleLoad(mycard1.java:20)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:67)


at
com.google.gwt.dev.shell.BrowserWidget.attachModuleSpace(BrowserWidget.java:286)
at
com.google.gwt.dev.shell.ie.BrowserWidgetIE6.access$100(BrowserWidgetIE6.java:20)
at
com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.gwtOnLoad(BrowserWidgetIE6.java:44)

at
com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.invoke(BrowserWidgetIE6.java:88)
at
com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:245)

[ERROR] Failure to load module 'com.linzhang.mycard1'

yummy

unread,
Nov 29, 2006, 7:52:27 PM11/29/06
to Google Web Toolkit
hi,and when i do like this code
package com.linzhang.client;

import com.google.gwt.core.client.EntryPoint;

/**


* Entry point classes define <code>onModuleLoad()</code>.
*/
public class mycard1 implements EntryPoint {

/**
* This is the entry point method.
*/
public void onModuleLoad() {

}
}

it also report the same error


[ERROR] Errors in
'jar:file:/D:/gwt-windows-1.2.22/gwt-user.jar!/com/google/gwt/user/client/DOM.java'
[ERROR] Line 954: The method insertListItem(Element, String, String,
int) is undefined for the type DOMImpl
[ERROR] Line 966: The method setOptionText(Element, String, int) is
undefined for the type DOMImpl


i think the gwt maybe crazy in my computer,god

dominik_steiner

unread,
Nov 30, 2006, 2:20:49 AM11/30/06
to Google Web Toolkit
Hi yummy,

i see that you are working wth gwt 1.2.22. did you try it with gwt
1.1.10?

but i must admit that i have no idea why you get those strange
errors...

i would try and download the gwt1.1.10 and have a fresh go with that...

Dominik

Dan Morrill

unread,
Nov 30, 2006, 3:17:44 PM11/30/06
to Google-We...@googlegroups.com
Hello, yummy!

You should double-check your various classpaths. (In particular, be very careful if you have "." on your classpath.) The insertListItem method appeared in GWT 1.2.22, and was not present in 1.1.10 .  I think you may have multiple versions of the GWT libraries on your classpath, and it's mixing class implementations, which is causing the error.

Let us know if that works!

- Dan Morrill

yummy

unread,
Dec 1, 2006, 7:16:56 AM12/1/06
to Google Web Toolkit
i really use 1.2.22 and i change to 1.1.10 and run it successly
found some bug when use cmd to creater eclipse project,in eclipse it
reports error
but when use command to complied and run it ,it run so ok!
thanks for everyone for help me!

aibo

unread,
Dec 4, 2006, 3:07:56 AM12/4/06
to Google Web Toolkit
thanks for these reply.
i use Eclipse3.2.1 with Instantiations Designer , open "window -
Preferences - Designer - GWT " , uncheck "Use patch for gwt-user.jar to
fix bugs in UI classes" , then it is OK.


"yummy 写道:

cb

unread,
Dec 14, 2006, 11:45:55 AM12/14/06
to Google Web Toolkit
Dear All,

i've been messing around one day with this sutff... thanks yummy
for your answer. Now it worksssss!!!!

Juan

aibo ha escrito:

水榭习羽

unread,
Jan 3, 2007, 8:11:13 AM1/3/07
to Google Web Toolkit
thanks.
the way is :
Reply all
Reply to author
Forward
0 new messages