Failed with exception java.io.IOException:java.lang.RuntimeException: Error in configuring object

Hive查询报错:lzo压缩编码问题解决方案
博客讲述了在使用Hive进行数据查询时遇到的IOException,原因是lzo压缩编码未找到。通过查看hive.log日志,定位到错误是由于lzoCodec不在类路径中导致。解决方案是删除Hadoop配置文件中关于lzo的配置,同步到集群并重启,成功解决了问题。

原本之前的虚拟机还是好好的,Hive能够正常使用.这两天HIVE在执行select查询语句的时候,突然遇到了这个报错.Failed with exception java.io.IOException:java.lang.RuntimeException: Error in configuring object
从字面上翻译是配置文件错误,但是也没有说明到底是哪个配置文件错误.想改也无从下手.于是乎,到/opt/module/hive/conf/logs/hive.log下去查找报错的原因:

java.io.IOException: java.lang.RuntimeException: Error in configuring object
	at org.apache.hadoop.hive.ql.exec.FetchOperator.getNextRow(FetchOperator.java:602)
	at org.apache.hadoop.hive.ql.exec.FetchOperator.pushRow(FetchOperator.java:509)
	at org.apache.hadoop.hive.ql.exec.FetchTask.fetch(FetchTask.java:146)
	at org.apache.hadoop.hive.ql.Driver.getResults(Driver.java:2691)
	at org.apache.hadoop.hive.ql.reexec.ReExecDriver.getResults(ReExecDriver.java:229)
	at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:259)
	at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:188)
	at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:402)
	at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:821)
	at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:759)
	at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:683)
	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 org.apache.hadoop.util.RunJar.run(RunJar.java:318)
	at org.apache.hadoop.util.RunJar.main(RunJar.java:232)
Caused by: java.lang.RuntimeException: Error in configuring object
	at org.apache.hive.common.util.ReflectionUtil.setJobConf(ReflectionUtil.java:115)
	at org.apache.hive.common.util.ReflectionUtil.setConf(ReflectionUtil.java:103)
	at org.apache.hive.common.util.ReflectionUtil.newInstance(ReflectionUtil.java:87)
	at org.apache.hadoop.hive.ql.exec.FetchOperator.getInputFormatFromCache(FetchOperator.java:221)
	at org.apache.hadoop.hive.ql.exec.FetchOperator.getNextSplits(FetchOperator.java:381)
	at org.apache.hadoop.hive.ql.exec.FetchOperator.getRecordReader(FetchOperator.java:314)
	at org.apache.hadoop.hive.ql.exec.FetchOperator.getNextRow(FetchOperator.java:540)
	... 16 more
Caused by: java.lang.reflect.InvocationTargetException
	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 org.apache.hive.common.util.ReflectionUtil.setJobConf(ReflectionUtil.java:112)
	... 22 more
Caused by: java.lang.IllegalArgumentException: Compression codec com.hadoop.compression.lzo.lzoCodec not found.
	at org.apache.hadoop.io.compress.CompressionCodecFactory.getCodecClasses(CompressionCodecFactory.java:139)
	at org.apache.hadoop.io.compress.CompressionCodecFactory.<init>(CompressionCodecFactory.java:180)
	at org.apache.hadoop.mapred.TextInputFormat.configure(TextInputFormat.java:45)
	... 27 more
Caused by: java.lang.ClassNotFoundException: Class com.hadoop.compression.lzo.lzoCodec not found
	at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:2542)
	at org.apache.hadoop.io.compress.CompressionCodecFactory.getCodecClasses(CompressionCodecFactory.java:132)
	... 29 more

找到最后,发现是由lzo引起的报错.

Compression codec com.hadoop.compression.lzo.lzoCodec not found.

到hadoop的配置文件目录线下,去把core-site.xml有关于lzo 的配置都删除了,再分发同步到其他的hadoop主机目录下,重启hadoop集群,执行hive查询语句.
在这里插入图片描述
bug解决成功!

