Results 1 to 2 of 2

Thread: ClassNotFoundException using Custom Formatter

  1. #1
    Sencha User
    Join Date
    Aug 2008
    Location
    Maryland
    Posts
    20

    Default ClassNotFoundException using Custom Formatter

    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/...Templates.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.

    Code:
    package foobar.client;
    
    public class TestClass implements EntryPoint {
    
        @FormatterFactories(@FormatterFactory(factory=YesNoFactory.class, name="yesNo"))
        public interface Renderer extends XTemplates {
          @XTemplate(source="yesNo.html")
           SafeHtml render(Boolean b);
        }
    
        @Override
        public void onModuledLoad() {
          Renderer r = GWT.create(Renderer.class);
    
          Window.alert(r.render(true).asString());
        }
    }
    Code:
    package foobar.client.formatter;
    
    public class YesNo implements Formatter<Boolean> {
       @Override
       public String format(Boolean data) {
          if (data == null) {
             return null;
          }
          return (data) ? "Yes" : "No";
       }
    }
    Code:
    package foobar.client.formatter;
    
    public class YesNoFactory {
       public static YesNo getFormat() {
          return new YesNo();
       }
    }
    in foobar
    Code:
    <?xml version="1.0 encoding="UTF-8"?>
    <module>
       <inherits name='com.google.gwt.user.User'/>
       <inherits name='com.sencha.gxt.GXT'/>
    
       <entry-point class='foobar.client.TestClass'/>
    
       <source path='client'/>
    </module>
    foobar/client/yesNo.html:
    HTML Code:
    {data:yesNo()}

  2. #2
    Sencha User
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,737

    Default

    As mentioned in the stackoverflow post at http://stackoverflow.com/questions/2...foundexception, 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?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •