View Full Version : ClassNotFoundException using Custom Formatter

1 Aug 2014, 9:32 AM
I am trying to use a custom formatter to turn a boolean into "Yes" or "No" and have run into a roadblock.

There are no compile errors in my IDE does not give any compile errors (thus any errors in this code are a result of my typing) but when I try to compile I receive

[ERROR] Annotation error: cannot resolve foobar.client.formatter.YesNoFormatter - exception: ClassNotFoundException

followed by a few other exceptions that appear to stem from this exception. I understand what a ClassNotFoundException indicates however I cannot figure out why I would be getting it since, as my code shows, the YesNoFormatter class is located in foobar.client.formatter and I can access it through a GWT.log statement (i.e. GWT.log("True: " + YesNoFactory.getFormat().format(Boolean.TRUE))

I am using GXT 3.1.0 and GWT 2.6.1.

Could anybody have an idea of why I am getting this exception? The example given at http://docs.sencha.com/gxt-guides/3/utility/xtemplates/XTemplates.html doesn't mention anything (as far as I can see) about these classes needing to be in specific locations so I am at a loss.

package foobar.client;

public class TestClass implements EntryPoint {

@FormatterFactories(@FormatterFactory(factory=YesNoFactory.class, name="yesNo"))
public interface Renderer extends XTemplates {
SafeHtml render(Boolean b);

public void onModuledLoad() {
Renderer r = GWT.create(Renderer.class);


package foobar.client.formatter;

public class YesNo implements Formatter<Boolean> {
public String format(Boolean data) {
if (data == null) {
return null;
return (data) ? "Yes" : "No";

package foobar.client.formatter;

public class YesNoFactory {
public static YesNo getFormat() {
return new YesNo();

in foobar

<?xml version="1.0 encoding="UTF-8"?>
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.sencha.gxt.GXT'/>

<entry-point class='foobar.client.TestClass'/>

<source path='client'/>



Colin Alworth
5 Aug 2014, 2:00 PM
As mentioned in the stackoverflow post at http://stackoverflow.com/questions/25117896/gxt-3-xtemplate-custom-formatter-classnotfoundexception, we need more information to be able to help, but it sure looks like a classpath setup problem. Can you share the *full* stack trace, as well as *any* other errors that happen along the way? Additionally, do you get this error both in dev mode and when compiling to JavaScript?