java 坑

    技术2022-07-13  126

    目录

    ideaCannot resolve Servlet 'hello'tomcat server 控制台 中文乱码pom 依赖 爆红 eclipsepolling news feeds has encountered a problemthe selection cannot be run on any serverHttpServlet cannot be resolved to a type无法选择Add External JARseclipse New Server Runtime Environment 列表中没有 Apache Tomcatjavax.servlet.ServletException: 实例化Servlet类[MyServlet2]异常Several ports (8080, 8009) required by Tomcat v7.

    idea

    Cannot resolve Servlet ‘hello’

    解决: xml 文件 和 java 文件放一个目录里就行了…

    tomcat server 控制台 中文乱码

    重启 idea,即可 还不行的:

    -Dfile.encoding=UTF-8

    pom 依赖 爆红

    https://blog.csdn.net/goquesting/article/details/78422964

    eclipse

    polling news feeds has encountered a problem

    the selection cannot be run on any server

    对应工程目录下找到: 红框处换成自己的版本,版本在哪找? eclipse ide 中,

    HttpServlet cannot be resolved to a type

    有时 无法选择 Add External JARs,见 下 1 个的问题解决

    其中 所选的文件 应该是 和 eclipse 连接的 tomcat 下的目录文件!

    eclipse 配置 tomcat:https://blog.csdn.net/qq_40893824/article/details/107081414

    无法选择Add External JARs

    要添加的 jar 包,直接粘贴进:

    eclipse New Server Runtime Environment 列表中没有 Apache Tomcat

    选该项 无脑 next 就行了

    javax.servlet.ServletException: 实例化Servlet类[MyServlet2]异常

    第 1 次运行 Dynamic Web project,出现:

    classes: 重启 eclipse

    Several ports (8080, 8009) required by Tomcat v7.

    https://blog.csdn.net/xiaoshunzi111/article/details/50144613 开始菜单->运行->cmd->输入 netstat -ano 查看哪个进程占用了 8080 和 8009 端口 关闭他们: 在上图最后一个红框处输入 对应 PID,再结束进程

    Processed: 0.014, SQL: 9