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

Posted 柳鲲鹏

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了全网首发: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

以上是关于全网首发:java[50077:153519] Cocoa AWT: Not running on AppKit thread 0 when expected. libawt_lwawt.dylib的主要内容,如果未能解决你的问题,请参考以下文章

全网首发:成功解决UOS系统上运行JAVA程序任务栏名称问题

全网首发:JDK绘制文字:二绘制句柄的初始化流程

全网首发:JDK绘制文字:二绘制句柄的初始化流程

全网首发:祝贺编译成功loongarch64 jna-5.10.0及难点说明

全网首发:祝贺编译成功loongarch64 jna-5.10.0及难点说明

全网首发:祝贺编译成功loongarch64 jna-5.10.0及难点说明