MissingResourceException

MissingResourceException

本文介绍了java.util.MissingResourceException:找不到基础名称javax.servlet.LocalStrings的捆绑软件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用multidex的Android应用.它已发布,每月有成千上万的用户.在Crashlytics上,我经常会遇到 ExceptionInInitializerError 崩溃的情况.我从来没有能够复制它们.

I have an Android app that uses multidex. It is released and has monthly users in the hundreds of thousands. Every so often I will get ExceptionInInitializerError crashes on Crashlytics. I've never been able to reproduce them.

我读到这可能是由于multidex引起的,并且在我的配置中具有 multiDexKeepFile file('multidex-config.txt')并带有类别列表会有所帮助,但似乎没有帮助,至少不是为此资源提供帮助.这是我的 multidex-config.txt 上的内容:

I read that this can be due to multidex and that have multiDexKeepFile file('multidex-config.txt') on my config with a list of classes would help, but it doesn't seem to help, at least not for this resource. This is the content on my multidex-config.txt:

org.eclipse.jetty.http.MimeTypes
org.eclipse.jetty.server.Server
javax.servlet.LocalStrings

这些都是我过去曾经崩溃过的所有类.我仍在等待看看其中的一些问题是否已解决,但下面的这一问题肯定会再次出现:

Those are all classes for which I've had crashes like this in the past. I'm still waiting to see if some of those are fixed but this one below keeps coming back for sure:

Fatal Exception: java.lang.ExceptionInInitializerError
       at myapp.run(myclass.java:986)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
       at java.lang.Thread.run(Thread.java:761)
Caused by java.util.MissingResourceException: Can't find bundle for base name javax.servlet.LocalStrings, locale it_IT
       at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1501)
       at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1324)
       at java.util.ResourceBundle.getBundle(ResourceBundle.java:723)
       at javax.servlet.GenericServlet.(GenericServlet.java)

那我该如何解决呢?在这种情况下,它似乎正在寻找意大利语文件,但情况并非总是如此,而且我在意大利有很多用户,因此我不确定为什么它只会崩溃少数.Android Studio上用于 LocalStrings 的资源包仅显示默认语言(法语和日语).

So how can I fix this? In this case it seems to be looking for the Italian file, this isn't always the case and I have a lot of users in Italy so I'm not sure why it is only crashing for a few. The resource bundle on Android Studio for LocalStrings only shows a default one, French and Japanese.

谢谢.

推荐答案

确保不丢失添加servlet-api依赖项的情况.

Make sure you are not missing to add the servlet-api dependency.

如果您使用的是maven,请确保此依赖项在您的项目中:

If you're using maven make sure this dependency is in your project:

<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>javax.servlet-api</artifactId>
  <version>3.1.0</version>
</dependency>

这篇关于java.util.MissingResourceException:找不到基础名称javax.servlet.LocalStrings的捆绑软件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 04:51