Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
GWT:在现有webapp中或作为独立实体创建新的GWT模块_Gwt_Web Applications_Module_Eclipse Plugin - Fatal编程技术网

GWT:在现有webapp中或作为独立实体创建新的GWT模块

GWT:在现有webapp中或作为独立实体创建新的GWT模块,gwt,web-applications,module,eclipse-plugin,Gwt,Web Applications,Module,Eclipse Plugin,我使用EclipseGWT插件创建了一个示例GWTwebapp,它运行得非常完美 但当我尝试通过添加新模块时 右键单击我的webapp项目 选择新的|其他…|GWT类|模块选项;及 单击向导上的“下一步”按钮 什么也没有发生-向导继续保持在同一页上 接下来,我复制粘贴了我的工作webapp的包/目录结构,并手动对NewModule.gwt.xml及其内容进行了适当的更改;我还适当地更改了Java类名,并刷新了Eclipse项目 但是,现在,当我在项目上运行GWT Compile时(通过在Ecli

我使用EclipseGWT插件创建了一个示例GWTwebapp,它运行得非常完美

但当我尝试通过添加新模块时

  • 右键单击我的webapp项目
  • 选择新的|其他…|GWT类|模块选项;及
  • 单击向导上的“下一步”按钮
  • 什么也没有发生-向导继续保持在同一页上

    接下来,我复制粘贴了我的工作webapp的包/目录结构,并手动对
    NewModule.gwt.xml
    及其内容进行了适当的更改;我还适当地更改了Java类名,并刷新了Eclipse项目

    但是,现在,当我在项目上运行GWT Compile时(通过在Eclipse中右键单击项目),它只编译原始的webapp,完全忽略了我在文件系统上手动创建的
    NewModule
    模块

    问题:

  • 我做错了什么

  • 是否有一种命令行方法可以简化在现有webapp中创建新模块的过程,或者理想情况下,将其创建为独立实体


  • 我正在Ubuntu 16.04上使用GWT2.8.0和Eclipse Neon。我也尝试过GWT2.7.0,其行为与上面相同。

    我可以重现这一点。谢天谢地,记录了一个事件,这将给我们一些想法:

    Plug-in:   org.eclipse.ui
    Serverity: Error
    Message:   Unhandled event loop exception
    
    java.lang.ClassCastException: org.eclipse.jdt.internal.core.JarEntryFile cannot be cast to org.eclipse.core.resources.IFile
        at com.google.gwt.eclipse.core.modules.AbstractModule.getShortName(AbstractModule.java:294)
        at com.google.gwt.eclipse.core.modules.AbstractModule.getQualifiedName(AbstractModule.java:272)
        at com.google.gwt.eclipse.core.modules.ModuleJarResource.getQualifiedName(ModuleJarResource.java:1)
        at com.google.gwt.eclipse.core.modules.AbstractModule.getSimpleName(AbstractModule.java:342)
        at com.google.gwt.eclipse.core.modules.ModuleJarResource.getSimpleName(ModuleJarResource.java:1)
        at com.google.gwt.eclipse.core.modules.ModuleUtils$3.visit(ModuleUtils.java:220)
        at com.google.gwt.eclipse.core.modules.ModuleUtils$3.visit(ModuleUtils.java:1)
        at com.google.gwt.eclipse.core.modules.ModuleUtils.visitFragments(ModuleUtils.java:338)
        at com.google.gwt.eclipse.core.modules.ModuleUtils.findModule(ModuleUtils.java:212)
        at com.google.gwt.eclipse.core.wizards.NewModuleWizardPage.addCommonGWTModulesAsDefaultInherits(NewModuleWizardPage.java:367)
        at com.google.gwt.eclipse.core.wizards.NewModuleWizardPage.moduleContainerChanged(NewModuleWizardPage.java:496)
        at com.google.gwt.eclipse.core.wizards.NewModuleWizardPage.doFieldChange(NewModuleWizardPage.java:291)
        at com.google.gwt.eclipse.core.wizards.NewModuleWizardPage.handleFieldChanged(NewModuleWizardPage.java:322)
        at org.eclipse.jdt.ui.wizards.NewContainerWizardPage.containerDialogFieldChanged(NewContainerWizardPage.java:319)
        at org.eclipse.jdt.ui.wizards.NewContainerWizardPage.access$1(NewContainerWizardPage.java:314)
        at org.eclipse.jdt.ui.wizards.NewContainerWizardPage$ContainerFieldAdapter.dialogFieldChanged(NewContainerWizardPage.java:300)
        at org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField.dialogFieldChanged(DialogField.java:75)
        at org.eclipse.jdt.internal.ui.wizards.dialogfields.StringDialogField.setText(StringDialogField.java:180)
        at org.eclipse.jdt.ui.wizards.NewContainerWizardPage.setPackageFragmentRoot(NewContainerWizardPage.java:470)
        at org.eclipse.jdt.ui.wizards.NewContainerWizardPage.initContainerPage(NewContainerWizardPage.java:163)
        at com.google.gwt.eclipse.core.wizards.NewModuleWizardPage.initModulePage(NewModuleWizardPage.java:328)
        at com.google.gwt.eclipse.core.wizards.NewModuleWizard.addPages(NewModuleWizard.java:55)
        at org.eclipse.jface.wizard.WizardSelectionPage.getNextPage(WizardSelectionPage.java:116)
        at org.eclipse.ui.internal.dialogs.WorkbenchWizardSelectionPage.getNextPage(WorkbenchWizardSelectionPage.java:98)
        at org.eclipse.jface.wizard.WizardDialog.nextPressed(WizardDialog.java:869)
        at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:419)
        at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:618)
        at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:249)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
        at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5219)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1340)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4553)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4143)
        at org.eclipse.jface.window.Window.runEventLoop(Window.java:818)
        at org.eclipse.jface.window.Window.open(Window.java:794)
        at org.eclipse.ui.internal.handlers.WizardHandler$New.executeHandler(WizardHandler.java:269)
        at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:290)
        at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:295)
        at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)
        at sun.reflect.GeneratedMethodAccessor75.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55)
        at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:282)
        at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:264)
        at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
        at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:152)
        at org.eclipse.core.commands.Command.executeWithChecks(Command.java:494)
        at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:488)
        at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210)
        at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:353)
        at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:155)
        at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:565)
        at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:397)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
        at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5219)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1340)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4553)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4143)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
        at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
        at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:687)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:604)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
        at org.eclipse.equinox.launcher.Main.main(Main.java:1492)
    
    其次是:

    Session Data:
    
    eclipse.buildId=4.6.1.M20160907-1200
    java.version=1.8.0_112
    java.vendor=Oracle Corporation
    BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
    Framework arguments:  -product org.eclipse.epp.package.jee.product --launcher.GTK_version 2
    Command-line arguments:  -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.jee.product --launcher.GTK_version 2
    
    This is a continuation of log file /home/user/workspace/.metadata/.bak_0.log
    Created Time: 2017-05-02 11:19:21.409
    
    在我的例子中,
    .bak_0.log
    没有什么有趣/新鲜的地方。我已经向Eclipse报告了这个问题,并记录了这个问题

    编辑:当然这并不能回答你真正的问题,我也会看看我是否能帮上忙

    编辑2:

    因为您已经手动添加了模块,所以我假设IDE集成不知道这一点。右键单击您的项目,转到GWT,然后从折叠中选择设置,而不是编译。您看到对话框中列出的新模块了吗?如果没有,添加它,然后查看GWT编译是否开始为您工作

    关于命令行,请参考

    编辑3:

    好吧,现在我无法重现你的行为。我再次启动了演示代码,然后复制了它,这样我在同一个项目中就有了两个模块。它们不从彼此或任何东西继承-scratch引用scratch/scratch2引用scratch2。我没有创建另一个html文件来引用第二个模块。下面是我的设置:

    ./src/scratch/server/GreetingServiceImpl.java
    ./src/scratch/shared/FieldVerifier.java
    ./src/scratch/client/Scratch_gwt.java
    ./src/scratch/client/GreetingService.java
    ./src/scratch/client/GreetingServiceAsync.java
    ./src/scratch/Scratch_gwt.gwt.xml
    
    ./src/scratch2/server/GreetingService2Impl.java
    ./src/scratch2/shared/FieldVerifier2.java
    ./src/scratch2/client/GreetingService2Async.java
    ./src/scratch2/client/Scratch2_gwt.java
    ./src/scratch2/client/GreetingService2.java
    ./src/scratch2/Scratch2_gwt.gwt.xml
    
    我不知道它是否相关(有点怀疑),但我也修改了我的web.xml:

      <servlet>
        <servlet-name>greetServlet</servlet-name>
        <servlet-class>scratch.server.GreetingServiceImpl</servlet-class>
      </servlet>
      <servlet>
        <servlet-name>greetServlet2</servlet-name>
        <servlet-class>scratch2.server.GreetingService2Impl</servlet-class>
      </servlet>
    
      <servlet-mapping>
        <servlet-name>greetServlet</servlet-name>
        <url-pattern>/scratch_gwt/greet</url-pattern>
      </servlet-mapping>
    
      <servlet-mapping>
        <servlet-name>greetServlet2</servlet-name>
        <url-pattern>/scratch_gwt/greet2</url-pattern>
      </servlet-mapping>
    
    我必须在这里添加Scratch2_gwt入口点。以及我的编译输出:

    Compiling module scratch.Scratch_gwt
       Compiling 5 permutations
          Compiling permutation 0...
          Compiling permutation 1...
          Compiling permutation 2...
          Compiling permutation 3...
          Compiling permutation 4...
       Compile of permutations succeeded
       Compilation succeeded -- 11.274s
    Linking into /home/user/workspace/scratch-gwt/war/scratch_gwt
       Link succeeded
       Linking succeeded -- 0.180s
    Compiling module scratch2.Scratch2_gwt
       Compiling 5 permutations
          Compiling permutation 0...
          Compiling permutation 1...
          Compiling permutation 2...
          Compiling permutation 3...
          Compiling permutation 4...
       Compile of permutations succeeded
       Compilation succeeded -- 7.821s
    Linking into /home/user/workspace/scratch-gwt/war/scratch2_gwt
       Link succeeded
       Linking succeeded -- 0.109s
    

    因此,我只能说,这确实是可能的。重新修改编译设置,从头开始一个新项目,再试一次,或者发布一些配置。

    我一直在入口点模块中看到我的
    NewModule
    。只是这一次,我尝试将日志级别从INFO提升到ALL。没有区别-在ALL生成的详细日志输出中,没有提到
    NewModule
    。感谢您向Eclipse和GWT团队标记此问题。接下来,我将尝试
    webAppCreator
    ,但在将响应标记为最终响应之前,我将再等待一段时间。
    Compiling module scratch.Scratch_gwt
       Compiling 5 permutations
          Compiling permutation 0...
          Compiling permutation 1...
          Compiling permutation 2...
          Compiling permutation 3...
          Compiling permutation 4...
       Compile of permutations succeeded
       Compilation succeeded -- 11.274s
    Linking into /home/user/workspace/scratch-gwt/war/scratch_gwt
       Link succeeded
       Linking succeeded -- 0.180s
    Compiling module scratch2.Scratch2_gwt
       Compiling 5 permutations
          Compiling permutation 0...
          Compiling permutation 1...
          Compiling permutation 2...
          Compiling permutation 3...
          Compiling permutation 4...
       Compile of permutations succeeded
       Compilation succeeded -- 7.821s
    Linking into /home/user/workspace/scratch-gwt/war/scratch2_gwt
       Link succeeded
       Linking succeeded -- 0.109s