Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.util.MissingResourceException: Can't find bundle for base name Bundle, locale en #5078

Closed
pdurbin opened this issue Sep 21, 2018 · 4 comments
Assignees

Comments

@pdurbin
Copy link
Member

pdurbin commented Sep 21, 2018

I spent quite a bit of time today struggling with my dev environment on Mac after pulling the latest from the "develop" branch, commit d0cb402, which was the merge for pull request #5023 for #4892.

I was unable to deploy to Glassfish and saw this error in Glassfish's server.log:

java.util.MissingResourceException: Can't find bundle for base name Bundle, locale en

This was coming from line 50 of BundleUtil:

bundle = ResourceBundle.getBundle(defaultBundleFile, bundle_locale, loader);

Here's a handy link:

bundle = ResourceBundle.getBundle(defaultBundleFile, bundle_locale, loader);

In desperation, I almost completely rebuilt my dev environment, which the exception of Solr:

  • new installation of Glassfish (unzipped it fresh)
  • re-ran the installer
  • re-cloned the repo

What seemed to fix it was the following:

mkdir /tmp/lang
cp src/main/java/Bundle.properties /tmp/lang

Why /tmp/lang? Because that's what the code defaults to if you don't have the new dataverse.lang.directory JVM option defined (the installer doesn't set it):

String filesRootDirectory = System.getProperty("dataverse.lang.directory");
if (filesRootDirectory == null || filesRootDirectory.isEmpty()) {
filesRootDirectory = "/tmp/lang";
}

The extra weird thing is that now that I can deploy to Glassfish again, I don't seem to be able to get back to seeing MissingResourceException. For example, I tried moving the lang directory aside, stopping Glassfish, and removing the "generated" folder. I expected the error to come back but it didn't. I can still deploy. Very strange.

Also very strange is the fact that this problem only seems to happen on Mac rather than Linux.

I'm concerned that new developers will have a bad experience trying to get their dev environments set up, so I think we should do something, but I'm not sure what.

If anyone out there runs into this problem too, please let us know.

@pameyer
Copy link
Contributor

pameyer commented Sep 21, 2018

This sounds similar to an issue that was fixed in the PR. It is odd that I'm not seeing this on linux systems, but that it shows up on os x.

@pdurbin
Copy link
Member Author

pdurbin commented Sep 22, 2018

Yep. It's a weird one. @sekmiller also mentioned that when he changes Bundle.properties like we always have the changes aren't reflected so he updated the new JVM option to point to the traditional location of Bundle.properties as a workaround.

@scolapasta
Copy link
Contributor

Reviewing the code, it looks as if the issue hinges on the existence of the directory. Regardless of whether you have the setting, the code looks for a directory (either what you set or /tmp/lang). If the directory exists, but is empty, you would see this exception. If the directory doesn't exist, it attempt to use the standard location, i.e. use the included bundle.

If this is accurate (and @sekmiller is going to run some tests), it would mean that when @pdurbin first tried above, he actually already had a /tmp/lang directory, but it was empty. Moving the directory so it doesn't exist anymore would solve the problem.

So this likely wouldn't effect developers since they wouldn't have a /tmp/lang directory. That said, we prefer to be more explicit, i.e. if you don't set the setting it won't assume /tmp/lang but attempt to the standard location / included bundle. If you do set the setting, and the directory does not exist it, shoudl through an exception.

@sekmiller
Copy link
Contributor

After reviewing our hypothesis above, I made the changes outlined.

Removed the code that set the directory to "tmp/lang" in the absence of the of the jvmOption. Now if the option is set, but the directory is missing or the directory designated in the jvmOption exists, but does not contain the expected bundle a catastrophic deployment error will occur.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants