java.nio.BufferOverflowException

本文探讨了在使用Maven构建Java开源项目时遇到BufferOverflowException异常的问题,分析了其可能的原因,并提供了有效的解决方法,包括修改操作系统区域设置和调整环境变量,以确保内存充足并避免异常发生。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

java.nio.BufferOverflowException

Bug ID: 6526175
Votes 0
Synopsis Compiler throws BufferOverflowException should say that it ran out of memory
Category java:compiler
Reported Against  
Release Fixed
State 5-Cause Known, request for enhancement
Priority: 3-Medium
Related Bugs
Submit Date 16-FEB-2007
Description
FULL PRODUCT VERSION :java version "1.6.0"Java(TM) SE Runtime Environment (build 1.6.0-b105)Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)ADDITIONAL OS VERSION INFORMATION :windows xp service pack 2A DESCRIPTION OF THE PROBLEM :i use maven to compile struts source code , it always throw  the BufferOverflowException.ERROR MESSAGES/STACK TRACES THAT OCCUR :java.nio.BufferOverflowException        at java.nio.Buffer.nextPutIndex(Buffer.java:495)        at java.nio.HeapCharBuffer.put(HeapCharBuffer.java:145)        at com.sun.tools.javac.util.DefaultFileManager.decode(DefaultFileManager.java:726)        at com.sun.tools.javac.util.DefaultFileManager.access$300(DefaultFileManager.java:72)        at com.sun.tools.javac.util.DefaultFileManager$RegularFileObject.getCharContent(DefaultFileManager.java:1243)        at com.sun.tools.javac.util.DefaultFileManager$RegularFileObject.getCharContent(DefaultFileManager.java:1142)        at com.sun.tools.javac.main.JavaCompiler.readSource(JavaCompiler.java:483)        at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:550)        at com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java:801)        at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727)        at com.sun.tools.javac.main.Main.compile(Main.java:353)        at com.sun.tools.javac.main.Main.compile(Main.java:279)        at com.sun.tools.javac.main.Main.compile(Main.java:270)        at com.sun.tools.javac.Main.compile(Main.java:87)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)        at java.lang.reflect.Method.invoke(Method.java:597)        at org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess(JavacCompiler.java:400)        at org.codehaus.plexus.compiler.javac.JavacCompiler.compile(JavacCompiler.java:136)        at org. customer .maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:483)        at org. customer .maven.plugin.CompilerMojo.execute(CompilerMojo.java:111)        at org. customer .maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412)        at org. customer .maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534)        at org. customer .maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:475)        at org. customer .maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:454)        at org. customer .maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306)        at org. customer .maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273)        at org. customer .maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140)        at org. customer .maven.DefaultMaven.doExecute(DefaultMaven.java:322)        at org. customer .maven.DefaultMaven.execute(DefaultMaven.java:115)        at org. customer .maven.cli.MavenCli.main(MavenCli.java:256)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)        at java.lang.reflect.Method.invoke(Method.java:597)        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)REPRODUCIBILITY :This bug can be reproduced always.Posted Date : 2007-02-16 22:55:14.0
Work Around
N/A
Evaluation
This is not a bug in the compiler.  The compiler runs out of memory and theresolution is to increase heap size.However, the compiler should provide better diagnostics for such problems andI have accepted this as a request for enhancement 

 

题:

在使用maven构建Java开源项目,有时候会遇到BufferOverflowException异常(异常详细信息见后面)。

是Bug吗?

在sun的网站上有jdk 1.4.2和jdk 1.6.0 的bug报告,其实这个问题在 jdk 1.5.0_10和jdk 1.5.0_11中也有.

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6526175

虽然sun不认为这是一个bug,解决建议是增加heap size,就是设置环境变量,增加内存的使用参数值;经过测试,这种解决方法不能有效消除错误的产生。

其他人是如何解决的?

从google中找到在其他的apache的项目中出现过同样的异常,但是都没能解决。

问题产生的原因?

可能原因是由于字符集使用GBK、UTF-8或者UTF-16导致使用多字节存放字符,内存使用增加,堆(heap)的尺寸无法提供程序所需的空间,造成异常。更深入的分析还在进行中。

解决方法:

将操作系统的区域和语言选项中的区域设置为 English 即可!

辅助的方法是在系统环境变量中增加设置: MAVEN_OPTS=-Xmx512m

posted on 2010-06-29 09:17 jiahuafu 阅读(...) 评论(...) 编辑 收藏

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

银狐游戏开发资源2

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值