【发布时间】:2014-03-02 00:53:37
【问题描述】:
我正在开发一个 java web 应用程序,我正在使用类似 maven 的项目管理工具。现在我的问题是,如果我以这种方式将码头设置为每 20 秒自动扫描一次:
<!-- To launch embded jetty server -->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${maven-jetty-plugin.version}</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppConfig>
<contextPath>/${project.name}</contextPath>
<extraClasspath>target/classes;../services/target/classes;</extraClasspath>
</webAppConfig>
<scanTargets>
<scanTarget>target/classes</scanTarget>
<scanTarget>../services/target/classes</scanTarget>
</scanTargets>
</configuration>
</plugin>
Jetty 以正确的方式启动,事实上我明白了:
[INFO] 已启动 Jetty 服务器
[INFO] 每隔 20 秒启动一次扫描仪。
但在第一次扫描时,我收到以下错误:
ERROR ContextLoader - 上下文初始化失败
java.lang.OutOfMemoryError: PermGen 空间
我该如何解决?
更新 1
我尝试以这种方式从我的 Eclipse Ide 中增加 PermGen 空间:
但在第一次扫描后,我得到了同样的错误。
我该如何解决?
【问题讨论】:
-
这意味着当你的 webapp 重新部署时,你的 webapp 的类加载器没有被卸载。也许你已经定义了 ThreadLocals?
-
我不知道 ThreadLocals 的意思,你能解释一下可能是什么问题并链接解决它
-
如果你不知道什么是 ThreadLocals,你可能没有使用它们。 :) 但是类加载器肯定没有被卸载。