3

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.

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)

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.

Thanks.

Vivek Barai
  • 1,338
  • 13
  • 26
casolorz
  • 8,486
  • 19
  • 93
  • 200
  • I guess you tried [this](https://blogs.oracle.com/chengfang/solve-javautilmissingresourceexception:-cant-find-bundle-for-base-name-comconfig,-locale-zhcn) already, right? – Peppermint Paddy Nov 19 '17 at 22:05
  • I'm not sure what I should try there. I'm not actually adding the resource myself, it comes through the compile line on gradle, and I can see the resources if I looked at my libraries. Also like I said, this works fine for most of my users, only fails for a few. – casolorz Nov 19 '17 at 22:09

1 Answers1

1

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

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>
  • I have it and I servlets are a key part of my app and it works fine for hundreds of thousands of users every month. It's only a few users that get that error. – casolorz Nov 15 '17 at 13:58
  • have you checked that for that users base name is not empty or missing some params, as it says **Can't find bundle for base name ** – Manish Jaiswal Nov 19 '17 at 07:15
  • Not totally sure I understand but the error is exactly as I pasted on post. `Can't find bundle for base name javax.servlet.LocalStrings, locale it_IT`. I've even seen it for `US`. – casolorz Nov 19 '17 at 16:41