0

在我的 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>
4

1 回答 1

0

您可能忘记在 Service 类中添加 @RemoteServiceRelativePath("name") ,其中 name 与<servlet-name>.

于 2013-09-21T03:53:38.200 回答