Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Ext GWT Premium Member
    Join Date
    Feb 2010
    Posts
    52
    Vote Rating
    0
    BayerBusiness is on a distinguished road

      0  

    Thumbs up [GXT3 Beta2]: Solve Caused by: java.lang.NoClassDefFoundError: org/json/JSONObject

    [GXT3 Beta2]: Solve Caused by: java.lang.NoClassDefFoundError: org/json/JSONObject


    Hi eveyone,

    not an actual bug (I think), but something I had a major problems. If the following code was run in developer mode, clicking on the "Send" button produced a long error stack trace. Within the stack trace the following problem was described: Caused by: java.lang.NoClassDefFoundError: org/json/JSONObject.

    Solution: Include gwt-servlet-deps.jar explicitely to the build path
    (see http://stackoverflow.com/questions/6...-i-doing-wrong)

    The file is located (for my installation) in:
    %Program Files%\eclipse_3.7_SR1_indigo\eclipse\plugins\com.google.gwt.eclipse.sdkbundle_2.4.0.v201201120043-rel-r37\gwt-2.4.0

    Used code:
    Code:
    /**
     * Entry point classes define <code>onModuleLoad()</code>.
     */
    public class LearningGXT3 implements EntryPoint {
          public interface Role {
              long getId();
                
              void setId(long id);
    
              String getName();
                
              void setName(String name);
          }
          
          interface RoleProperties extends PropertyAccess<Role> {
                @Path("id")
                ModelKeyProvider<Role> key();
    
                ValueProvider<Role, Long> id();
                
                ValueProvider<Role, String> name();
              }
        
          
          public interface RoleAutoBeanFactory extends AutoBeanFactory {
              AutoBean<RecordResult> items();
              AutoBean<ListLoadConfig> loadConfig();
          }
          
          /**
           * Defines the structure of the root JSON object being returned by the server.
           * This class is needed as we cannot return a list of objects. Instead, we
           * return a single object with a single property that contains the data
           * records.
           */
          public interface RecordResult {
              List<Role> getRecords();
          }
    
          class DataRecordJsonReader extends JsonReader<ListLoadResult<Role>, RecordResult> {
                public DataRecordJsonReader(AutoBeanFactory factory, Class<RecordResult> rootBeanType) {
                  super(factory, rootBeanType);
                }
    
                @Override
                protected ListLoadResult<Role> createReturnData(Object loadConfig, RecordResult incomingData) {
                  return new ListLoadResultBean<Role>(incomingData.getRecords());
                }
              }
          
        /**
         * This is the entry point method.
         */
        public void onModuleLoad() {
            RoleAutoBeanFactory factory = GWT.create(RoleAutoBeanFactory.class);
            
            DataRecordJsonReader reader = new DataRecordJsonReader(factory, RecordResult.class);
    
            String path = "http://<server>/roles.asmx/getItemsGXT3";
            RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, path);
            builder.setHeader("content-type", "application/json");
            
            HttpProxy<ListLoadConfig> proxy = new HttpProxy<ListLoadConfig>(builder);
            // Create JSON
            proxy.setWriter(new JsonWriter<ListLoadConfig>(factory, ListLoadConfig.class));
    
            final ListLoader<ListLoadConfig, ListLoadResult<Role>> loader =
                    new ListLoader<ListLoadConfig, ListLoadResult<Role>>(proxy, reader);
            
            RoleProperties props = GWT.create(RoleProperties.class);
            
            ListStore<Role> store = new ListStore<Role>(props.key());
            
            ColumnConfig<Role, Long> cc1 = new ColumnConfig<Role, Long>(props.id(), 100, "ID");
            ColumnConfig<Role, String> cc2 = new ColumnConfig<Role, String>(props.name(), 100, "Name");
            
            List<ColumnConfig<Role, ?>> l = new ArrayList<ColumnConfig<Role, ?>>();
            l.add(cc1);
            l.add(cc2);
            ColumnModel<Role> cm = new ColumnModel<Role>(l);
    
            Grid<Role> view = new Grid<Role>(store, cm);
            view.getView().setForceFit(true);
            view.setLoader(loader);
    
            Button sendButton = new Button("Send");
            sendButton.addClickHandler(new ClickHandler() {
    
                @Override
                public void onClick(ClickEvent event) {
                    loader.load();
                }
            });
    
            // We can add style names to widgets
            sendButton.addStyleName("sendButton");
    
            // Add the nameField and sendButton to the RootPanel
            // Use RootPanel.get() to get the entire body element
            RootPanel.get("sendButtonContainer").add(sendButton);
            RootPanel.get().add(view);
        }
    }
    If there is a better way to solve this issue: Any hints are appreciated.

    Regards,
    Björn

  2. #2
    Sencha User
    Join Date
    Jan 2012
    Posts
    21
    Vote Rating
    0
    robferguson is on a distinguished road

      0  

    Default


    Hi,

    I ran into the same issue. I then checked the WEB-INF/lib directory of the examples war (gxt-examples-3.0.0-beta1.war) and noticed the JSON jar (json-20090211.jar). So I updated my POM to include the gwt-servlet-deps dependency:

    Code:
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-servlet-deps</artifactId> <!-- required for AutoBean support -->
      <version>${gwt.version}</version>
      <scope>runtime</scope>
    </dependency>
    Your approach is fine.

    Cheers
    Rob

    http://code.google.com/p/gwt-cx/

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar