HttpServlet cannot be resolved to a type

简介: Description Resource Path Location TypeHttpServlet cannot be resolved to a type SimpleServlet.java /JavaHelloWorldApp/src/main/java/wasdev/sample/se...
Description Resource Path Location Type
HttpServlet cannot be resolved to a type SimpleServlet.java /JavaHelloWorldApp/src/main/java/wasdev/sample/servlet line 15 Java Problem
HttpServletRequest cannot be resolved to a type SimpleServlet.java /JavaHelloWorldApp/src/main/java/wasdev/sample/servlet line 22 Java Problem
HttpServletResponse cannot be resolved to a type SimpleServlet.java /JavaHelloWorldApp/src/main/java/wasdev/sample/servlet line 22 Java Problem
ServletException cannot be resolved to a type SimpleServlet.java /JavaHelloWorldApp/src/main/java/wasdev/sample/servlet line 22 Java Problem
The import javax.servlet cannot be resolved SimpleServlet.java /JavaHelloWorldApp/src/main/java/wasdev/sample/servlet line 5 Java Problem
The import javax.servlet cannot be resolved SimpleServlet.java /JavaHelloWorldApp/src/main/java/wasdev/sample/servlet line 6 Java Problem
The import javax.servlet cannot be resolved SimpleServlet.java /JavaHelloWorldApp/src/main/java/wasdev/sample/servlet line 7 Java Problem
The import javax.servlet cannot be resolved SimpleServlet.java /JavaHelloWorldApp/src/main/java/wasdev/sample/servlet line 8 Java Problem
The import javax.servlet cannot be resolved SimpleServlet.java /JavaHelloWorldApp/src/main/java/wasdev/sample/servlet line 9 Java Problem

WebServlet cannot be resolved to a type SimpleServlet.java /JavaHelloWorldApp/src/main/java/wasdev/sample/servlet line 14 Java Problem


在文章 Java中REST API使用示例——基于云平台+云服务打造自己的在线翻译工具 中从IBM Bluemix上下载的Java示例代码,导入到Eclipse之后,出现以上错误信息!


错误原因:

Eclipse是刚刚安装的,还没有配置服务器运行环境!

解决办法:

1、首先要安装一下Tomcat;

通常是下载一个zip压缩包,解压一下就可以了;

2、Eclipse中点击Window菜单,选择Preferences


3、在左侧展开Server,选择Runtime Environment,右侧点击Add按钮


4、在弹出的窗口中选择你的Tomcat版本


5、点击“Browse”按钮选择Tomcat的安装位置,选择合适的JRE版本,点击Finish按钮完成。


通过上面的步骤,上面的错误都全部解决了,如果你的项目还显示 有错误,就需要考虑其它原因了。


可以参考:xxx cannot be resolved to a type 错误解决方法



目录
相关文章
|
6月前
|
Java 数据库连接 Redis
Bean method ‘redisConnectionFactory‘ not loaded because @ConditionalOnClass did not find required c
Bean method ‘redisConnectionFactory‘ not loaded because @ConditionalOnClass did not find required c
42 0
|
9月前
|
Java Android开发
**** cannot be resolved to a type
这种错误很常见,90%的原因都是没有导入jar包,如果导入的jar包都正确,那么很有可能是一下两个原因导致的
55 0
|
6月前
|
Java
【Java异常】Feign常见的坑总结之一:Method Not Allowed“,“message“:“Request method ‘POST‘ not supported“,“path“:“/*
【Java异常】Feign常见的坑总结之一:Method Not Allowed“,“message“:“Request method ‘POST‘ not supported“,“path“:“/*
97 0
|
8月前
|
KVM 虚拟化
成功解决Problem while trying to mount target]\“. HTTP response code is 400
成功解决Problem while trying to mount target]\“. HTTP response code is 400
|
10月前
|
Java 关系型数据库 MySQL
15. 成功解决:java: Can't generate mapping method with primitive return type.
今天启动 SpringBoot 项目时,报了如下错误:`java: Can't generate mapping method with primitive return type.`
462 0
|
10月前
|
Java Spring
【feign】Could not write request: no suitable HttpMessageConverter found for request type
【feign】Could not write request: no suitable HttpMessageConverter found for request type
292 0
|
11月前
The method getServletContext() is undefined for the type HttpServletRequest
The method getServletContext() is undefined for the type HttpServletRequest
|
Java Android开发
The method call() of type XXX must override a superclass
The method call() of type XXX must override a superclass
75 0
|
Java Spring
springmvc:405 request method post not supported
springmvc:405 request method post not supported
131 0
Method search not annotated with HTTP method type (ex. GET, POST)
Method search not annotated with HTTP method type (ex. GET, POST)
765 0