Tomcat错误合集

错误1

  1. 说信息: validateJarFile(D:/xj/workspace/webworktest/webapp/WEB-INF/lib/servlet-api-2.4.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
  • 分析:
    jsp-api.jar和servlet-api.jar这两个包在common\lib已经有了,必须将\WEB-INF\lib\目录下的去掉,否则会冲突的,会引起jboss启动正常,而页面却总是无内容显示的错误
  • 解决方案:

    将\WEB-INF\lib\目录下的jsp-api.jar和servlet-api.jar删除
    保证WEB-INF\lib跟tomcat5的common/lib下的JAR包没有重复的

错误2

1.警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:aa’ did not find a matching property

  • 分析:
    这是因为我们在eclipse下,通过tomcat部署web工程时,tomcat的配置文件server.xml中会自动生成一个关于该web工程的配置信息,类似于下面的东西:

  • Xml代码:
    路径:D:\pahf\Servers\Tomcat v7.0 Server at pahfpt-config\server.xml

1
<Context docBase="pahfpt" path="/pahfpt" reloadable="true" source="org.eclipse.jst.jee.server:pahfpt"/>

而默认情况下,server.xml的 Context元素不支持名称为source的属性,所以会发出警告。

  • 解决方案:
    关闭tomcat,双击eclipse下tomcat服务器,在出来的Tomcat server at localhost页面中找到server options选项,选中其中的选项”Publish modual contexts to separat XML files“,ctr+s,启动tomcat。

错误3

  1. Server Tomcat v7.0 Server at pahfpt was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.
  • 错误提示就是我们限定了部署的时间导致的错误。
    *解决办法:

    修改 workspace.metadata.plugins\org.eclipse.wst.server.core\servers.xml文件。
    把其中的start-timeout=”45” 改为 start-timeout=”100” 或者更长,根据不同同学的工程大小来设置。
    最后重启eclipse就可以了。

错误4

  1. The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path

    The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path

错误5

  1. 在IDE里面运行tomcat的时候,有的时候表面上看运行了,但是输入http://localhost:8080却报404错误,就说明没有没有应用没有发布成功,如freemarkerLearning这个项目,看是否发布成功可以在Everything中搜索,看看 D:\apache-tomcat-7.0.14\webapps\下有没有这个freemarkerLearning应用。

错误6

1
2
3
4
5
6
Exception in thread ""http-bio-8080"-exec-1" java.lang.OutOfMemoryError: PermGen space
Exception in thread "Druid-ConnectionPool-Destory" java.lang.OutOfMemoryError: PermGen space
at java.util.IdentityHashMap.keySet(IdentityHashMap.java:935)
at com.alibaba.druid.pool.DruidDataSource.removeAbandoned(DruidDataSource.java:1312)
at com.alibaba.druid.pool.DruidDataSource$DestroyConnectionThread.run(DruidDataSource.java:1294)
Exception in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" java.lang.OutOfMemoryError: PermGen space

*解决办法:

1
2
3
4
5
6
7
8
9
10
11
12
13
--launcher.XXMaxPermSize
512M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
512m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms128m
-Xmx1024m

Tomcat内存溢出

热评文章