java.nio.BufferOverflowException

简介: Bug ID: 6526175 Votes 0 Synopsis Compiler throws BufferOverflowException should say that it ran out of memory Category j...
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

目录
打赏
0
0
0
0
13
分享
相关文章
Java NIO 开发
本文介绍了Java NIO(New IO)及其主要组件,包括Channel、Buffer和Selector,并对比了NIO与传统IO的优势。文章详细讲解了FileChannel、SocketChannel、ServerSocketChannel、DatagramChannel及Pipe.SinkChannel和Pipe.SourceChannel等Channel实现类,并提供了示例代码。通过这些示例,读者可以了解如何使用不同类型的通道进行数据读写操作。
Java NIO 开发
|
8月前
|
【Java】已解决java.nio.channels.FileLockInterruptionException异常
【Java】已解决java.nio.channels.FileLockInterruptionException异常
60 1
|
8月前
|
【Java】已解决java.nio.channels.OverlappingFileLockException异常
【Java】已解决java.nio.channels.OverlappingFileLockException异常
192 1
|
8月前
|
【Java】已解决java.nio.channels.ClosedChannelException异常
【Java】已解决java.nio.channels.ClosedChannelException异常
656 1
|
8月前
|
Java中的NIO编程详解
Java中的NIO编程详解
Java NIO SelectionKey
Java NIO SelectionKey
了解Java中的NIO编程
了解Java中的NIO编程
Java NIO系列教程三
​ 今天主要给大家介绍的是Buffer的基本使用这个也是NIO里面最总要的概率之一,里面的操作也是有一些复杂的同时也是需要大家必须要重点掌握的知识点,同时也介绍了一下Selector的用法下一篇文章我们将为大家介绍Pipe管道以及FileLock文件锁这也是NIO里面最后的一分部内容了。
113 0
浅谈Java NIO
浅谈Java NIO
52 0
Java NIO系列教程一
今天主要给大家介绍的是NIO的基本的概念以及Channel中常用的FileChannel的基本的用法,算是对Channel有一个简单的介绍。下一篇文章我们将详细的为大家介绍其他的常用Channel。
135 0
Java NIO系列教程一
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等