PDA

View Full Version : Apress Ext Gwt chapter 5-6: beanmodel class not found



Padster
14 May 2009, 8:46 AM
Hey folks im going through gslenders book and im having trouble with bean model classes and compling my application. i have a simple bean party and i have the interface extending beanmodelmarker.

Party class

package org.emn.data;

import java.io.Serializable;


public class Party implements Serializable {


privatestaticfinallongserialVersionUID = -2021563303213112570L;

private String id;private String name;

public Party() {}

public Party(String id, String name) { setId(id); setName(name);}

public String getId() { returnid;}

publicvoid setId(String id) { this.id = id;}

public String getName(){ returnname;}

 publicvoid setName(String name) { this.name = name;}
}



BeanModelMarker


package org.emn.data;import com.extjs.gxt.ui.client.data.BeanModelMarker;import com.extjs.gxt.ui.client.data.BeanModelMarker.BEAN; @BEAN(org.emn.data.Party.class) public interface PartyBeanModel extends BeanModelMarker {}
Now im quite new to Ext Gwt and java just been at it a few months and i have searched for the problem using the compilation error but i dont find something that helps me as i often dont get the answers presented by other users.

the Error is : class not found.


Compiling module org.emn.GxtEmn
Refreshing module from source
Refreshing TypeOracle
Processing types in compilation unit: file:/C:/GxtEmn/src/org/emn/data/PartyBeanModel.java
Found type 'PartyBeanModel'
Resolving annotation '@BEAN(org.emn.data.Party.class)'
[ERROR]
java.lang.ClassNotFoundException: org.emn.data.Party
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.google.gwt.dev.javac.TypeOracleMediator.getClassLiteral(TypeOracleMediator.java:763)
at com.google.gwt.dev.javac.TypeOracleMediator.getAnnotationElementValue(TypeOracleMediator.java:674)
at com.google.gwt.dev.javac.TypeOracleMediator.createAnnotationInstance(TypeOracleMediator.java:442)
at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotation(TypeOracleMediator.java:836)
at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotations(TypeOracleMediator.java:857)
at com.google.gwt.dev.javac.TypeOracleMediator.resolveTypeDeclaration(TypeOracleMediator.java:1384)
at com.google.gwt.dev.javac.TypeOracleMediator.addNewUnits(TypeOracleMediator.java:389)
at com.google.gwt.dev.javac.TypeOracleMediator.refresh(TypeOracleMediator.java:417)
at com.google.gwt.dev.javac.CompilationState.refresh(CompilationState.java:179)
at com.google.gwt.dev.javac.CompilationState.<init>(CompilationState.java:93)
at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:264)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:283)
at com.google.gwt.dev.Compiler.run(Compiler.java:170)
at com.google.gwt.dev.Compiler$1.run(Compiler.java:124)
at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:84)
at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:78)
at com.google.gwt.dev.Compiler.main(Compiler.java:131)
Scanning for additional dependencies: jar:file:/C:/Users/Administrator/Documents/Libraries/gxt-2.0-m1/gxt.jar!/com/extjs/gxt/ui/client/data/BeanModelLookup.java
Computing all possible rebind results for 'com.extjs.gxt.ui.client.data.BeanModelLookup'
Rebinding com.extjs.gxt.ui.client.data.BeanModelLookup
Invoking <generate-with class='com.extjs.gxt.ui.rebind.core.BeanModelGenerator'/>
[ERROR] Class com.extjs.gxt.ui.client.data.BeanModelLookup not found.
java.lang.NullPointerException
at com.extjs.gxt.ui.rebind.core.BeanModelGenerator.getMarkerBean(BeanModelGenerator.java:170)
at com.extjs.gxt.ui.rebind.core.BeanModelGenerator.generate(BeanModelGenerator.java:53)
at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:49)
at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.tryRebind(StandardRebindOracle.java:113)
at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:62)
at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:172)
at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:161)
at com.google.gwt.dev.Precompile$DistillerRebindPermutationOracle.getAllPossibleRebindAnswers(Precompile.java:204)
at com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.doFindAdditionalTypesUsingRebinds(WebModeCompilerFrontEnd.java:128)
at com.google.gwt.dev.jdt.AbstractCompiler$CompilerImpl.process(AbstractCompiler.java:151)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:444)
at com.google.gwt.dev.jdt.AbstractCompiler$CompilerImpl.compile(AbstractCompiler.java:85)
at com.google.gwt.dev.jdt.AbstractCompiler$CompilerImpl.compile(AbstractCompiler.java:181)
at com.google.gwt.dev.jdt.AbstractCompiler$CompilerImpl.access$400(AbstractCompiler.java:71)
at com.google.gwt.dev.jdt.AbstractCompiler.compile(AbstractCompiler.java:473)
at com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.getCompilationUnitDeclarations(WebModeCompilerFrontEnd.java:73)
at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:254)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:300)
at com.google.gwt.dev.Compiler.run(Compiler.java:170)
at com.google.gwt.dev.Compiler$1.run(Compiler.java:124)
at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:84)
at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:78)
at com.google.gwt.dev.Compiler.main(Compiler.java:131)
[ERROR] Errors in 'jar:file:/C:/Users/Administrator/Documents/Libraries/gxt-2.0-m1/gxt.jar!/com/extjs/gxt/ui/client/data/BeanModelLookup.java'
[ERROR] Line 24: Failed to resolve 'com.extjs.gxt.ui.client.data.BeanModelLookup' via deferred binding
[ERROR] Cannot proceed due to previous errors

