Tag Archives: jvm

[Solved] Memory analysis tool Start Error: An internal error occurred during: “Parsing heap dump from

1. Error when opening the file

II. Reason
if the size of dump file is larger than your configured 1024m, the above error will be reported

III. Solution
1. Open MemoryAnalyzer.ini file in the directory of MAT.

2. The default is 1024, which can be modified to open the file

3. After modification, restart the mat tool and reopen it.

[Solved] Project Error: Could not found sun.misc.BASE64Encoder

1. Questions

The project reported an error: could not found sun.misc.BASE64Encoder

2. Reason

Classes such as sun.misc.BASE64Encoder are not part of the JDK standard library, but the class is included in the JDK and can be used directly.

3. Solution

Replace sun.misc.BASE64Encoder with java.util.Base64

Example:

//import sun.misc.BASE64Encoder;
import java.util.Base64;//how to solve could not found sun.misc.BASE64Encoder error
...
// return new BASE64Encoder().encodeBuffer(bytes).trim().replaceAll("\r|\n", "");
return Base64.getEncoder().encodeToString(bytes);

[Solved] Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type…

Error reporting solution

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'javax.sql.DataSource' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

Mybats plus dependency import error

should import

[JVM] stack overflow error stackoverflowerror [How to Solve]

Stackoverflowerror is an error, not an exception.

Method is placed in the stack space. By default, it is only 512k-1024k. By making recursive calls, you can fill up the stack space.

public class StackOverFlowErrorDemo {
    public static void main(String[] args) {
        // Exception in thread "main" java.lang.StackOverflowError
        stackOverflowError();
    }

    private static void stackOverflowError() {
        stackOverflowError();
    }
}

Tomcat memory overflow in Eclipse: Java. Lang. outofmemoryerror: permgen space solution:

1. Configure the size of this part of heap memory through the JVM parameter – XX: maxpermsize = 256M.  

2. How to configure the memory size of Tomcat in eclipse?

First, you need to double-click Tomcat server, as shown in the figure below:

Double click the figure above to display the Tomcat configuration interface

Then, click the link in the red rectangular box in the figure above, and the node of Tomcat parameter configuration will pop up. To select the arguments parameter box:

As shown in the figure above, you can set the value of – XX: maxpermsize = 256M in the VM arguments text box. Of course, you can add other JVM parameters, such as maximum memory, minimum memory, etc.

os::commit_memory(0x0000000538000000, 11408506880, 0) failed; error=‘Cannot allocate memory‘

 

# An error report file with more information is saved as:
# /cbb/mhpt/hs_err_pid10525.log
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=64m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000538000000, 11408506880, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 11408506880 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /cbb/mhpt/hs_err_pid10554.log

 

The solution of a Java exception has occurred. And error exception in thread when eclipse runs

This problem is caused by a Java class file compiled by a higher version of JDK trying to run on a lower version of JVM.

1. The solution is to ensure that the versions of JVM (Java command) and JDK (javac command) are consistent. If it is the Linux version, enter the Java – version and javac – version commands in the command line to see if the versions are consistent. I use 1.7.0_ 80。

 

2. The same version still can’t solve the problem. I don’t compile with javac directly from the command line, but with eclipse compiler. Because many compilers come with javac, rather than using the compiler in the operating system. If your compiler is eclipse, you need to set the JDK version in the properties of the project. The method is to right-click the project — & gt; properties — & gt; Java compiler — & gt; enable project specific settings — & gt; and set the compiler compliance level to 1.7, which is the version consistent with the JVM (the version shown by Java – version in the command line). Because of the need to be compatible with other software before, I reduced the Java version from 1.8 to 1.7, but eclipse did not move, so after opening it, I found that the default was 1.8, so I manually reduced it to 1.7, recompiled it, and finally passed!

 

To sum up, if you are compiling with a compiler, make sure that the JDK version of the compiler is consistent with the Java version of the operating system.

The screenshot is as follows:

Error attaching to process

Use Jinfo command to check the error of remotemaven server (a process of idea)