2025-09-03 20:41:06.091 718-744 AppHibernationService system_server E Package com.example.myapplication is not installed for user 0 2025-09-03 20:41:06.091 718-744 AppHibernationService system_server E Package com.example.myapplication is not installed for any user 2025-09-03 20:41:06.091 718-744 AppHibernationService system_server E Package com.example.myapplication is not installed for user 0 2025-09-03 20:41:06.091 718-744 AppHibernationService system_server E Package com.example.myapplication is not installed for any user 2025-09-03 20:48:07.905 718-858 InputDispatcher system_server E channel 'e438984 com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-03 20:48:23.392 718-858 InputDispatcher system_server E channel '3a68b4d com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-03 20:49:55.365 718-858 InputDispatcher system_server E channel '5f148eb com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-03 20:50:49.872 718-858 InputDispatcher system_server E channel 'c3204c4 com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-03 20:51:07.596 718-858 InputDispatcher system_server E channel '32c4c88 com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-03 20:51:29.776 718-858 InputDispatcher system_server E channel '26b31b2 com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-03 20:52:59.612 718-858 InputDispatcher system_server E channel '95aa8f8 com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-03 20:54:02.033 718-858 InputDispatcher system_server E channel '6a720b8 com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-03 21:00:20.868 718-858 InputDispatcher system_server E channel '207de1e com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-03 21:05:38.221 718-858 InputDispatcher system_server E channel 'c1f632b com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-07 20:44:52.229 1830-1942 .apps.wellbeing com.google.android.apps.wellbeing E Failed to open APK '/data/app/~~dJ88ZxVdANwbzdqaLfO8BA==/com.example.myapplication-Oci8KYGLbCHl-jUio4U6EQ==/base.apk': I/O error 2025-09-07 20:44:52.232 1830-1942 .apps.wellbeing com.google.android.apps.wellbeing E Failed to open APK '/data/app/~~dJ88ZxVdANwbzdqaLfO8BA==/com.example.myapplication-Oci8KYGLbCHl-jUio4U6EQ==/base.apk': I/O error 2025-09-07 20:44:52.232 1830-1942 ResourcesManager com.google.android.apps.wellbeing E failed to add asset path '/data/app/~~dJ88ZxVdANwbzdqaLfO8BA==/com.example.myapplication-Oci8KYGLbCHl-jUio4U6EQ==/base.apk' java.io.IOException: Failed to load asset path /data/app/~~dJ88ZxVdANwbzdqaLfO8BA==/com.example.myapplication-Oci8KYGLbCHl-jUio4U6EQ==/base.apk at android.content.res.ApkAssets.nativeLoad(Native Method) at android.content.res.ApkAssets.<init>(ApkAssets.java:322) at android.content.res.ApkAssets.loadFromPath(ApkAssets.java:171) at android.app.ResourcesManager.loadApkAssets(ResourcesManager.java:618) at android.app.ResourcesManager$ApkAssetsSupplier.load(ResourcesManager.java:287) at android.app.ResourcesManager.createAssetManager(ResourcesManager.java:714) at android.app.ResourcesManager.createResourcesImpl(ResourcesManager.java:801) at android.app.ResourcesManager.findOrCreateResourcesImplForKeyLocked(ResourcesManager.java:854) at android.app.ResourcesManager.createResources(ResourcesManager.java:1199) at android.app.ResourcesManager.getResources(ResourcesManager.java:1301) at android.app.ActivityThread.getTopLevelResources(ActivityThread.java:2979) at android.app.ApplicationPackageManager.getResourcesForApplication(ApplicationPackageManager.java:2154) at android.app.ApplicationPackageManager.getResourcesForApplication(ApplicationPackageManager.java:2140) at android.app.ApplicationPackageManager.getText(ApplicationPackageManager.java:2481) at android.content.pm.PackageItemInfo.loadUnsafeLabel(PackageItemInfo.java:237) at android.content.pm.PackageItemInfo.loadLabel(PackageItemInfo.java:226) at android.app.ApplicationPackageManager.getApplicationLabel(ApplicationPackageManager.java:2526) at cut.c(PG:38) at cfv.apply(PG:391) at e$$ExternalSyntheticApiModelOutline1.m(D8$$SyntheticClass:47) at lcx.accept(PG:44) at j$.util.stream.M0.accept(SourceFile:3) at j$.util.D.x(SourceFile:24) at j$.util.T.forEachRemaining(SourceFile:24) at j$.util.stream.b.c(SourceFile:21) at j$.util.stream.b.y(SourceFile:8) at j$.util.stream.F.b(SourceFile:5) at j$.util.stream.b.f(SourceFile:35) at j$.util.stream.c1.collect(SourceFile:83) at bva.a(PG:99) at kbp.a(PG:301) at kbp.a(PG:38) at ltp.a(PG:3) at lsv.run(PG:19) at ltr.run(PG:5) at lrz.run(PG:17) at idd.run(PG:3) at loz.run(PG:50) at hsu.run(PG:768) at java.lang.Thread.run(Thread.java:1119) at ieo.run(PG:63) 2025-09-07 20:47:00.731 718-858 InputDispatcher system_server E channel 'd671972 com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-07 20:52:16.888 718-858 InputDispatcher system_server E channel '54ceef5 com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-10 08:19:19.039 718-858 InputDispatcher system_server E channel 'da9443c com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-10 08:28:44.520 718-858 InputDispatcher system_server E channel 'fb3dc4e com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-10 08:31:15.953 718-858 InputDispatcher system_server E channel '50c58e2 com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-10 09:08:31.738 718-1763 TransitionController system_server E Set visible without transition ActivityRecord{10540855 u0 com.example.myapplication/.MainActivity t25} playing=true caller=com.android.server.wm.TaskFragment.resumeTopActivity:1629 2025-09-10 09:46:26.507 718-858 InputDispatcher system_server E channel 'dc063cb com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-17 08:57:50.144 718-858 InputDispatcher system_server E channel '1f6629d com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-17 09:00:15.359 718-858 InputDispatcher system_server E channel 'b8ebe12 com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-17 09:08:43.780 718-858 InputDispatcher system_server E channel 'b3a4af9 com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-17 09:09:46.460 718-858 InputDispatcher system_server E channel 'e65939a com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-17 09:10:18.549 718-858 InputDispatcher system_server E channel '97c3cce com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-17 09:10:20.415 718-858 InputDispatcher system_server E channel '4a4890c com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-17 09:15:34.082 718-858 InputDispatcher system_server E channel '5112bb7 com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-17 09:20:13.015 718-858 InputDispatcher system_server E channel 'd3fcd81 com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-17 09:21:45.786 718-858 InputDispatcher system_server E channel '83178b7 com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-17 09:40:09.328 718-858 InputDispatcher system_server E channel 'b88d2d6 com.example.myapplication/com.example.myapplication.MainActivity' ~ Channel is unrecoverably broken and will be disposed! 2025-09-22 17:06:12.048 13959-13959 e.myapplication com.example.myapplication I Late-enabling -Xcheck:jni 2025-09-22 17:06:12.233 13959-13959 e.myapplication com.example.myapplication I Using CollectorTypeCMC GC. 2025-09-22 17:06:12.235 13959-13959 e.myapplication com.example.myapplication W Unexpected CPU variant for x86: x86_64. Known variants: atom, sandybridge, silvermont, goldmont, goldmont-plus, goldmont-without-sha-xsaves, tremont, kabylake, alderlake, default 2025-09-22 17:06:12.271 13959-13959 nativeloader com.example.myapplication D Load libframework-connectivity-tiramisu-jni.so using APEX ns com_android_tethering for caller /apex/com.android.tethering/javalib/framework-connectivity-t.jar: ok 2025-09-22 17:06:12.588 13959-13959 nativeloader com.example.myapplication D Configuring clns-9 for other apk /data/app/~~YtxlO7izXbUn7DwQyfSn6g==/com.example.myapplication-WpLJzT4veBLnMmMJCcbkmw==/base.apk. target_sdk_version=36, uses_libraries=, library_path=/data/app/~~YtxlO7izXbUn7DwQyfSn6g==/com.example.myapplication-WpLJzT4veBLnMmMJCcbkmw==/lib/x86_64:/data/app/~~YtxlO7izXbUn7DwQyfSn6g==/com.example.myapplication-WpLJzT4veBLnMmMJCcbkmw==/base.apk!/lib/x86_64, permitted_path=/data:/mnt/expand:/data/user/0/com.example.myapplication 2025-09-22 17:06:12.595 13959-13959 e.myapplication com.example.myapplication I AssetManager2(0x79d591a4c758) locale list changing from [] to [en-US] 2025-09-22 17:06:12.607 13959-13959 GraphicsEnvironment com.example.myapplication V Currently set values for: 2025-09-22 17:06:12.607 13959-13959 GraphicsEnvironment com.example.myapplication V angle_gl_driver_selection_pkgs=[] 2025-09-22 17:06:12.607 13959-13959 GraphicsEnvironment com.example.myapplication V angle_gl_driver_selection_values=[] 2025-09-22 17:06:12.607 13959-13959 GraphicsEnvironment com.example.myapplication V com.example.myapplication is not listed in per-application setting 2025-09-22 17:06:12.608 13959-13959 GraphicsEnvironment com.example.myapplication V ANGLE allowlist from config: com.dreamgames.royalmatch com.dts.freefiremax com.dxx.firenow com.gramgames.mergedragons com.ludo.king com.mojang.minecraftpe com.my.defense com.nintendo.zaka com.os.airforce com.playrix.fishdomdd.gplay io.teslatech.callbreak jp.konami.prospia net.peakgames.toonblast 2025-09-22 17:06:12.608 13959-13959 GraphicsEnvironment com.example.myapplication V com.example.myapplication is not listed in ANGLE allowlist or settings, returning default 2025-09-22 17:06:12.608 13959-13959 GraphicsEnvironment com.example.myapplication V Neither updatable production driver nor prerelease driver is supported. 2025-09-22 17:06:12.678 13959-13993 DisplayManager com.example.myapplication I Choreographer implicitly registered for the refresh rate. 2025-09-22 17:06:12.683 13959-13959 e.myapplication com.example.myapplication I AssetManager2(0x79d591a4d6f8) locale list changing from [] to [en-US] 2025-09-22 17:06:12.754 13959-13959 AppCompatDelegate com.example.myapplication D Checking for metadata for AppLocalesMetadataHolderService : Service not found 2025-09-22 17:06:12.756 13959-13959 e.myapplication com.example.myapplication I AssetManager2(0x79d591a508f8) locale list changing from [] to [en-US] 2025-09-22 17:06:12.758 13959-13993 EGL_emulation com.example.myapplication I Opening libGLESv1_CM_emulation.so 2025-09-22 17:06:12.758 13959-13993 EGL_emulation com.example.myapplication I Opening libGLESv2_emulation.so 2025-09-22 17:06:12.770 13959-13959 ashmem com.example.myapplication E Pinning is deprecated since Android Q. Please use trim or other methods. 2025-09-22 17:06:12.779 13959-13993 HWUI com.example.myapplication W Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without... 2025-09-22 17:06:12.779 13959-13993 HWUI com.example.myapplication W Failed to initialize 101010-2 format, error = EGL_SUCCESS 2025-09-22 17:06:12.846 13959-13959 CompatChangeReporter com.example.myapplication D Compat change id reported: 377864165; UID 10217; state: ENABLED 2025-09-22 17:06:12.848 13959-13959 DesktopModeFlags com.example.myapplication D Toggle override initialized to: OVERRIDE_UNSET 2025-09-22 17:06:12.917 13959-13959 HWUI com.example.myapplication W Image decoding logging dropped! 2025-09-22 17:06:12.923 13959-13959 e.myapplication com.example.myapplication I hiddenapi: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (runtime_flags=0, domain=platform, api=unsupported) from Landroidx/appcompat/widget/ViewUtils; (domain=app) using reflection: allowed 2025-09-22 17:06:12.923 13959-13959 e.myapplication com.example.myapplication I hiddenapi: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (runtime_flags=0, domain=platform, api=unsupported) from Landroidx/appcompat/widget/ViewUtils; (domain=app) using reflection: allowed 2025-09-22 17:06:13.033 13959-13959 TransactionExecutor com.example.myapplication E Failed to execute the transaction: tId:-782804407 ClientTransaction{ tId:-782804407 transactionItems=[ tId:-782804407 LaunchActivityItem{activityToken=android.os.BinderProxy@be43358,intent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 xflg=0x4 cmp=com.example.myapplication/.MainActivity },ident=184265485,info=ActivityInfo{a09354c com.example.myapplication.MainActivity},curConfig={1.0 310mcc260mnc [en_US] ldltr sw411dp w411dp h914dp 420dpi nrml long port finger qwerty/v/v dpad/v winConfig={ mBounds=Rect(0, 0 - 1080, 2400) mAppBounds=Rect(0, 0 - 1080, 2400) mMaxBounds=Rect(0, 0 - 1080, 2400) mDisplayRotation=ROTATION_0 mWindowingMode=fullscreen mActivityType=undefined mAlwaysOnTop=undefined mRotation=ROTATION_0} as.2 s.535 fontWeightAdjustment=0},overrideConfig={1.0 310mcc260mnc [en_US] ldltr sw411dp w411dp h914dp 420dpi nrml long port finger qwerty/v/v dpad/v winConfig={ mBounds=Rect(0, 0 - 1080, 2400) mAppBounds=Rect(0, 0 - 1080, 2400) mMaxBounds=Rect(0, 0 - 1080, 2400) mDisplayRotation=ROTATION_0 mWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_0} as.2 s.2 fontWeightAdjustment=0},deviceId=0,referrer=com.android.shell,procState=2,state=null,persistentState=null,pendingResults=null,pendingNewIntents=null,sceneTransitionInfo=null,profilerInfo=null,assistToken=android.os.BinderProxy@456b8d9,shareableActivityToken=android.os.BinderProxy@615029e,activityWindowInfo=ActivityWindowInfo{isEmbedded=false, taskBounds=Rect(0, 0 - 1080, 2400), taskFragmentBounds=Rect(0, 0 - 1080, 2400)}} tId:-782804407 ResumeActivityItem{mActivityToken=android.os.BinderProxy@be43358,procState=-1,isForward=true,shouldSendCompatFakeFocus=false} tId:-782804407 Target activity: com.example.myapplication.MainActivity tId:-782804407 ] tId:-782804407 } 2025-09-22 17:06:13.034 13959-13959 AndroidRuntime com.example.myapplication D Shutting down VM 2025-09-22 17:06:13.036 13959-13959 AndroidRuntime com.example.myapplication E FATAL EXCEPTION: main Process: com.example.myapplication, PID: 13959 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapplication/com.example.myapplication.MainActivity}: java.lang.ClassCastException: androidx.appcompat.widget.AppCompatImageButton cannot be cast to android.widget.Button at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4280) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4467) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2823) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loopOnce(Looper.java:248) at android.os.Looper.loop(Looper.java:338) at android.app.ActivityThread.main(ActivityThread.java:9067) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:932) Caused by: java.lang.ClassCastException: androidx.appcompat.widget.AppCompatImageButton cannot be cast to android.widget.Button at com.example.myapplication.MainActivity.setButtonListeners(MainActivity.java:107) at com.example.myapplication.MainActivity.onCreate(MainActivity.java:28) at android.app.Activity.performCreate(Activity.java:9155) at android.app.Activity.performCreate(Activity.java:9133) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1521) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4262) ... 13 more 2025-09-22 17:06:13.048 13959-13959 Process com.example.myapplication I Sending signal. PID: 13959 SIG: 9 2025-09-22 17:08:38.233 14080-14080 e.myapplication com.example.myapplication I Late-enabling -Xcheck:jni 2025-09-22 17:08:38.266 14080-14080 e.myapplication com.example.myapplication I Using CollectorTypeCMC GC. 2025-09-22 17:08:38.267 14080-14080 e.myapplication com.example.myapplication W Unexpected CPU variant for x86: x86_64. Known variants: atom, sandybridge, silvermont, goldmont, goldmont-plus, goldmont-without-sha-xsaves, tremont, kabylake, alderlake, default 2025-09-22 17:08:38.408 14080-14080 nativeloader com.example.myapplication D Load libframework-connectivity-tiramisu-jni.so using APEX ns com_android_tethering for caller /apex/com.android.tethering/javalib/framework-connectivity-t.jar: ok 2025-09-22 17:08:38.470 14080-14080 nativeloader com.example.myapplication D Load /data/user/0/com.example.myapplication/code_cache/startup_agents/3fc68f17-agent.so using system ns (caller=<unknown>): ok 2025-09-22 17:08:38.464 14080-14080 re-initialized> com.example.myapplication W type=1400 audit(0.0:1899): avc: granted { execute } for path="/data/data/com.example.myapplication/code_cache/startup_agents/3fc68f17-agent.so" dev="dm-55" ino=361083 scontext=u:r:untrusted_app:s0:c217,c256,c512,c768 tcontext=u:object_r:app_data_file:s0:c217,c256,c512,c768 tclass=file app=com.example.myapplication 2025-09-22 17:08:38.484 14080-14080 e.myapplication com.example.myapplication W hiddenapi: DexFile /data/data/com.example.myapplication/code_cache/.studio/instruments-c9b0d10a.jar is in boot class path but is not in a known location 2025-09-22 17:08:38.644 14080-14080 e.myapplication com.example.myapplication W Redefining intrinsic method java.lang.Thread java.lang.Thread.currentThread(). This may cause the unexpected use of the original definition of java.lang.Thread java.lang.Thread.currentThread()in methods that have already been compiled. 2025-09-22 17:08:38.644 14080-14080 e.myapplication com.example.myapplication W Redefining intrinsic method boolean java.lang.Thread.interrupted(). This may cause the unexpected use of the original definition of boolean java.lang.Thread.interrupted()in methods that have already been compiled. 2025-09-22 17:08:38.824 14080-14080 nativeloader com.example.myapplication D Configuring clns-9 for other apk /data/app/~~YtxlO7izXbUn7DwQyfSn6g==/com.example.myapplication-WpLJzT4veBLnMmMJCcbkmw==/base.apk. target_sdk_version=36, uses_libraries=, library_path=/data/app/~~YtxlO7izXbUn7DwQyfSn6g==/com.example.myapplication-WpLJzT4veBLnMmMJCcbkmw==/lib/x86_64:/data/app/~~YtxlO7izXbUn7DwQyfSn6g==/com.example.myapplication-WpLJzT4veBLnMmMJCcbkmw==/base.apk!/lib/x86_64, permitted_path=/data:/mnt/expand:/data/user/0/com.example.myapplication 2025-09-22 17:08:38.836 14080-14080 e.myapplication com.example.myapplication I AssetManager2(0x79d591a4c758) locale list changing from [] to [en-US] 2025-09-22 17:08:38.838 14080-14080 e.myapplication com.example.myapplication I AssetManager2(0x79d591a46fd8) locale list changing from [] to [en-US] 2025-09-22 17:08:38.843 14080-14080 GraphicsEnvironment com.example.myapplication V Currently set values for: 2025-09-22 17:08:38.843 14080-14080 GraphicsEnvironment com.example.myapplication V angle_gl_driver_selection_pkgs=[] 2025-09-22 17:08:38.843 14080-14080 GraphicsEnvironment com.example.myapplication V angle_gl_driver_selection_values=[] 2025-09-22 17:08:38.843 14080-14080 GraphicsEnvironment com.example.myapplication V com.example.myapplication is not listed in per-application setting 2025-09-22 17:08:38.844 14080-14080 GraphicsEnvironment com.example.myapplication V ANGLE allowlist from config: com.dreamgames.royalmatch com.dts.freefiremax com.dxx.firenow com.gramgames.mergedragons com.ludo.king com.mojang.minecraftpe com.my.defense com.nintendo.zaka com.os.airforce com.playrix.fishdomdd.gplay io.teslatech.callbreak jp.konami.prospia net.peakgames.toonblast 2025-09-22 17:08:38.844 14080-14080 GraphicsEnvironment com.example.myapplication V com.example.myapplication is not listed in ANGLE allowlist or settings, returning default 2025-09-22 17:08:38.844 14080-14080 GraphicsEnvironment com.example.myapplication V Neither updatable production driver nor prerelease driver is supported. 2025-09-22 17:08:38.888 14080-14096 DisplayManager com.example.myapplication I Choreographer implicitly registered for the refresh rate. 2025-09-22 17:08:38.891 14080-14080 e.myapplication com.example.myapplication I AssetManager2(0x79d591a4d6f8) locale list changing from [] to [en-US] 2025-09-22 17:08:38.929 14080-14096 EGL_emulation com.example.myapplication I Opening libGLESv1_CM_emulation.so 2025-09-22 17:08:38.930 14080-14096 EGL_emulation com.example.myapplication I Opening libGLESv2_emulation.so 2025-09-22 17:08:38.959 14080-14096 HWUI com.example.myapplication W Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without... 2025-09-22 17:08:38.960 14080-14096 HWUI com.example.myapplication W Failed to initialize 101010-2 format, error = EGL_SUCCESS 2025-09-22 17:08:38.966 14080-14080 AppCompatDelegate com.example.myapplication D Checking for metadata for AppLocalesMetadataHolderService : Service not found 2025-09-22 17:08:38.967 14080-14080 e.myapplication com.example.myapplication I AssetManager2(0x79d591a50c18) locale list changing from [] to [en-US] 2025-09-22 17:08:38.979 14080-14080 ashmem com.example.myapplication E Pinning is deprecated since Android Q. Please use trim or other methods. 2025-09-22 17:08:39.036 14080-14080 CompatChangeReporter com.example.myapplication D Compat change id reported: 377864165; UID 10217; state: ENABLED 2025-09-22 17:08:39.037 14080-14080 DesktopModeFlags com.example.myapplication D Toggle override initialized to: OVERRIDE_UNSET 2025-09-22 17:08:39.101 14080-14080 HWUI com.example.myapplication W Image decoding logging dropped! 2025-09-22 17:08:39.107 14080-14080 e.myapplication com.example.myapplication I hiddenapi: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (runtime_flags=0, domain=platform, api=unsupported) from Landroidx/appcompat/widget/ViewUtils; (domain=app) using reflection: allowed 2025-09-22 17:08:39.108 14080-14080 e.myapplication com.example.myapplication I hiddenapi: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (runtime_flags=0, domain=platform, api=unsupported) from Landroidx/appcompat/widget/ViewUtils; (domain=app) using reflection: allowed 2025-09-22 17:08:39.215 14080-14080 TransactionExecutor com.example.myapplication E Failed to execute the transaction: tId:1940201582 ClientTransaction{ tId:1940201582 transactionItems=[ tId:1940201582 LaunchActivityItem{activityToken=android.os.BinderProxy@7091517,intent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 xflg=0x4 cmp=com.example.myapplication/.MainActivity },ident=36553713,info=ActivityInfo{8c6a69b com.example.myapplication.MainActivity},curConfig={1.0 310mcc260mnc [en_US] ldltr sw411dp w411dp h914dp 420dpi nrml long port finger qwerty/v/v dpad/v winConfig={ mBounds=Rect(0, 0 - 1080, 2400) mAppBounds=Rect(0, 0 - 1080, 2400) mMaxBounds=Rect(0, 0 - 1080, 2400) mDisplayRotation=ROTATION_0 mWindowingMode=fullscreen mActivityType=undefined mAlwaysOnTop=undefined mRotation=ROTATION_0} as.2 s.536 fontWeightAdjustment=0},overrideConfig={1.0 310mcc260mnc [en_US] ldltr sw411dp w411dp h914dp 420dpi nrml long port finger qwerty/v/v dpad/v winConfig={ mBounds=Rect(0, 0 - 1080, 2400) mAppBounds=Rect(0, 0 - 1080, 2400) mMaxBounds=Rect(0, 0 - 1080, 2400) mDisplayRotation=ROTATION_0 mWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_0} as.2 s.2 fontWeightAdjustment=0},deviceId=0,referrer=com.android.shell,procState=2,state=null,persistentState=null,pendingResults=null,pendingNewIntents=null,sceneTransitionInfo=null,profilerInfo=null,assistToken=android.os.BinderProxy@a09354c,shareableActivityToken=android.os.BinderProxy@8f10995,activityWindowInfo=ActivityWindowInfo{isEmbedded=false, taskBounds=Rect(0, 0 - 1080, 2400), taskFragmentBounds=Rect(0, 0 - 1080, 2400)}} tId:1940201582 ResumeActivityItem{mActivityToken=android.os.BinderProxy@7091517,procState=-1,isForward=true,shouldSendCompatFakeFocus=false} tId:1940201582 Target activity: com.example.myapplication.MainActivity tId:1940201582 ] tId:1940201582 } 2025-09-22 17:08:39.215 14080-14080 AndroidRuntime com.example.myapplication D Shutting down VM 2025-09-22 17:08:39.218 14080-14080 AndroidRuntime com.example.myapplication E FATAL EXCEPTION: main Process: com.example.myapplication, PID: 14080 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapplication/com.example.myapplication.MainActivity}: java.lang.ClassCastException: androidx.appcompat.widget.AppCompatImageButton cannot be cast to android.widget.Button at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4280) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4467) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2823) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loopOnce(Looper.java:248) at android.os.Looper.loop(Looper.java:338) at android.app.ActivityThread.main(ActivityThread.java:9067) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:932) Caused by: java.lang.ClassCastException: androidx.appcompat.widget.AppCompatImageButton cannot be cast to android.widget.Button at com.example.myapplication.MainActivity.setButtonListeners(MainActivity.java:107) at com.example.myapplication.MainActivity.onCreate(MainActivity.java:28) at android.app.Activity.performCreate(Activity.java:9155) at android.app.Activity.performCreate(Activity.java:9133) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1521) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4262) ... 13 more 2025-09-22 17:08:39.227 14080-14080 Process com.example.myapplication I Sending signal. PID: 14080 SIG: 9
09-23
<think>首先,用户的问题是关于Feign报错:'java.lang.RuntimeException: java.io.IOException: UT000036: Connection terminated parsing multipart data' 的解决方案。我需要参考提供的引用来帮助解决这个问题。 回顾引用: - 引用[1]:报错:java.lang.RuntimeException: java.rmi.ConnectException: Connection refused to host: 127.0.0.1; ... 这与连接拒绝相关,但用户的问题是针对Feign的特定错误。 - 引用[2]:关于java.lang.RuntimeException的一般描述和解决方法,强调运行时异常。 - 引用[3]:具体提到java.io.IOException: UT000036: Connection terminated parsing multipart data,这正是用户提到的错误。它记录了错误堆栈和部分解决方法。 - 引用[4]:另一个RuntimeException案例,但涉及Sqoop export和NULL数据处理,与用户错误不直接相关。 用户的关键错误是:java.lang.RuntimeException caused by java.io.IOException: UT000036: Connection terminated parsing multipart data。从引用[3]可以看出,这个错误发生在解析 multipart 数据时,连接被终止。参考中提到了在调用接口时出现异常,堆栈包括undertow.servlet.spec.HttpServletRequestImpl.parseFormData。 我的回答需要: - 使用中文回答。 - 结构清晰,逐步解决问题。 - 基于引用提供可靠的解决方案。 - 末尾自然地添加引用标识,如[^3]。 用户指定:"参考站内引用:引用[1]:...引用[2]:...引用[3]:...引用[4]:...上述引用仅供参考,并不是用户真正的需求,请尽可能多的参考用户上一次的问题和你的回答。" 用户上一次的问题是关于Feign报错这个特定错误的解决方案。所以,我应该专注于引用[3],因为它直接相关。 从引用[3]: - 错误:java.io.IOException: UT000036: Connection terminated parsing multipart data - 堆栈:发生在HttpServletRequestImpl.parseFormData - 解决方法:虽然没有具体说明,但提到了"解决方法",但描述被截断了。它说"解决方法: [^3]",但没有提供细节。因此,我需要基于这个上下文推断或提供一般建议。 由于引用[3]没有完整描述解决方法,我可以: 1. 解释错误原因:通常,这个错误发生在服务器在处理 multipart/form-data 请求时,连接被客户端(如Feign)意外关闭或超时。 2. 提供可能的解决方案:增大超时设置、检查数据大小、确保客户端和服务器配置兼容等。 3. 基于Feign的上下文:Feign是Spring Cloud的HTTP客户端,用于服务间通信。所以,解决方案应涉及Feign或Spring Boot配置。 常见原因和解决方案: - **原因**:当发送 multipart 请求(如文件上传)时,如果请求体太大或处理时间太长,服务器可能超时或客户端可能关闭连接。 - **解决方案**: - 增大服务器端的超时设置:例如,在Spring Boot中,可以配置undertow或tomcat的连接超时。 - 确保Feign客户端的超时设置充足。 - 检查网络问题:确保连接稳定。 - 优化数据处理:避免发送过大的文件或优化代码。 在Feign中,配置超时可以使用FeignClient的属性,如: ```java @FeignClient(name = "service-name", configuration = FeignConfig.class) public interface MyFeignClient { // ... } ``` 在FeignConfig中设置超时: ```java public class FeignConfig { @Bean public Request.Options options() { return new Request.Options(5000, 10000); // connectTimeout and readTimeout in milliseconds } } ``` 另外,对于multipart处理,确保服务器正确配置multipart解析器。 参考引用[3]的堆栈,提到了undertow,所以如果服务器使用Undertow,可以调整其设置。 回答结构: 1. **理解错误**:解释错误的原因。 2. **解决方案**: - 检查并调整超时设置。 - 验证数据大小。 - 确保客户端和服务器兼容。 3. **具体步骤**:提供代码示例或配置建议。 4. **引用**:自然地引用来源,如基于引用[3]的信息。 最后,生成相关问题: - 根据系统指令:"6.生成相关问题",我需要添加相关问题部分。 相关问题示例: 1. 如何处理Feign客户端中的超时问题? 2. Spring Boot中如何配置Undertow服务器超时? 3. Multipart文件上传的最佳实践是什么? 确保回答真实可靠:基于常见Spring/Feign知识。 完整回答框架: - 开头:确认错误并提供概述。 - 原因分析。 - 逐步解决方案。 - 代码示例(如果需要)。 - 引用标识。 - 相关问题。 </think>### Feign报错 'java.lang.RuntimeException: java.io.IOException: UT000036: Connection terminated parsing multipart data' 的解决方案 您在Feign客户端调用时遇到的错误 `java.lang.RuntimeException: java.io.IOException: UT000036: Connection terminated parsing multipart data` 通常发生在处理HTTP multipart请求(如文件上传)期间,客户端或服务器端连接意外终止。这可能是由于网络问题、超时设置不合理或数据处理异常导致的。下面我将逐步为您分析原因并提供解决方法,确保问题高效解决。 #### 错误原因分析 - **核心问题**:当Feign客户端发送multipart/form-data请求(例如文件上传)时,服务器在解析请求的过程中连接被中断。常见原因包括: - **超时设置过短**:Feign客户端的连接或读取超时(connectTimeout/readTimeout)配置不足,导致服务器来不及处理大型数据请求就断开连接。 - **请求体过大**:传输的multipart数据(如大文件)超出服务器或客户端的默认处理限制。 - **网络或资源问题**:网络不稳定、服务器负载过高或内存不足,触发连接提前关闭。 - **配置不兼容**:Feign与后端服务器(如使用Undertow的Spring Boot应用)的multipart解析配置冲突,导致解析失败。 - **错误堆栈解读**:错误堆栈中的`UT000036`是Undertow服务器的特有错误码,表示在解析multipart数据时连接终止。这与引用[3]中的案例类似,涉及`HttpServletRequestImpl.parseFormData`方法,说明问题可能源于服务器端处理异常[^3]。 #### 逐步解决方案 以下是针对此错误的完整解决方法。建议按顺序操作,从最常见原因开始排查: 1. **增大Feign客户端的超时设置** 这是最常见的修复方式。Feign默认超时较短(约1-2秒),对大型multipart请求不足。在Spring Boot项目中,通过配置文件或代码调整: - **application.yml/application.properties配置**: ```yaml feign: client: config: default: # 应用所有Feign客户端 connectTimeout: 30000 # 连接超时(毫秒),推荐至少30秒 readTimeout: 60000 # 读取超时(毫秒),推荐至少60秒 ``` - **解释**:`connectTimeout`控制建立连接的最大等待时间;`readTimeout`控制从服务器读取响应的最大等待时间。针对文件上传场景,适当增大可避免连接过早终止。 - **Java代码配置(更灵活)**: 创建一个自定义Feign配置类: ```java import feign.Request; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class FeignTimeoutConfig { @Bean public Request.Options options() { return new Request.Options(30000, 60000); // connectTimeout, readTimeout(单位:毫秒) } } ``` - **注意事项**:确保该配置类被`@EnableFeignClients`扫描到。如果只针对特定Feign客户端,在`@FeignClient`注解中添加`configuration = FeignTimeoutConfig.class`。 2. **检查并调整服务器端multipart处理限制** 如果服务器使用Undertow(常见于Spring Boot),需增大其multipart解析的缓冲区大小和超时,避免解析过程中断: - **在服务器端的application.yml中配置**: ```yaml server: undertow: max-post-size: 10485760 # 最大请求体大小(单位:字节),默认约1MB,推荐10MB以上 io-threads: 4 # 适当增加I/O线程数 worker-threads: 20 # 增加工作线程数 ``` - **添加Spring Boot Multipart配置**: ```yaml spring: servlet: multipart: max-file-size: 10MB # 单个文件最大大小 max-request-size: 20MB # 整个请求最大大小 ``` 3. **优化网络和数据验证** - **验证请求数据**:确保客户端发送的multipart数据格式正确(如无损坏文件)。使用工具如Postman或curl测试相同请求,排除Feign特定问题。 - **检查网络稳定性**:确保客户端和服务器间无防火墙或代理干扰。如果使用云服务,验证安全组规则是否允许相关端口。 - **资源监控**:检查服务器CPU/内存使用率。高负载可能导致连接断开。优化代码逻辑,避免在解析时阻塞线程。 4. **处理潜在的数据异常** 如引用[4]所示,数据中的无效值(如NULL解析失败)可能间接引发异常[^4]。确保: - 文件或表单字段不含非法字符(如未转义的特殊符号)。 - 在Feign请求中,使用`@RequestPart`注解正确处理multipart数据: ```java @FeignClient(name = "file-service") public interface FileUploadClient { @PostMapping(path = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) ResponseEntity<String> uploadFile(@RequestPart("file") MultipartFile file); } ``` #### 验证是否解决 完成上述步骤后: 1. 重启客户端和服务器应用。 2. 发送一个测试multipart请求(如小文件上传),逐步增加文件大小。 3. 监控日志:如果错误消失,说明配置生效;若仍有问题,检查服务器日志中的详细堆栈(类似引用[3]的堆栈),定位具体代码位置。 如果问题持续,建议缩减请求规模或添加异常处理逻辑,捕获RuntimeException并记录详细信息: ```java try { feignClient.uploadFile(file); } catch (RuntimeException e) { log.error("Feign multipart request failed: {}", e.getMessage()); // 添加重试或告警逻辑 } ``` #### 总结 此错误通常由超时或数据处理限制引起,优先调整Feign超时和服务器multipart配置即可解决。保持客户端与服务器设置一致是关键[^3]。
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

梦里Coding

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值