Problem:
When using Maven to build a Java open-source project, bufferoverflowexceptio is sometimes encountered.N exception (see the exception details below ).
Is it a bug?
There are JDK 1.4.2 and JDK 1.6.0 bug reports on Sun's website. In fact, this issue also exists in JDK 1.5.0 _ 10 and JDK 1.5.0 _ 11.
Http://bugs.sun.com/bugdatabase/View_bug.do? Bug_id = 6526175
Although Sun does not regard this as a bug, it is recommended to increase the heap size, that is, to set environment variables and increase the memory usage parameter value. After testing, this solution cannot effectively eliminate errors.
How did others solve the problem?
I found the same exception in other Apache projects from Google, but none of them can be solved.
Why?
It may be because the character set uses GBK, UTF-8, or UTF-16 to store characters in multiple bytes, memory usage increases, and heap sizes cannot provide the space required by the program, resulting in exceptions. Further analysis is in progress.
Solution:
Set the region in the operating system and language options to English!
The auxiliary method is to add the settings in the system environment variable: maven_opts =-xmx512m
Detailed error message:
Failure executing javac, but cocould not parse the error:
An exception occurs in the compiler (1.5.0 _ 10. If this error is not found in bug parade, go to Java Dev
Elasticconnection (http://java.sun.com/webapps/Bugreport. Please
Add your program and the following diagnostic information to the report. Thank you for your cooperation.
Java. NiO. bufferoverflowexceptioN
At java. NiO. Buffer. nextputindex (buffer. Java: 419)
At java. NiO. heapcharbuffer. Put (heapcharbuffer. Java: 145)
At com. Sun. Tools. javac. parser. Clients. Decode (protocol. Java: 405)
At com. Sun. Tools. javac. parser. Runtime. <init> (runtime. Java: 304)
At com. Sun. Tools. javac. parser. Runtime. <init> (runtime. Java: 238)
At com. Sun. Tools. javac. parser. Timeout $ factory. newtimeout (response. Java: 72
)
At com. Sun. Tools. javac. Main. Javacompiler. parse (javacompiler. Java: 254)
At com. Sun. Tools. javac. Main. Javacompiler. parse (javacompiler. Java: 281)
At com. Sun. Tools. javac. Main. Javacompiler. Compile (javacompiler. Java: 399)
At com. Sun. Tools. javac. Main. Main. Compile (main. Java: 592)
At com. Sun. Tools. javac. Main. Main. Compile (main. Java: 544)
At com. Sun. Tools. javac. Main. Compile (main. Java: 85)
At sun. Reflect. nativemethodaccessoRimpl. invoke0 (native method)
At sun. Reflect. nativemethodaccessoRimpl. Invoke (nativemethodaccessorimpl.
Java: 39)
At sun. Reflect. delegatingmethodaccEssorimpl. Invoke (delegatingmethodacces
Sorimpl. Java: 25)
At java. Lang. Reflect. method. Invoke (method. Java: 585)
At org. codehaus. plexus. Compiler. Javac. javaccompiler. compileindiumRocess (Jav
Accompiler. Java: 400)
At org. codehaus. plexus. Compiler. Javac. javaccompiler. Compile (javaccompile
R. Java: 136)
At org. Apache. Maven. plugin.Abstractcompilermojo.exe cute (abstractcompiler
Mojo. Java: 483)
At org. Apache. Maven. plugin.Compilermojo.exe cute (compilermojo. Java: 111)
At org. Apache. Maven. plugin.Defaultpluginmanager.exe cutemoJo (defaultplugi
Nmanager. Java: 412)
At org. Apache. Maven. Lifecycle. Defaultlifecycleexecutor. Executegoals (DEFA
Ultlifecycleexecutor. Java: 534)
At org. Apache. Maven. Lifecycle. Defaultlifecycleexecutor. Executegoalwithli
Fecycle (defaultlifecycleexecutor. Java: 475)
At org. Apache. Maven. Lifecycle. Defaultlifecycleexecutor. Executegoal (defau
Ltlifecycleexecutor. Java: 454)
At org. Apache. Maven. Lifecycle. Defaultlifecycleexecutor. Executegoalandhan
Dlefailures (defaultlifecycleexecutor. Java: 306)
At org. Apache. Maven. Lifecycle. Defaultlifecycleexecutor. Executetasksegmen
TS (defalilifecycleexecutor. Java: 273)
At org. Apache. Maven. Lifecycle. Defaultlifecycleexecutor. Execute (defaultli
Fecycleexecutor. Java: 140)
At org. Apache. Maven. defaultmaven. Doexecute (defaultmav.java: 322)
At org. Apache. Maven. defaultmaven. Execute (defaultmav.java: 115)
At org. Apache. 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 (delegatingmethodacces
Sorimpl. Java: 25)
At java. Lang. Reflect. method. Invoke (method. Java: 585)
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)
At org. codehaus. classworlds. Launcher. Main (launcher. Java: 375)