错误
android 项目开发
java.lang.Error: javax.xml.datatype.DatatypeConfigurationException: Provider org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl not found
具体的
2022-08-27 22:53:10.085 11471-11471/com.example.electronicmall E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.electronicmall, PID: 11471
java.lang.Error: javax.xml.datatype.DatatypeConfigurationException: Provider org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl not found
at jakarta.xml.bind.DatatypeConverterImpl.<clinit>(DatatypeConverterImpl.java:877)
at jakarta.xml.bind.DatatypeConverter.initConverter(DatatypeConverter.java:125)
at jakarta.xml.bind.DatatypeConverter.printBase64Binary(DatatypeConverter.java:596)
at com.example.electronicmall.common.Sign.sign(Sign.java:45)
at com.example.electronicmall.common.AbstractClient.formatRequestData(AbstractClient.java:631)
at com.example.electronicmall.common.AbstractClient.doRequest(AbstractClient.java:399)
at com.example.electronicmall.common.AbstractClient.internalRequest(AbstractClient.java:356)
at com.example.electronicmall.sms.v20210111.SmsClient.SendSms(SmsClient.java:403)
at com.example.electronicmall.Util.SendSms.main(SendSms.java:118)
at com.example.electronicmall.test.User.UserCompleteValidationActivity$2.onClick(UserCompleteValidationActivity.java:52)
at android.view.View.performClick(View.java:7317)
at android.view.View.performClickInternal(View.java:7291)
at android.view.View.access$3600(View.java:838)
at android.view.View$PerformClick.run(View.java:28247)
at android.os.Handler.handleCallback(Handler.java:900)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:219)
at android.app.ActivityThread.main(ActivityThread.java:8668)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)
Caused by: javax.xml.datatype.DatatypeConfigurationException: Provider org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl not found
at javax.xml.datatype.DatatypeFactory.newInstance(DatatypeFactory.java:106)
at jakarta.xml.bind.DatatypeConverterImpl.<clinit>(DatatypeConverterImpl.java:875)
at jakarta.xml.bind.DatatypeConverter.initConverter(DatatypeConverter.java:125)
at jakarta.xml.bind.DatatypeConverter.printBase64Binary(DatatypeConverter.java:596)
at com.example.electronicmall.common.Sign.sign(Sign.java:45)
at com.example.electronicmall.common.AbstractClient.formatRequestData(AbstractClient.java:631)
at com.example.electronicmall.common.AbstractClient.doRequest(AbstractClient.java:399)
at com.example.electronicmall.common.AbstractClient.internalRequest(AbstractClient.java:356)
at com.example.electronicmall.sms.v20210111.SmsClient.SendSms(SmsClient.java:403)
at com.example.electronicmall.Util.SendSms.main(SendSms.java:118)
at com.example.electronicmall.test.User.UserCompleteValidationActivity$2.onClick(UserCompleteValidationActivity.java:52)
at android.view.View.performClick(View.java:7317)
at android.view.View.performClickInternal(View.java:7291)
at android.view.View.access$3600(View.java:838)
at android.view.View$PerformClick.run(View.java:28247)
at android.os.Handler.handleCallback(Handler.java:900)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:219)
at android.app.ActivityThread.main(ActivityThread.java:8668)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl" on path: DexPathList[[zip file "/data/app/com.example.electronicmall-neoryYK3LWgBYbC6UX8w4w==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.electronicmall-neoryYK3LWgBYbC6UX8w4w==/lib/arm64, /data/app/com.example.electronicmall-neoryYK3LWgBYbC6UX8w4w==/base.apk!/lib/arm64-v8a, /system/lib64, /hw_product/lib64, /system/product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:209)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at javax.xml.datatype.FactoryFinder.newInstance(FactoryFinder.java:157)
at javax.xml.datatype.FactoryFinder.find(FactoryFinder.java:223)
at javax.xml.datatype.DatatypeFactory.newInstance(DatatypeFactory.java:99)
at jakarta.xml.bind.DatatypeConverterImpl.<clinit>(DatatypeConverterImpl.java:875)
at jakarta.xml.bind.DatatypeConverter.initConverter(DatatypeConverter.java:125)
at jakarta.xml.bind.DatatypeConverter.printBase64Binary(DatatypeConverter.java:596)
at com.example.electronicmall.common.Sign.sign(Sign.java:45)
at com.example.electronicmall.common.AbstractClient.formatRequestData(AbstractClient.java:631)
at com.example.electronicmall.common.AbstractClient.doRequest(AbstractClient.java:399)
at com.example.electronicmall.common.AbstractClient.internalRequest(AbstractClient.java:356)
at com.example.electronicmall.sms.v20210111.SmsClient.SendSms(SmsClient.java:403)
at com.example.electronicmall.Util.SendSms.main(SendSms.java:118)
at com.example.electronicmall.test.User.UserCompleteValidationActivity$2.onClick(UserCompleteValidationActivity.java:52)
at android.view.View.performClick(View.java:7317)
at android.view.View.performClickInternal(View.java:7291)
at android.view.View.access$3600(View.java:838)
at android.view.View$PerformClick.run(View.java:28247)
at android.os.Handler.handleCallback(Handler.java:900)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:219)
at android.app.ActivityThread.main(ActivityThread.java:8668)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)
解决
1 app
→
\rightarrow
→build.grade
2 dependencies中加入依赖
implementation group: 'xerces', name: 'xercesImpl', version: '2.11.0'
即
原因
Provider org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl not found表示缺少相关依赖, 在app → \rightarrow →build.grade中的dependencies导入相关依赖即可
原创不易
转载请标明出处
如果对你有所帮助 别忘啦点赞支持哈