Please can someone with lots of patience help me out. i have been through the books source code and i cant see what i have missed out they seem identical to me.



http://www.extjs.com/forum/images/misc/progress.gif

corporate-cretin
14 May 2009, 9:00 AM
I'm trying to compile the samples on a Rational Application Developer (Eclipse 3.4 runtime) and I am having the same problem.

I've also tried different jre versions (1.5, 1.6) without luck.


compile-gwt:
[java] Compiling module com.extjs.gxt.samples.resources.Resources
[java] Refreshing module from source
[java] Refreshing TypeOracle
[java] Processing types in compilation unit: file:/D:/Development/work/workspaces/workspace_rad75/wspl_gxt_war/src/com/extjs/gxt/samples/resources/client/model/CustomerBeanModel.java
[java] Found type 'CustomerBeanModel'
[java] Resolving annotation '@BEAN(com.extjs.gxt.samples.resources.client.model.Customer.class)'
[java] [ERROR]
[java] java.lang.ClassNotFoundException: com.extjs.gxt.samples.resources.client.model.Customer
[java] at java.net.URLClassLoader$1.run(Unknown Source)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(Unknown Source)
[java] at java.lang.ClassLoader.loadClass(Unknown Source)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
[java] at java.lang.ClassLoader.loadClass(Unknown Source)
[java] at java.lang.ClassLoader.loadClassInternal(Unknown Source)
[java] at java.lang.Class.forName0(Native Method)
[java] at java.lang.Class.forName(Unknown Source)
[java] at com.google.gwt.dev.javac.TypeOracleMediator.getClassLiteral(TypeOracleMediator.java:763)
[java] at com.google.gwt.dev.javac.TypeOracleMediator.getAnnotationElementValue(TypeOracleMediator.java:674)
[java] at com.google.gwt.dev.javac.TypeOracleMediator.createAnnotationInstance(TypeOracleMediator.java:442)
[java] at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotation(TypeOracleMediator.java:836)
[java] at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotations(TypeOracleMediator.java:857)
[java] at com.google.gwt.dev.javac.TypeOracleMediator.resolveTypeDeclaration(TypeOracleMediator.java:1384)
[java] at com.google.gwt.dev.javac.TypeOracleMediator.addNewUnits(TypeOracleMediator.java:389)
[java] at com.google.gwt.dev.javac.TypeOracleMediator.refresh(TypeOracleMediator.java:417)
[java] at com.google.gwt.dev.javac.CompilationState.refresh(CompilationState.java:179)
[java] at com.google.gwt.dev.javac.CompilationState.<init>(CompilationState.java:93)
[java] at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:264)
[java] at com.google.gwt.dev.Precompile.precompile(Precompile.java:283)
[java] at com.google.gwt.dev.Compiler.run(Compiler.java:170)
[java] at com.google.gwt.dev.Compiler$1.run(Compiler.java:124)
[java] at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:84)
[java] at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:78)
[java] at com.google.gwt.dev.Compiler.main(Compiler.java:131)
[java] [ERROR] Module has no entry points defined
[java] Java Result: 1
any ideas?

