处理 ant bpelc 任务中的 PermGen 错误

发布于 2024-07-11 06:30:13 字数 1269 浏览 7 评论 0原文

在使用 jdk 1.5.0_11 的 Linux 下使用 ant 编译项目时,我遇到了 java.lang.OutOfMemoryError: PermGen 错误。 同样的项目在windows下编译没有问题。

通常这与分配给 JVM 的 MaxPermSize 有关。 Irakli Nadareishvili 拥有PermGen 错误的最佳解释之一Java HotSpot VMOptions 设置指南(例如 -XX:MaxPermSize =128M)

在这种情况下,我很快将问题缩小到特定的 bpelc ant现在

<bpelc input="${build.dir}/bpel/bpel.xml" 
out="${build.dir}/output" rev="${version}" home="${bpel.home}"/>

我不认为 bpelc 会像 javac 那样采用编译器参数元素:

  <javac srcdir="${src.dir}"
         destdir="${classes.dir}"
         classpathref="libraries">
    <compilerarg value="-XX:MaxPermSize=128M"/>
  </javac> 

那么如何修复 bpelc 任务的错误呢? 到目前为止,我想出的最佳解决方案是设置 ANT_OPTS环境变量。 迄今为止,这似乎已经避免了这个问题。

export ANT_OPTS=-XX:MaxPermSize=128m

谁能透露更多信息? 这是一个万无一失的解决方案吗?

I've been hitting a java.lang.OutOfMemoryError: PermGen error when compiling a project with ant under Linux with jdk 1.5.0_11. the same project compiles under windows without problem.

Usually this relates to the MaxPermSize allocated to the JVM. Irakli Nadareishvili has one of the best explanations of PermGen errors and guide to setting Java HotSpot VMOptions (e.g. -XX:MaxPermSize=128M)

In this case, I quickly narrowed the issue down to a particular bpelc ant task

<bpelc input="${build.dir}/bpel/bpel.xml" 
out="${build.dir}/output" rev="${version}" home="${bpel.home}"/>

Now I don't think bpelc takes the compilerarg element like javac:

  <javac srcdir="${src.dir}"
         destdir="${classes.dir}"
         classpathref="libraries">
    <compilerarg value="-XX:MaxPermSize=128M"/>
  </javac> 

So how to fix the error for the bpelc task? The best solution I've come up with so far is to set the ANT_OPTS environment variable. This seems to have avoided the problem to date.

export ANT_OPTS=-XX:MaxPermSize=128m

Can anyone shed more light? Is that a sure-fire fix?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笑红尘 2024-07-18 06:30:13

当 bpelc 任务在运行 ant 的原始 JVM 中执行时,设置 ANT_OPTS(或类似的东西)是唯一可能的解决方案。

一个类似的事情可能是将该任务重构为第二个 ant 构建文件并使用单独的 JVM 运行它。 并不是更好,但根据您的环境,它可能更容易实现。

When the bpelc task executes inside the original JVM running ant, then setting ANT_OPTS (or something equivalent) is the only possible solution.

One such equivalent thing might be to refactor that task to a second ant build file and run that using a separate JVM. Not really nicer, but depending on your environment it might be easier to implement.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文