我一直试图开始使用GWT,但是我不想从我的学生IntelliJ IDEA Ultimate License(这是gwtproject.org教程中使用的IDE)切换到Eclipse。在本教程中,他们首先希望您使用webAppCreator创建一个示例Web应用程序,我认为这是在IntelliJ中打开具有GWT支持的新项目时可以创建的示例应用程序。但是,我的问题是,当启动他们的示例应用程序时,在“开发模式”选项卡中会收到大量错误消息。启动浏览器后,只会显示一条HTTP错误503消息,提示该服务不可用。这是使用安装了apache ant的gwt的2.8.2版本(如果相关)。使用2.7.0 gwt发行版,我什至没有到达那里,因为它几乎立即崩溃了。
感谢您的帮助!
我不确定这是否仍然正确,但是我读到IntelliJ仅支持gwt 2.7.0,这就是为什么我在问题中都包括了这两个原因。
使用Java 1.8和gwt 2.7.0的开发模式日志
Runing CodeServer with parameters: [-noprecompile, -port, 9876, -sourceLevel, 1.7, -bindAddress, 127.0.0.1, -launcherDir, C:\Users\nicol\.IntelliJIdea2018.3\system\gwt\java18and270.a6677367\java18and270.73130fb9\run\www, -logLevel, INFO, com.mySampleApplication.MySampleApplication]
Mär 25, 2019 12:45:31 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
Super Dev Mode starting up
workDir: C:\Users\nicol\AppData\Local\Temp\gwt-codeserver-4172072951619368748.tmp
Loading modules
com.mySampleApplication.MySampleApplication
Validating <servlet> tags for module 'MySampleApplication'
For additional info see: file:/G:/nicol/Libraries/OneDrive/JavaDevelopment/WebDev/gwt-2.7.0/doc/helpInfo/servletMappings.html
[WARN] Module declares a servlet class 'com.mySampleApplication.server.MySampleApplicationServiceImpl', but the web.xml has no corresponding declaration; please add the following lines to your web.xml:
<servlet>
<servlet-name>mySampleApplicationServiceImpl</servlet-name>
<servlet-class>com.mySampleApplication.server.MySampleApplicationServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>mySampleApplicationServiceImpl</servlet-name>
<url-pattern>/MySampleApplication/MySampleApplicationService</url-pattern>
</servlet-mapping>
Loading Java files in com.mySampleApplication.MySampleApplication.
Starting Jetty on port 8888
[WARN] Failed startup of context c.g.g.d.s.j.WebAppContextWithReload{/,file:/C:/Users/nicol/.IntelliJIdea2018.3/system/gwt/java18and270.a6677367/java18and270.73130fb9/run/www/},C:\Users\nicol\.IntelliJIdea2018.3\system\gwt\java18and270.a6677367\java18and270.73130fb9\run\www
java.lang.NullPointerException
at org.eclipse.jetty.servlet.ServletHolder.compareTo(ServletHolder.java:204)
at java.util.ComparableTimSort.countRunAndMakeAscending(ComparableTimSort.java:321)
at java.util.ComparableTimSort.sort(ComparableTimSort.java:188)
at java.util.Arrays.sort(Arrays.java:1246)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:770)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:541)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
at org.eclipse.jetty.server.handler.RequestLogHandler.doStart(RequestLogHandler.java:162)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
at org.eclipse.jetty.server.Server.doStart(Server.java:282)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:740)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:632)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1054)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:836)
at com.google.gwt.dev.DevMode.main(DevMode.java:413)
Module setup completed in 13378 ms
The code server is ready at http://127.0.0.1:9876/
Code server started in 13692 ms
waited 9583 ms for code server to finish
Dev Mode initialized. Startup URL:
http://127.0.0.1:8888/MySampleApplication.html
[ERROR] 503 - GET /MySampleApplication.html (127.0.0.1) 1311 bytes
Request headers
Host: 127.0.0.1:8888
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
DNT: 1
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Response headers
Cache-Control: must-revalidate,no-cache,no-store
Content-Type: text/html;charset=ISO-8859-1
Content-Length: 1311
[ERROR] 503 - GET /favicon.ico (127.0.0.1) 1298 bytes
Request headers
Host: 127.0.0.1:8888
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
DNT: 1
Connection: keep-alive
Response headers
Cache-Control: must-revalidate,no-cache,no-store
Content-Type: text/html;charset=ISO-8859-1
Content-Length: 1298
使用Java 1.8和gwt 2.8.2的Dev模式日志
Running CodeServer with parameters: [-noprecompile, -port, 9876, -sourceLevel, 1.8, -bindAddress, 127.0.0.1, -launcherDir, C:\Users\nicol\.IntelliJIdea2018.3\system\gwt\java18and282.a6677388\java18and282.cbb23d59\run\www, -logLevel, INFO, -style, OBFUSCATED, com.mySampleApplication.MySampleApplication]
Mär 25, 2019 12:47:21 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
Super Dev Mode starting up
workDir: C:\Users\nicol\AppData\Local\Temp\gwt-codeserver-9053967864514777082.tmp
2019-03-25 12:47:22.461:INFO::main: Logging initialized @2528ms
Loading Java files in com.mySampleApplication.MySampleApplication.
Module setup completed in 16450 ms
2019-03-25 12:47:37.943:INFO:oejs.Server:main: jetty-9.2.z-SNAPSHOT
2019-03-25 12:47:37.971:INFO:oejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@64dcaf38{/,null,AVAILABLE}
2019-03-25 12:47:37.998:INFO:oejs.ServerConnector:main: Started ServerConnector@184e6e74{HTTP/1.1}{127.0.0.1:9876}
2019-03-25 12:47:37.998:INFO:oejs.Server:main: Started @18064ms
The code server is ready at http://127.0.0.1:9876/
Code server started in 16.78 s ms
Loading modules
com.mySampleApplication.MySampleApplication
Validating <servlet> tags for module 'MySampleApplication'
For additional info see: file:/G:/nicol/Libraries/OneDrive/JavaDevelopment/WebDev/gwt-2.8.2/doc/helpInfo/servletMappings.html
[WARN] Module declares a servlet class 'com.mySampleApplication.server.MySampleApplicationServiceImpl', but the web.xml has no corresponding declaration; please add the following lines to your web.xml:
<servlet>
<servlet-name>mySampleApplicationServiceImpl</servlet-name>
<servlet-class>com.mySampleApplication.server.MySampleApplicationServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>mySampleApplicationServiceImpl</servlet-name>
<url-pattern>/MySampleApplication/MySampleApplicationService</url-pattern>
</servlet-mapping>
2019-03-25 12:47:38.166:INFO:oejs.Server:main: jetty-9.2.z-SNAPSHOT
2019-03-25 12:47:40.252:WARN:/:main: unavailable
javax.servlet.UnavailableException: No class in holder
at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHolder.java:88)
at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:338)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:870)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:298)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1349)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1342)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:550)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.handler.RequestLogHandler.doStart(RequestLogHandler.java:140)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.server.Server.start(Server.java:387)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.Server.doStart(Server.java:354)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:760)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:636)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:923)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:706)
at com.google.gwt.dev.DevMode.main(DevMode.java:432)
2019-03-25 12:47:40.253:WARN:oejuc.AbstractLifeCycle:main: FAILED null@5353c376==null,-1,false: javax.servlet.UnavailableException: No class in holder
javax.servlet.UnavailableException: No class in holder
at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHolder.java:88)
at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:338)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:870)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:298)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1349)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1342)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:550)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.handler.RequestLogHandler.doStart(RequestLogHandler.java:140)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.server.Server.start(Server.java:387)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.Server.doStart(Server.java:354)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:760)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:636)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:923)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:706)
at com.google.gwt.dev.DevMode.main(DevMode.java:432)
2019-03-25 12:47:40.267:WARN:/:main: unavailable
javax.servlet.UnavailableException: No class in holder
at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHolder.java:88)
at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:338)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:888)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:298)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1349)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1342)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:550)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.handler.RequestLogHandler.doStart(RequestLogHandler.java:140)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.server.Server.start(Server.java:387)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.Server.doStart(Server.java:354)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:760)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:636)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:923)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:706)
at com.google.gwt.dev.DevMode.main(DevMode.java:432)
2019-03-25 12:47:40.268:WARN:oejuc.AbstractLifeCycle:main: FAILED null@5353c376==null,-1,false: javax.servlet.UnavailableException: No class in holder
javax.servlet.UnavailableException: No class in holder
at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHolder.java:88)
at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:338)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:888)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:298)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1349)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1342)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:550)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.handler.RequestLogHandler.doStart(RequestLogHandler.java:140)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.server.Server.start(Server.java:387)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.Server.doStart(Server.java:354)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:760)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:636)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:923)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:706)
at com.google.gwt.dev.DevMode.main(DevMode.java:432)
Starting Jetty on port 8888
[WARN] Failed startup of context c.g.g.d.s.j.WebAppContextWithReload@30de9fe5{/,file:/C:/Users/nicol/.IntelliJIdea2018.3/system/gwt/java18and282.a6677388/java18and282.cbb23d59/run/www/,STARTING}{C:\Users\nicol\.IntelliJIdea2018.3\system\gwt\java18and282.a6677388\java18and282.cbb23d59\run\www}
MultiException[javax.servlet.UnavailableException: No class in holder, javax.servlet.UnavailableException: No class in holder]
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:842)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:298)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1349)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1342)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:550)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.handler.RequestLogHandler.doStart(RequestLogHandler.java:140)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.server.Server.start(Server.java:387)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.Server.doStart(Server.java:354)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:760)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:636)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:923)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:706)
at com.google.gwt.dev.DevMode.main(DevMode.java:432)
Suppressed: javax.servlet.UnavailableException: No class in holder
at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHolder.java:88)
at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:338)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:888)
... 23 more
Caused by: javax.servlet.UnavailableException: No class in holder
at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHolder.java:88)
at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:338)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:870)
... 23 more
2019-03-25 12:47:40.272:INFO:oejs.ServerConnector:main: Started ServerConnector@14ff45c2{HTTP/1.1}{127.0.0.1:8888}
2019-03-25 12:47:40.273:INFO:oejs.Server:main: Started @20339ms
Dev Mode initialized. Startup URL:
http://127.0.0.1:8888/MySampleApplication.html
[ERROR] 503 - GET /MySampleApplication.html (127.0.0.1) 312 bytes
Request headers
Host: 127.0.0.1:8888
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
DNT: 1
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Response headers
Date: Mon, 25 Mar 2019 11:47:41 GMT
Cache-Control: must-revalidate,no-cache,no-store
Content-Type: text/html; charset=ISO-8859-1
Content-Length: 312
答案 0 :(得分:1)
问题似乎是由IntelliJ创建的“示例GWT项目”缺少了web.xml
文件中的servlet声明,正如您在日志中看到的以下警告所指出的那样:
[WARN]模块声明了一个servlet类'com.mySampleApplication.server.MySampleApplicationServiceImpl',但是web.xml没有相应的声明。请在您的web.xml中添加以下行:
<servlet> <servlet-name>mySampleApplicationServiceImpl</servlet-name> <servlet-class>com.mySampleApplication.server.MySampleApplicationServiceImpl</servlet-class> </servlet> <servlet-mapping> <servlet-name>mySampleApplicationServiceImpl</servlet-name> <url-pattern>/MySampleApplication/MySampleApplicationService</url-pattern> </servlet-mapping>
检查后,我可以确认IntelliJ生成的web.xml
看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
<servlet/>
</web-app>
因此,您需要添加日志中提到的行才能起作用:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
<servlet>
<servlet-name>mySampleApplicationServiceImpl</servlet-name>
<servlet-class>com.mySampleApplication.server.MySampleApplicationServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>mySampleApplicationServiceImpl</servlet-name>
<url-pattern>/MySampleApplication/MySampleApplicationService</url-pattern>
</servlet-mapping>
</web-app>
作为参考,请与GWT SDK的web.xml
命令创建的示例webAppCreator
进行比较,它没有此问题:
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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"
version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee">
<!-- Servlets -->
<servlet>
<servlet-name>greetServlet</servlet-name>
<servlet-class>com.example.server.GreetingServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>greetServlet</servlet-name>
<url-pattern>/stockwatcher/greet</url-pattern>
</servlet-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>StockWatcher.html</welcome-file>
</welcome-file-list>
</web-app>