GWT-comet构建因ClassNotFoundException而失败

时间:2014-04-11 17:45:12

标签: java gwt comet

我尝试使用官方指南(http://code.google.com/p/gwt-comet/wiki/GettingStarted)设置GWT-comet。我做了什么:

  1. 将gwt-comet-1.2.3.jar添加到项目和构建路径。
  2. 设置基本客户端和服务器代码。
  3. 继承所需的模块。
  4. < inherits name='net.zschech.gwt.comet.Comet'/>

    崩溃显然与继承模块有关。堆栈跟踪:

    Loading modules
       com.MyApp.Test
          Loading inherited module 'com.MyApp.Test'
             Loading inherited module 'net.zschech.gwt.comet.Comet'
                [ERROR] Unexpected error while processing XML
    java.lang.NoClassDefFoundError: com/google/gwt/core/ext/GeneratorExt
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at com.google.gwt.dev.cfg.ModuleDefSchema$ClassAttrCvt.convertToArg(ModuleDefSchema.java:888)
        at com.google.gwt.dev.util.xml.HandlerArgs.convertToArg(HandlerArgs.java:64)
        at com.google.gwt.dev.util.xml.HandlerMethod.invokeBegin(HandlerMethod.java:221)
        at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.startElement(ReflectiveParser.java:294)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.parse(ReflectiveParser.java:347)
        at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.access$200(ReflectiveParser.java:68)
        at com.google.gwt.dev.util.xml.ReflectiveParser.parse(ReflectiveParser.java:418)
        at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:333)
        at com.google.gwt.dev.cfg.ModuleDefSchema$BodySchema.__inherits_begin(ModuleDefSchema.java:497)
        at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.google.gwt.dev.util.xml.HandlerMethod.invokeBegin(HandlerMethod.java:230)
        at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.startElement(ReflectiveParser.java:294)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
        at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.parse(ReflectiveParser.java:347)
        at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.access$200(ReflectiveParser.java:68)
        at com.google.gwt.dev.util.xml.ReflectiveParser.parse(ReflectiveParser.java:418)
        at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:333)
        at com.google.gwt.dev.cfg.ModuleDefLoader.load(ModuleDefLoader.java:254)
        at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:197)
        at com.google.gwt.dev.cfg.ModuleDefLoader.loadFromResources(ModuleDefLoader.java:157)
        at com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(ModuleDefLoader.java:132)
        at com.google.gwt.dev.DevModeBase.loadModule(DevModeBase.java:1026)
        at com.google.gwt.dev.DevMode.loadModule(DevMode.java:570)
        at com.google.gwt.dev.DevMode.doStartup(DevMode.java:456)
        at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1094)
        at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:844)
        at com.google.gwt.dev.DevMode.main(DevMode.java:322)
    Caused by: java.lang.ClassNotFoundException: com.google.gwt.core.ext.GeneratorExt
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        ... 59 more
             [ERROR] Line 11: Unexpected exception while processing element 'inherits'
    com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
        at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:336)
        at com.google.gwt.dev.cfg.ModuleDefSchema$BodySchema.__inherits_begin(ModuleDefSchema.java:497)
        at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.google.gwt.dev.util.xml.HandlerMethod.invokeBegin(HandlerMethod.java:230)
        at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.startElement(ReflectiveParser.java:294)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
        at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.parse(ReflectiveParser.java:347)
        at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.access$200(ReflectiveParser.java:68)
        at com.google.gwt.dev.util.xml.ReflectiveParser.parse(ReflectiveParser.java:418)
        at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:333)
        at com.google.gwt.dev.cfg.ModuleDefLoader.load(ModuleDefLoader.java:254)
        at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:197)
        at com.google.gwt.dev.cfg.ModuleDefLoader.loadFromResources(ModuleDefLoader.java:157)
        at com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(ModuleDefLoader.java:132)
        at com.google.gwt.dev.DevModeBase.loadModule(DevModeBase.java:1026)
        at com.google.gwt.dev.DevMode.loadModule(DevMode.java:570)
        at com.google.gwt.dev.DevMode.doStartup(DevMode.java:456)
        at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1094)
        at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:844)
        at com.google.gwt.dev.DevMode.main(DevMode.java:322)
             [ERROR] Failure while parsing XML
    com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
        at com.google.gwt.dev.util.xml.DefaultSchema.onHandlerException(DefaultSchema.java:58)
        at com.google.gwt.dev.util.xml.Schema.onHandlerException(Schema.java:66)
        at com.google.gwt.dev.util.xml.Schema.onHandlerException(Schema.java:66)
        at com.google.gwt.dev.util.xml.HandlerMethod.invokeBegin(HandlerMethod.java:240)
        at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.startElement(ReflectiveParser.java:294)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
        at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.parse(ReflectiveParser.java:347)
        at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.access$200(ReflectiveParser.java:68)
        at com.google.gwt.dev.util.xml.ReflectiveParser.parse(ReflectiveParser.java:418)
        at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:333)
        at com.google.gwt.dev.cfg.ModuleDefLoader.load(ModuleDefLoader.java:254)
        at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:197)
        at com.google.gwt.dev.cfg.ModuleDefLoader.loadFromResources(ModuleDefLoader.java:157)
        at com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(ModuleDefLoader.java:132)
        at com.google.gwt.dev.DevModeBase.loadModule(DevModeBase.java:1026)
        at com.google.gwt.dev.DevMode.loadModule(DevMode.java:570)
        at com.google.gwt.dev.DevMode.doStartup(DevMode.java:456)
        at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1094)
        at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:844)
        at com.google.gwt.dev.DevMode.main(DevMode.java:322)
             [ERROR] Unexpected error while processing XML
    com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
        at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.parse(ReflectiveParser.java:371)
        at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.access$200(ReflectiveParser.java:68)
        at com.google.gwt.dev.util.xml.ReflectiveParser.parse(ReflectiveParser.java:418)
        at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:333)
        at com.google.gwt.dev.cfg.ModuleDefLoader.load(ModuleDefLoader.java:254)
        at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:197)
        at com.google.gwt.dev.cfg.ModuleDefLoader.loadFromResources(ModuleDefLoader.java:157)
        at com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(ModuleDefLoader.java:132)
        at com.google.gwt.dev.DevModeBase.loadModule(DevModeBase.java:1026)
        at com.google.gwt.dev.DevMode.loadModule(DevMode.java:570)
        at com.google.gwt.dev.DevMode.doStartup(DevMode.java:456)
        at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1094)
        at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:844)
        at com.google.gwt.dev.DevMode.main(DevMode.java:322)
    [ERROR] shell failed in doStartup method
    

    知道为什么会这样吗?提前谢谢。

2 个答案:

答案 0 :(得分:1)

gwt-comet-1.2.3.jar与GWT 2.5.0-rc1(或更高版本)不兼容。

所以你需要将gwt-comet版本升级到1.2.5。

link:https://gwt-comet.googlecode.com/issues/attachment?aid=330005000&name=gwt-comet-1.2.5.jar&token=St1Wda3HoyBJfRyZZ-Vq3zQibKo%3A1398940143165

答案 1 :(得分:0)

问题是一个空间,这就是为什么你得到低于例外的原因:

  

[ERROR]处理XML时出现意外错误

     

[错误]第11行:处理元素'inherits'时出现意外异常

使用

<inherits name="net.zschech.gwt.comet.Comet" />

而不是

< inherits name="net.zschech.gwt.comet.Comet" />

- 编辑 -

  

引起:java.lang.ClassNotFoundException:com.google.gwt.core.ext.GeneratorExt

请看下面关于Google-web-toolkit的讨论