Padster
14 May 2009, 9:59 AM
I decided to try and implement BeanmodelTag and changed my party class to the following




import

com.extjs.gxt.ui.client.data.BeanModelTag;



publicclass Party implements BeanModelTag,Serializable {}



I then compiled my code in hosted mode and it worked!! For fun i though id remove the beanModelTag from the implementation of the class and surprise it still worked however only in hosted mode!


I cannot complie normally only through hosted mode. This makes no sense!

Im using GWt 1.6 and the google eclipse plugin. (compile button is what i mean by normal compile)

Jose Jeria
15 May 2009, 4:43 AM
What book is this?

Padster
15 May 2009, 4:47 AM
Developing with Ext GWT: Enterprise RIA Development

http://www.apress.com/book/view/1430219408

Jose Jeria
15 May 2009, 5:15 AM
Thanks!

stan229
15 May 2009, 9:53 AM
Is your class with the annotation in the client project?

BTW. I highly recommend that book! Saved me many hours. Doesn't have much content, but there's not that much to write about. Sometimes its nice to see something being explained in text rather than in JavaDoc

Padster
15 May 2009, 3:18 PM
No i dont have it in the client package. Following examples in the book i have put my bean class in a package called "data". modified the Xml to recognise the new package etc.

Jose Jeria
2 Jun 2009, 5:33 AM
Check out the "Keeping Data Independent" block on page 109. I believe that this is what you are looking for.

arkitekt
12 Feb 2010, 1:36 AM
The book indeed is very interesting and resourceful.

However, i have some questions in regards to the example in chapter 6. Currently the Domain Objects are passed between client and server using the "
BeanModelMarker" interface.

That is fine, however, i stumbled into a problem when i wanted to use
RowEditor inside the grid to edit the domain objects, This is due to the fact that
RowEditor expects an object that extends
ModelData .

Here is the code:




private Grid initGrid(){

RpcProxy<BeanModel> proxy = new RpcProxy<BeanModel>() {

@Override
protected void load(Object loadConfig, AsyncCallback callback) {

TestService.Util.getInstance().loadUsers(callback);
}
};

BeanModelReader reader = new BeanModelReader();
ListLoader<BeanModel> loader = new BaseListLoader(proxy, reader);


Store<BeanModel> store = new ListStore<BeanModel>(loader);

final RowEditor re = new RowEditor();

Grid grid = new Grid<BeanModel>((ListStore) store, initGridColumnModel());
grid.setAutoExpandColumn("name");
grid.setBorders(false);
grid.setStripeRows(true);
grid.addPlugin(re);

loader.load();

return grid;

}



I have also provided the screenshot of the grid with the RowEditor popping up but not having any editors inside.

So how do we specify that the RowEditor should edit a particular object when we dont have it at design time!

Padster
12 Feb 2010, 5:01 AM
I assume that seen as we cannot see the code for your column model initGridColumnModel(), that you have defined editors for each of the columns in your grid.

If not then you need to define the editors:

COLUMNCONFIG.setEditor(new CellEditor(new TextField<String>()));