gpt4 book ai didi

java - JRE 检测到 EXCEPTION_ACCESS_VIOLATION 有问题的帧 : C [awt. dll+0x7959b]

转载 作者:太空宇宙 更新时间:2023-11-04 12:17:35 32 4
gpt4 key购买 nike

最近,我在生成带有 Access_violation 异常的日志文件时遇到了崩溃。在日志文件中提到有问题的框架是 awt.dll。这是指什么?为什么会发生这种崩溃?如何解决这个问题呢?。实际上我是java新手所以我不知道这一点。我在同一网站上发现了类似类型的问题,但我还没有遇到任何解决方案。请任何人清楚地解释一下,以便我对此有一个想法。提前致谢。我在下面附上了错误日志文件的一部分。

# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x60bf959b, pid=5188, tid=5736
#
# JRE version: Java(TM) SE Runtime Environment (8.0_45-b15) (build 1.8.0_45-b15)
# Java VM: Java HotSpot(TM) Client VM (25.45-b02 mixed mode windows-x86 )
# Problematic frame:
# C [awt.dll+0x7959b]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.

最佳答案

有问题的框架部分中的 dll 与类路径中的其余库不兼容,这里是 source ,您应该考虑使用一些自定义类加载器来加载该库,而不是 JVM 使用的默认类加载器,这是一个简单的示例:

 /**
*
* @author http://codeslices.net team
*
*/

import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;

/**
*
* Simple custom class loader implementation
*
*/
public class CustomClassLoader extends ClassLoader {

/**
* The HashMap where the classes will be cached
*/
private Map<String, Class<?>> classes = new HashMap<String, Class<?>>();

@Override
public String toString() {
return CustomClassLoader.class.getName();
}

@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {

if (classes.containsKey(name)) {
return classes.get(name);
}

byte[] classData;

try {
classData = loadClassData(name);
} catch (IOException e) {
throw new ClassNotFoundException("Class [" + name
+ "] could not be found", e);
}

Class<?> c = defineClass(name, classData, 0, classData.length);
resolveClass(c);
classes.put(name, c);

return c;
}

/**
* Load the class file into byte array
*
* @param name
* The name of the class e.g. com.codeslices.test.TestClass}
* @return The class file as byte array
* @throws IOException
*/
private byte[] loadClassData(String name) throws IOException {
BufferedInputStream in = new BufferedInputStream(
ClassLoader.getSystemResourceAsStream(name.replace(".", "/")
+ ".class"));
ByteArrayOutputStream out = new ByteArrayOutputStream();
int i;

while ((i = in.read()) != -1) {
out.write(i);
}

in.close();
byte[] classData = out.toByteArray();
out.close();

return classData;
}

/**
* Simple usage of the CustomClassLoader implementation
*
* @param args
* @throws ClassNotFoundException
* @throws IllegalAccessException
* @throws InstantiationException
* @throws SecurityException
* @throws NoSuchMethodException
* @throws InvocationTargetException
* @throws IllegalArgumentException
*/
public static void main(String[] args) throws ClassNotFoundException,
InstantiationException, IllegalAccessException,
NoSuchMethodException, SecurityException, IllegalArgumentException,
InvocationTargetException
{
CustomClassLoader loader = new CustomClassLoader();
// This class should be in your application class path
Class<?> c = loader.findClass("net.codeslices.test.TestClass");
Object o = c.newInstance();
Method m = c.getMethod("toString");
System.out.println(m.invoke(o));
}

}

关于java - JRE 检测到 EXCEPTION_ACCESS_VIOLATION 有问题的帧 : C [awt. dll+0x7959b],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39218845/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com