Error attaching to process: sun.jvm.hotspot.runtime.VMVersionMismatchException: Supported versions are 25.101-b13. Target VM is 25.152-b28
sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.runtime.VMVersionMismatchException: Supported versions are 25.101-b13. Target VM is 25.152-b28
        at sun.jvm.hotspot.HotSpotAgent.setupVM(HotSpotAgent.java:435)
        at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:305)
        at sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:140)
        at sun.jvm.hotspot.tools.Tool.start(Tool.java:185)
        at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
        at sun.jvm.hotspot.tools.JInfo.main(JInfo.java:138)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at sun.tools.jinfo.JInfo.runTool(JInfo.java:108)
        at sun.tools.jinfo.JInfo.main(JInfo.java:76)
Caused by: sun.jvm.hotspot.runtime.VMVersionMismatchException: Supported versions are 25.101-b13. Target VM is 25.152-b28
        at sun.jvm.hotspot.runtime.VM.checkVMVersion(VM.java:227)
        at sun.jvm.hotspot.runtime.VM.<init>(VM.java:294)
        at sun.jvm.hotspot.runtime.VM.initialize(VM.java:370)
        at sun.jvm.hotspot.HotSpotAgent.setupVM(HotSpotAgent.java:431)
        ... 11 more

Solution:
the reason is that the JDK version does not match. Just change the JDK version of Maven in idea. The method is as follows

change the version here.

JVM start error: could not reserve enough space for object heap error

JVM startup error: Could not Reserve enough space for Object Heap error
First, understand what the parameters mean:
The

parameter

meaning

— Xms2G Xmx2G

represents the minimum and maximum JVM heap available memory

– XX: PermSize -xx :MaxPermSize represents the JVM’s metadata memory size

Solve problems:

    eclipse startup error is: Could not reserve enough space for object heap error
    current configuration is:
    -xms512m-xmx1024m-xx :PermSize 512M : many SO answers are recommended to use JAVA_OPTION variable, but one answer is that the 32-bit process of Windows 7 cannot get more than 1200M of memory. This answer is a little reliable, SO I tried it. Download and install the 64BIT JDK and boot it up without error.

Appendix:
When

    was converted to a 64-bit JDK, jrebel was found to fail. After a long search, one of the answers given on the official forums is to back up Jrebel32.dll, and then change the 64-bit Jrebel32.DLL to Jrebel32.dll. JVM out of memroy error report summary:
    Java heap space: Increases -XMXpermgen space: Increases -xx :PermSizeRequested Array size: Error means that the size of the array created exceeds the maximum heap size, so the apparent solution is to either increase the size of -XMX or reduce the size of the array to be created.

Differences between Java stack overflow ror and outofmemoryerror

1, StackOverflow: Whenever a Java program starts a new thread, the Java virtual machine allocates a stack for it, and the Java stack keeps the thread running in frames. When a thread calls a method, the JVM presses a new stack frame onto the thread’s stack, and the stack frame exists as long as the method has not returned.
if the method has too many layers of nested calls (such as recursive calls), as the number of frames in the Java stack increases, the total size of all stack frames in the stack of this thread will eventually be greater than the value set by -xss, resulting in a StackOverflowError overflow exception. When the Java program starts a new thread, there is not enough space to allocate the Java stack for the thread. The size of a thread’s Java stack is determined by the -XSS setting. The JVM throws an OutOfMemoryError exception. The Java heap is used to store instances of objects. When it is necessary to allocate memory for instances of objects, and the heap occupation has reached the maximum set value (via -Xmx), OutOfMemoryError will be thrown. The method area is used to store information about Java classes, such as class names, access modifiers, constant pools, field descriptions, method descriptions, and so on. As the class loader loads the class file into memory, the JVM extracts the class information and places it in the method area.
when the class information needs to be stored and the method area has reached its maximum memory footprint (via -xx :MaxPermSize); An OutOfMemoryError exception will be thrown for tests in this case, the basic idea being that the runtime generates a large number of classes to fill the method area until it overflows. You need to manipulate the bytecode runtime directly with the help of CGLib to generate a large number of dynamic classes.