How to Correctly use com.mattbertolini.hermes.Hermes to manage Constants at Server side (GWT)?

151 views
Skip to first unread message

Tom

unread,
Mar 7, 2014, 11:48:41 AM3/7/14
to google-we...@googlegroups.com

Ok, I want to manage Constants at Server level, so com.mattbertolini.hermes.Hermes is a solution.

Please see all my steps:

1- I downloaded hermes-1.2.0.jar & import into correct Library of eclipse (no problem)

2- Create MyConstantsWithLookup.java at client package

import com.google.gwt.i18n.client.ConstantsWithLookup;

public interface MyConstantsWithLookup extends ConstantsWithLookup {
    String myMsg();
}

3- create MyConstantsWithLookup.properties file in the same client package. The file has this line:

myMsg=Deleted

4- In ServerData.java in Server package

MyConstantsWithLookup my = Hermes.get(MyConstantsWithLookup.class, "");
String  extra=my.myMsg();

When tested in eclipse it works fine but I got Warnign message in eclipse:

[WARN] Server class 'com.ibm.icu.util.ULocale' could not be found in the web app, but was found on the system classpath
   [WARN] Adding classpath entry 'file:/C:/Users/eclipse-jee-juno-SR1-win32-x86_64/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.5.0.v201212122042-rel-r42/gwt-2.5.0/gwt-dev.jar' to the web app classpath for this session
   For additional info see: file:/C:/Users/eclipse-jee-juno-SR1-win32-x86_64/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.5.0.v201212122042-rel-r42/gwt-2.5.0/doc/helpInfo/webAppClassPath.html

I am not sure what this warning'd about? is it serious?

The code was running ok but why eclipse generated this warning?

Thomas Broyer

unread,
Mar 7, 2014, 12:05:24 PM3/7/14
to google-we...@googlegroups.com
Hermes' README tells you you need ICU 4.6. It happens gwt-dev.jar contains ICU (because that's what's used by GWT to generate the client-side code for I18N, and thus what Hermes uses to replicate the functionality on the server side), and DevMode tells you that you're missing ICU in your WEB-INF/lib (which means your app won't run when deployed to a web server) but it can temporarily help you by adding gwt-dev.jar to the classpath (as if it were within the WEB-INF/lib, which is a very very bad idea and can cause all sorts of breakages).
The idea behind this warning is to warn you in case you added a JAR to your classpath (e.g. build path in Eclipse) but didn't put it in the WEB-INF/lib. It happens that in your case you didn't put anything anywhere, but the classes you're trying to use (via Hermes) happen to be in GWT already.

So, yes, it's a serious warning. Download ICU 4.6 and put it in your WEB-INF/lib (oh, and update to GWT 2.6, GWT 2.5 is more than 1 year old already!)

Tom

unread,
Mar 7, 2014, 6:04:59 PM3/7/14
to google-we...@googlegroups.com
Thank you very much Thomas, I did & there is no warning at all.
Reply all
Reply to author
Forward
0 new messages