0

I really need help here, i have a bundle that basically load the right locale property file in order to load the right language.

Now, these files, FlashcardsMessages_es.properties,FlashcardsMessages_de.properties are in a separated package as a fragment but for some reason it seems that my bundle is not finding the fragment.

java.util.MissingResourceException: Can't find bundle for base name de.tud.cs.se.flashcards.ui.FlashcardsMessages, locale es_MX
  at java.util.ResourceBundle.throwMissingResourceException(Unknown Source)
  at java.util.ResourceBundle.getBundleImpl(Unknown Source)
  at java.util.ResourceBundle.getBundle(Unknown Source)
  at de.tud.cs.se.flashcards.ui.Messages.getMessage(Messages.java:65)

This is the error i got.

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: FlashCardOSGiED
Bundle-SymbolicName: FlashCardOSGiED
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: Activator
Export-Package: .,
 de.tud.cs.se.flashcards.model,
 de.tud.cs.se.flashcards.model.learning,
 de.tud.cs.se.flashcards.model.learning.basic,
 de.tud.cs.se.flashcards.persistence,
 de.tud.cs.se.flashcards.ui,
 de.tud.cs.util
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: javax.imageio,
 javax.swing,
 javax.swing.border,
 javax.swing.event,
 org.osgi.framework,
 org.osgi.util.tracker

This is my bundle's manifest

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: LocaleFragment
Bundle-SymbolicName: LocaleFragment;singleton:=true
Bundle-Version: 1.0.0.qualifier
Fragment-Host: FlashCardOSGiED
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: de.tud.cs.se.flashcards.ui

And this is my fragment's manifest.

If someone could give me some idea what could be wrong t would be awesome.

EDIT: I found the problem, so eclipse or java wont put any resource like properties files or images files inside the jar when the the compiler runs, so my solution was to put the properties files inside the "classes" folder and then after compiling eclipse did put the files inside the jar files correctly. I found this in some other website but some of the suggestions here inspired me into looking in to that direction so thanks a lot.

memo
  • 441
  • 2
  • 6
  • Difficult to say from this info. Does the fragment definitely contain the file `de/tud/cs/se/flashcards/ui/FlashcardsMessages_es_MX.properties`? Have you verified in the shell that the fragment is actually attached to the host? – Neil Bartlett Jul 06 '12 at 15:13

1 Answers1

0

Try a refresh on the host bundle.

If the fragment was attached to the host, maybe it's how you packaged the resource inside the fragment bundle, or how you set the path to the resource in your host code.

sky4
  • 21
  • 3
  • already tried that, and it didnt work, i didnt leave it in my bundle because i thought it wasnt doing anything. – memo Jul 06 '12 at 12:39
  • Require/Provide-Capability are R4.3 headers and not yet supported by Knopflerfish. Anyway they don't seem relevant here. – Neil Bartlett Jul 06 '12 at 13:53
  • i see. ill edit that out, thanks. @memo: maybe the path you set for the resource was incorrect. see this reference: https://blogs.oracle.com/chengfang/entry/p_java_util_missingresourceexception_can – sky4 Jul 06 '12 at 15:38