-
1. Re: Localization and @WebService
torakuma Oct 21, 2008 6:45 PM (in response to torakuma)I did some more research and it is looking like Seam is not providing its resourceBundle to Hibernate when it is running from a class inside the jar. My class that uses the @WebService is in the jar, not the war. To test this, I made a ValidatorMessages.properties and Hibernate picked it up just fine.
In the war, however, Hibernate is properly using the resourceBundle configured in components.xml.
So I guess the question is...
Is there something special I need to do to get Seam to provide its resourceBundle to Hibernate when validating a class NOT in the war?
-
2. Re: Localization and @WebService
sebdoncker Dec 18, 2008 2:04 AM (in response to torakuma)It's not just for Hibernate.
I have exactly the same problem with this code in a WebService in a jar :
Messages.instance().get("some message key");
If someone has an answer ???
Thanks in advance
Seb
-
3. Re: Localization and @WebService
sebdoncker Dec 18, 2008 3:13 AM (in response to torakuma)I found a solution.
- I put my i18n properties files in the jar
- then I have removed the <core:resource-loader><core:bundle-names> part from the components.xml in the WEB-INF of my war.
- I create a simple ResourceLoader class to found my properties files :
@Scope(ScopeType.STATELESS) @BypassInterceptors @Install(precedence=Install.APPLICATION) @Name("org.jboss.seam.core.resourceLoader") public class WSResourceLoader extends ResourceLoader { @Override public String[] getBundleNames() { String[] base = super.getBundleNames(); String[] bundles = new String[base.length + 2]; for(int i = 0, nb = base.length; i< nb; i++) bundles[i] = base[i]; int i = base.length; bundles[i++] = "/i18n/messages"; bundles[i++] = "/i18n/general"; return bundles; } }
And now, in my web services (in the jar) or in the xhtml (seam) files, the messages bundles are well loaded.
I don't know if there is a simpler way to do that, but this one does the job !
If anyone has comments on that ?
Seb