全网首发:java[50077:153519] Cocoa AWT: Not running on AppKit thread 0 when expected. libawt_lwawt.dylib

简介: 全网首发:java[50077:153519] Cocoa AWT: Not running on AppKit thread 0 when expected. libawt_lwawt.dylib

具体错误:

2022-03-01 14:15:33.398 java[50077:153519] Cocoa AWT: Not running on AppKit thread 0 when expected. (
  0   libawt_lwawt.dylib                  0x0000000124df9b91 -[AWTWindow windowDidResignKey:] + 42
  1   CoreFoundation                      0x00007fff2927e1ac __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
  2   CoreFoundation                      0x00007fff2927e09a _CFXRegistrationPost + 442
  3   CoreFoundation                      0x00007fff2927dde2 ___CFXNotificationPost_block_invoke + 50
  4   CoreFoundation                      0x00007fff2923c972 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1826
  5   CoreFoundation                      0x00007fff2923ba0c _CFXNotificationPost + 652
  6   Foundation                          0x00007fff2b314477 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
  7   AppKit                              0x00007fff26a56c89 -[NSWindow resignKeyWindow] + 867
  8   AppKit                              0x00007fff2699d888 -[NSWindow _changeKeyAndMainLimitedOK:] + 847
  9   AppKit                              0x00007fff26a4ae9a -[NSWindow _makeKeyRegardlessOfVisibility] + 108
  10  AppKit                              0x00007fff269a08f4 NSPerformVisuallyAtomicChange + 146
  11  AppKit                              0x00007fff26a4add1 -[NSWindow makeKeyAndOrderFront:] + 90
  12  libSDL2-2.0.0.dylib                 0x000000019f9121b9 Cocoa_ShowWindow + 89
  13  libSDL2-2.0.0.dylib                 0x000000019f8e43ba SDL_ShowWindow_REAL + 90
  14  libtsplayercore.dylib               0x00000001a040a18a initPlayerCore + 1018
  15  libtsplayercore.dylib               0x00000001a0412da2 PlayerCore_CreateWithSize + 290
  16  libtsplayercore.dylib               0x00000001a041398c Java_com_ts_apps_system_TPlayerCore_createWithSize + 156
  17  ???                                 0x00000001142c2087 0x0 + 4633403527
  18  ???                                 0x00000001142b3a40 0x0 + 4633344576
  19  ???                                 0x00000001142ac4e7 0x0 + 4633314535
  20  libjvm.dylib                        0x000000010e6d66a3 _ZN9JavaCalls11call_helperEP9JavaValueP12methodHandleP17JavaCallArgumentsP6Thread + 1501
  21  libjvm.dylib                        0x000000010e70fa10 _ZL17jni_invoke_staticP7JNIEnv_P9JavaValueP8_jobject11JNICallTypeP10_jmethodIDP18JNI_ArgumentPusherP6Thread + 564
  22  libjvm.dylib                        0x000000010e712471 jni_CallStaticVoidMethod + 397
  23  java                                0x000000010dadfcde JavaMain + 2514
  24  libsystem_pthread.dylib             0x00007fff50af26c1 _pthread_body + 340
  25  libsystem_pthread.dylib             0x00007fff50af256d _pthread_body + 0
  26  libsystem_pthread.dylib             0x00007fff50af1c5d thread_start + 13
)
2022-03-01 14:15:33.398 java[50077:153519]  Please file a bug report at http://java.net/jira/browse/MACOSX_PORT with this message and a reproducible test case.
2022-03-01 14:15:33.400 java[50077:153519] Cocoa AWT: Not running on AppKit thread 0 when expected. (
  0   libawt_lwawt.dylib                  0x0000000124df8d7b -[AWTWindow orderChildWindows:] + 52
  1   CoreFoundation                      0x00007fff2927e1ac __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
  2   CoreFoundation                      0x00007fff2927e09a _CFXRegistrationPost + 442
  3   CoreFoundation                      0x00007fff2927dde2 ___CFXNotificationPost_block_invoke + 50
  4   CoreFoundation                      0x00007fff2923c972 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1826
  5   CoreFoundation                      0x00007fff2923ba0c _CFXNotificationPost + 652
  6   Foundation                          0x00007fff2b314477 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
  7   AppKit                              0x00007fff26a56c89 -[NSWindow resignKeyWindow] + 867
  8   AppKit                              0x00007fff2699d888 -[NSWindow _changeKeyAndMainLimitedOK:] + 847
  9   AppKit                              0x00007fff26a4ae9a -[NSWindow _makeKeyRegardlessOfVisibility] + 108
  10  AppKit                              0x00007fff269a08f4 NSPerformVisuallyAtomicChange + 146
  11  AppKit                              0x00007fff26a4add1 -[NSWindow makeKeyAndOrderFront:] + 90
  12  libSDL2-2.0.0.dylib                 0x000000019f9121b9 Cocoa_ShowWindow + 89
  13  libSDL2-2.0.0.dylib                 0x000000019f8e43ba SDL_ShowWindow_REAL + 90
  14  libtsplayercore.dylib               0x00000001a040a18a initPlayerCore + 1018
  15  libtsplayercore.dylib               0x00000001a0412da2 PlayerCore_CreateWithSize + 290
  16  libtsplayercore.dylib               0x00000001a041398c Java_com_ts_apps_system_TPlayerCore_createWithSize + 156
  17  ???                                 0x00000001142c2087 0x0 + 4633403527
  18  ???                                 0x00000001142b3a40 0x0 + 4633344576
  19  ???                                 0x00000001142ac4e7 0x0 + 4633314535
  20  libjvm.dylib                        0x000000010e6d66a3 _ZN9JavaCalls11call_helperEP9JavaValueP12methodHandleP17JavaCallArgumentsP6Thread + 1501
  21  libjvm.dylib                        0x000000010e70fa10 _ZL17jni_invoke_staticP7JNIEnv_P9JavaValueP8_jobject11JNICallTypeP10_jmethodIDP18JNI_ArgumentPusherP6Thread + 564
  22  libjvm.dylib                        0x000000010e712471 jni_CallStaticVoidMethod + 397
  23  java                                0x000000010dadfcde JavaMain + 2514
  24  libsystem_pthread.dylib             0x00007fff50af26c1 _pthread_body + 340
  25  libsystem_pthread.dylib             0x00007fff50af256d _pthread_body + 0
  26  libsystem_pthread.dylib             0x00007fff50af1c5d thread_start + 13
)
2022-03-01 14:15:33.400 java[50077:153519]  Please file a bug report at http://java.net/jira/browse/MACOSX_PORT with this message and a reproducible test case.
2022-03-01 14:15:33.402 java[50077:153519] Cocoa AWT: Not running on AppKit thread 0 when expected. (
  0   libosxapp.dylib                     0x0000000124ed0150 +[ThreadUtilities getJNIEnv] + 37
  1   libawt_lwawt.dylib                  0x0000000124df8b70 -[AWTWindow isBlocked] + 37
  2   libawt_lwawt.dylib                  0x0000000124df8dcc -[AWTWindow orderChildWindows:] + 133
  3   CoreFoundation                      0x00007fff2927e1ac __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
  4   CoreFoundation                      0x00007fff2927e09a _CFXRegistrationPost + 442
  5   CoreFoundation                      0x00007fff2927dde2 ___CFXNotificationPost_block_invoke + 50
  6   CoreFoundation                      0x00007fff2923c972 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1826
  7   CoreFoundation                      0x00007fff2923ba0c _CFXNotificationPost + 652
  8   Foundation                          0x00007fff2b314477 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
  9   AppKit                              0x00007fff26a56c89 -[NSWindow resignKeyWindow] + 867
  10  AppKit                              0x00007fff2699d888 -[NSWindow _changeKeyAndMainLimitedOK:] + 847
  11  AppKit                              0x00007fff26a4ae9a -[NSWindow _makeKeyRegardlessOfVisibility] + 108
  12  AppKit                              0x00007fff269a08f4 NSPerformVisuallyAtomicChange + 146
  13  AppKit                              0x00007fff26a4add1 -[NSWindow makeKeyAndOrderFront:] + 90
  14  libSDL2-2.0.0.dylib                 0x000000019f9121b9 Cocoa_ShowWindow + 89
  15  libSDL2-2.0.0.dylib                 0x000000019f8e43ba SDL_ShowWindow_REAL + 90
  16  libtsplayercore.dylib               0x00000001a040a18a initPlayerCore + 1018
  17  libtsplayercore.dylib               0x00000001a0412da2 PlayerCore_CreateWithSize + 290
  18  libtsplayercore.dylib               0x00000001a041398c Java_com_ts_apps_system_TPlayerCore_createWithSize + 156
  19  ???                                 0x00000001142c2087 0x0 + 4633403527
  20  ???                                 0x00000001142b3a40 0x0 + 4633344576
  21  ???                                 0x00000001142ac4e7 0x0 + 4633314535
  22  libjvm.dylib                        0x000000010e6d66a3 _ZN9JavaCalls11call_helperEP9JavaValueP12methodHandleP17JavaCallArgumentsP6Thread + 1501
  23  libjvm.dylib                        0x000000010e70fa10 _ZL17jni_invoke_staticP7JNIEnv_P9JavaValueP8_jobject11JNICallTypeP10_jmethodIDP18JNI_ArgumentPusherP6Thread + 564
  24  libjvm.dylib                        0x000000010e712471 jni_CallStaticVoidMethod + 397
  25  java                                0x000000010dadfcde JavaMain + 2514
  26  libsystem_pthread.dylib             0x00007fff50af26c1 _pthread_body + 340
  27  libsystem_pthread.dylib             0x00007fff50af256d _pthread_body + 0
  28  libsystem_pthread.dylib             0x00007fff50af1c5d thread_start + 13
)
2022-03-01 14:15:33.402 java[50077:153519]  Please file a bug report at http://java.net/jira/browse/MACOSX_PORT with this message and a reproducible test case.
2022-03-01 14:15:33.405 java[50077:153519] Apple AWT Internal Exception: java.lang.StackOverflowError
  at com.ts.apps.system.TPlayerCore.createWithSize(Native Method)
  at com.ts.apps.system.TPlayerCoreFrame.main(TPlayerCoreFrame.java:614)
2022-03-01 14:15:33.405 java[50077:153519] *** Terminating app due to uncaught exception 'JavaNativeException', reason: 'Internal JNF Error: could not find Throwable class'
*** First throw call stack:
(
  0   CoreFoundation                      0x00007fff292ed32b __exceptionPreprocess + 171
  1   libobjc.A.dylib                     0x00007fff4fc7b942 objc_exception_throw + 48
  2   CoreFoundation                      0x00007fff292ed279 -[NSException raise] + 9
  3   JavaNativeFoundation                0x00007fff2cdda8a0 JNFCallBooleanMethod + 218
  4   libawt_lwawt.dylib                  0x0000000124df8bac -[AWTWindow isBlocked] + 97
  5   libawt_lwawt.dylib                  0x0000000124df8dcc -[AWTWindow orderChildWindows:] + 133
  6   CoreFoundation                      0x00007fff2927e1ac __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
  7   CoreFoundation                      0x00007fff2927e09a _CFXRegistrationPost + 442
  8   CoreFoundation                      0x00007fff2927dde2 ___CFXNotificationPost_block_invoke + 50
  9   CoreFoundation                      0x00007fff2923c972 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1826
  10  CoreFoundation                      0x00007fff2923ba0c _CFXNotificationPost + 652
  11  Foundation                          0x00007fff2b314477 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
  12  AppKit                              0x00007fff26a56c89 -[NSWindow resignKeyWindow] + 867
  13  AppKit                              0x00007fff2699d888 -[NSWindow _changeKeyAndMainLimitedOK:] + 847
  14  AppKit                              0x00007fff26a4ae9a -[NSWindow _makeKeyRegardlessOfVisibility] + 108
  15  AppKit                              0x00007fff269a08f4 NSPerformVisuallyAtomicChange + 146
  16  AppKit                              0x00007fff26a4add1 -[NSWindow makeKeyAndOrderFront:] + 90
  17  libSDL2-2.0.0.dylib                 0x000000019f9121b9 Cocoa_ShowWindow + 89
  18  libSDL2-2.0.0.dylib                 0x000000019f8e43ba SDL_ShowWindow_REAL + 90
  19  libtsplayercore.dylib               0x00000001a040a18a initPlayerCore + 1018
  20  libtsplayercore.dylib               0x00000001a0412da2 PlayerCore_CreateWithSize + 290
  21  libtsplayercore.dylib               0x00000001a041398c Java_com_ts_apps_system_TPlayerCore_createWithSize + 156
  22  ???                                 0x00000001142c2087 0x0 + 4633403527
  23  ???                                 0x00000001142b3a40 0x0 + 4633344576
  24  ???                                 0x00000001142ac4e7 0x0 + 4633314535
  25  libjvm.dylib                        0x000000010e6d66a3 _ZN9JavaCalls11call_helperEP9JavaValueP12methodHandleP17JavaCallArgumentsP6Thread + 1501
  26  libjvm.dylib                        0x000000010e70fa10 _ZL17jni_invoke_staticP7JNIEnv_P9JavaValueP8_jobject11JNICallTypeP10_jmethodIDP18JNI_ArgumentPusherP6Thread + 564
  27  libjvm.dylib                        0x000000010e712471 jni_CallStaticVoidMethod + 397
  28  java                                0x000000010dadfcde JavaMain + 2514
  29  libsystem_pthread.dylib             0x00007fff50af26c1 _pthread_body + 340
  30  libsystem_pthread.dylib             0x00007fff50af256d _pthread_body + 0
  31  libsystem_pthread.dylib             0x00007fff50af1c5d thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type JNFException

 在网上搜索了一番,都是关于JDK的BUG,而且已经解决。这个错误来源,其实也简单,就是没有在主线程中进行UI操作(此处是产生窗口)。吾想让发个消息到主线程,让他调用一个函数,一直没有找到资料。最后使用如下办法解决:


java -XstartOnFirstThread

目录
相关文章
|
5月前
|
Java 开发者
Java面试题:请解释内存泄漏的原因,并说明如何使用Thread类和ExecutorService实现多线程编程,请解释CountDownLatch和CyclicBarrier在并发编程中的用途和区别
Java面试题:请解释内存泄漏的原因,并说明如何使用Thread类和ExecutorService实现多线程编程,请解释CountDownLatch和CyclicBarrier在并发编程中的用途和区别
60 0
|
4月前
|
Java 开发者
奇迹时刻!探索 Java 多线程的奇幻之旅:Thread 类和 Runnable 接口的惊人对决
【8月更文挑战第13天】Java的多线程特性能显著提升程序性能与响应性。本文通过示例代码详细解析了两种核心实现方式:Thread类与Runnable接口。Thread类适用于简单场景,直接定义线程行为;Runnable接口则更适合复杂的项目结构,尤其在需要继承其他类时,能保持代码的清晰与模块化。理解两者差异有助于开发者在实际应用中做出合理选择,构建高效稳定的多线程程序。
62 7
|
1月前
|
Java 网络安全 Maven
Exception in thread "main" java.lang.NoSuchMethodError: okhttp3.OkHttpClient$Builder.sslSocketFactory(Ljavax/net/ssl/SSLSocketFactory;Ljavax/net/ssl/X509TrustManager;)Lokhttp3/OkHttpClient$Builder; 问题处理
【10月更文挑战第26天】Exception in thread "main" java.lang.NoSuchMethodError: okhttp3.OkHttpClient$Builder.sslSocketFactory(Ljavax/net/ssl/SSLSocketFactory;Ljavax/net/ssl/X509TrustManager;)Lokhttp3/OkHttpClient$Builder; 问题处理
42 2
|
2月前
|
Java 开发者
在Java多线程编程中,创建线程的方法有两种:继承Thread类和实现Runnable接口
【10月更文挑战第20天】在Java多线程编程中,创建线程的方法有两种:继承Thread类和实现Runnable接口。本文揭示了这两种方式的微妙差异和潜在陷阱,帮助你更好地理解和选择适合项目需求的线程创建方式。
26 3
|
2月前
|
Java
在Java多线程编程中,实现Runnable接口通常优于继承Thread类
【10月更文挑战第20天】在Java多线程编程中,实现Runnable接口通常优于继承Thread类。原因包括:1) Java只支持单继承,实现接口不受此限制;2) Runnable接口便于代码复用和线程池管理;3) 分离任务与线程,提高灵活性。因此,实现Runnable接口是更佳选择。
46 2
|
2月前
|
Java
Java中多线程编程的基本概念和创建线程的两种主要方式:继承Thread类和实现Runnable接口
【10月更文挑战第20天】《JAVA多线程深度解析:线程的创建之路》介绍了Java中多线程编程的基本概念和创建线程的两种主要方式:继承Thread类和实现Runnable接口。文章详细讲解了每种方式的实现方法、优缺点及适用场景,帮助读者更好地理解和掌握多线程编程技术,为复杂任务的高效处理奠定基础。
35 2
|
2月前
|
Java 开发者
Java多线程初学者指南:介绍通过继承Thread类与实现Runnable接口两种方式创建线程的方法及其优缺点
【10月更文挑战第20天】Java多线程初学者指南:介绍通过继承Thread类与实现Runnable接口两种方式创建线程的方法及其优缺点,重点解析为何实现Runnable接口更具灵活性、资源共享及易于管理的优势。
41 1
|
3月前
|
存储 Java 程序员
优化Java多线程应用:是创建Thread对象直接调用start()方法?还是用个变量调用?
这篇文章探讨了Java中两种创建和启动线程的方法,并分析了它们的区别。作者建议直接调用 `Thread` 对象的 `start()` 方法,而非保持强引用,以避免内存泄漏、简化线程生命周期管理,并减少不必要的线程控制。文章详细解释了这种方法在使用 `ThreadLocal` 时的优势,并提供了代码示例。作者洛小豆,文章来源于稀土掘金。
|
4月前
|
Java
在 Java 中 Runnable 与 Thread 的适时运用
【8月更文挑战第22天】
31 0
|
4月前
|
Java
Exception in thread "main" java.lang.UnsatisfiedLinkError: xxx()V
Exception in thread "main" java.lang.UnsatisfiedLinkError: xxx()V
25 0