运行时Gwt java.lang.ClassNotFoundException错误

时间:2013-09-20 15:22:33

标签: exception gwt runtime classnotfoundexception

在我的GWT项目中,servlet在war / WEB-INF / web.xml文件中定义;但是当我运行它时,Jetty为它们中的每一个提供了一个ClassNotFoundException;如下所示:

java.lang.ClassNotFoundException: tr.gov.gib.mhdb.vimer.vimerapp.server.CSGWTDownloadServletImpl    at
java.lang.ClassLoader.findClass(Unknown Source)     at 
java.lang.ClassLoader.loadClass(Unknown Source)     at 
java.lang.ClassLoader.loadClass(Unknown Source)     at 
org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:352)    at 
org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)    at 
org.mortbay.util.Loader.loadClass(Loader.java:91)   at 
org.mortbay.util.Loader.loadClass(Loader.java:71)   at 
org.mortbay.jetty.servlet.Holder.doStart(Holder.java:73)    at 
org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:233)     at 
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)    at 
org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:616)    at 
org.mortbay.jetty.servlet.Context.startContext(Context.java:140)    at 
org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)    at 
org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)   at 
org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)  at 
com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.
java:463)   at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)     
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)    at 
org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)     at 
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)    at 
org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)   at 
org.mortbay.jetty.Server.doStart(Server.java:222)   at 
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)    at 
com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:667)  at 
com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:500)    at 
com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1055)   at 
com.google.gwt.dev.DevModeBase.run(DevModeBase.java:804)    at 
com.google.gwt.dev.DevMode.main(DevMode.java:309)

编辑:还有:javax.servlet.UnavailableException: tr.gov.gib.mhdb.vimer.vimerapp.server.CSGWTDownloadServletImpl

我的web.xml是这样的:

    <?xml version="1.0" encoding="UTF-8"?>

    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

     <servlet>
        <servlet-name>generalService</servlet-name>
        <servlet-class>tr.gov.gib.mhdb.vimer.vimerapp.server.GeneralServiceImpl</servlet-class>
     </servlet>
     <servlet>
        <servlet-name>fetchTree</servlet-name>
        <servlet-class>tr.gov.gib.mhdb.vimer.vimerapp.server.MyTreeServiceImpl</servlet-class>
     </servlet>
     <servlet-mapping>
        <servlet-name>generalService</servlet-name>
        <url-pattern>/tr.gov.gib.mhdb.vimer.vimerapp.Vimer/generalService</url-pattern>

     </servlet-mapping>
     <servlet-mapping>
        <servlet-name>fetchTree</servlet-name>
        <url-pattern>/tr.gov.gib.mhdb.vimer.vimerapp.Vimer/fetchTree</url-pattern>
     </servlet-mapping>

</web-app>

1 个答案:

答案 0 :(得分:0)

您可能忘记在Service类中添加@RemoteServiceRelativePath(“name”),其中name与<servlet-name>中的名称相同。