2011-10-11 38 views
0

我一直在爲這個問題爭取3天,我猜StackOverflow是我的最後一招。我跑出去的想法,爲什麼它不工作:(我使用GWT 2.4.0和JDK 1.6。在客戶端代碼中使用RequestContext接口時,GWT應用程序在運行時崩潰

我所經歷的this tutorial,結果被套牢崩潰GWT應用程序。該應用程序崩潰,如果我提com.google.web.bindery.requestfactory.shared.RequestContext接口在我的客戶端代碼中,我甚至沒有使用它,我只是有一個未使用的方法,它將RequestContext作爲參數,我嘗試引用RequestFactory - 同樣的異常。 。「M缺少相關RequestFactory包東西,我加入-loglevel DEBUG到GWT編譯器,這裏是我有:

DEBUG: Rebinding com.vsezavtra.courierApp.client.ManagerShell.ManagerShellUiBinder. 
    DEBUG: Checking rule <generate-with class='com.google.web.bindery.requestfactory.gwt.rebind.RequestFactoryGenerator'/>. 
    ERROR: Errors in 'jar:file:/C:/work/externals/gwt/gwt-user.jar!/com/google/web/bindery/requestfactory/shared/Receiver.java'. 
    ERROR: Unable to find type 'com.vsezavtra.courierApp.client.ManagerShell.ManagerShellUiBinder'. 
     ERROR: Line 26: The import javax.validation.ConstraintViolation cannot be resolved. 
     ERROR: Line 79: ConstraintViolation cannot be resolved to a type. 
     ERROR: Line 81: ConstraintViolation cannot be resolved to a type. 
     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: Deferred binding failed for 'com.vsezavtra.courierApp.client.ManagerShell.ManagerShellUiBinder'; expect subsequent failures. 
ERROR: Unable to load module entry point class com.vsezavtra.courierApp.client.courierApp (see associated exception for details). java.lang.RuntimeException: Deferred binding failed for 'com.vsezavtra.courierApp.client.ManagerShell$ManagerShellUiBinder' (did you forget to inherit a required module?) 
    at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:53) 
    at com.google.gwt.core.client.GWT.create(GWT.java:97) 
    at com.vsezavtra.courierApp.client.ManagerShell.<clinit>(ManagerShell.java:15) 
    at com.vsezavtra.courierApp.client.courierApp.onModuleLoad(courierApp.java:10) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396) 
    at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200) 
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:525) 
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363) 
    at java.lang.Thread.run(Thread.java:662) 
Caused by: com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries) 
    at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:595) 
    at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:455) 
    at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49) 
    at com.google.gwt.core.client.GWT.create(GWT.java:97) 
    at com.vsezavtra.courierApp.client.ManagerShell.<clinit>(ManagerShell.java:15) 
    at com.vsezavtra.courierApp.client.courierApp.onModuleLoad(courierApp.java:10) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396) 
    at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200) 
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:525) 
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363) 
    at java.lang.Thread.run(Thread.java:662) 
ERROR: Failed to load module 'courierApp' from user agent 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.202 Safari/535.1' at localhost:10695. 

全部日誌here。我的應用程序非常小。這是我的GWT XML文件

<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.0//EN" "http://google-web-toolkit.googlecode.com/svn/releases/2.0/distro-source/core/src/gwt-module.dtd"> 
<module rename-to="courierApp"> 
    <inherits name='com.google.gwt.user.User'/> 
    <inherits name="com.google.web.bindery.requestfactory.RequestFactory"/> 

    <source path="client"/> 

    <entry-point class='com.vsezavtra.courierApp.client.courierApp'/> 
</module> 

主要入口點類:

package com.vsezavtra.courierApp.client; 

import com.google.gwt.core.client.EntryPoint; 
import com.google.gwt.user.client.ui.RootLayoutPanel; 

public class courierApp implements EntryPoint 
{ 
    public void onModuleLoad() 
    { 
     RootLayoutPanel.get().add(new ManagerShell()); 
    } 
} 

可綁定UI類

package com.vsezavtra.courierApp.client; 

import com.google.gwt.core.client.GWT; 
import com.google.gwt.uibinder.client.UiBinder; 
import com.google.gwt.user.client.ui.Composite; 
import com.google.gwt.user.client.ui.Widget; 
import com.google.web.bindery.requestfactory.shared.RequestContext; 

public class ManagerShell extends Composite 
{ 
    interface ManagerShellUiBinder extends UiBinder<Widget, ManagerShell> 
    { 
    } 

    private static ManagerShellUiBinder uiBinder = GWT.create(ManagerShellUiBinder.class); 

    public ManagerShell() 
    { 
     initWidget(uiBinder.createAndBindUi(this)); 
    } 
    // if I remove this method everything works :(
    public void SetTest(RequestContext test) {} 
} 

和相應的XML文件

<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui'> 
    <g:VerticalPanel> 
     <g:HTMLPanel> 
      Test! 
     </g:HTMLPanel> 
     <g:HTMLPanel> 
      Test2! 
     </g:HTMLPanel> 
    </g:VerticalPanel> 
</ui:UiBinder> 

最後我web.xml文件只有根「web-app 「元素,因爲我沒有服務器端部分(尚未)。

我正在使用IntelliJ IDEA 10.5.2來調試應用程序。

如果您有任何其他問題,請讓我知道。我真的不知道還有什麼我可以做:(

回答

3

看樣子你缺少一個javax.validation實現,RequestFactory取決於:在該配線部分

ERROR: Line 81: ConstraintViolation cannot be resolved to a type.

在教程RequestFactory休眠-驗證建議以及其他一些依賴關係:!

* requestfactory-server.jar 
* javax/validation/validator-api-1.0.0.GA.jar 
* A JSR 303 Validator of your choice, such as hibernate-validator 
+2

衛生署,它缺少**驗證-API 1.0.0.GA-sources.jar **我永遠不會覺得非常感謝爲了指引我正確的方向,Te rrell。 – expert

相關問題