Dear gurus ;)
I've just started playing around with SmartGWT 2.4, SmartGWTEE 2.4, Hibernate 3.6.2 and GWT 2.3.0, using Eclipse.
I am trying to program a very basic web app, where I can take out all my objects in a ListGrid. So far I am getting this error:
My files are as follows:
HibernateSmartGWTIlian.gwt.xml
HibernateSmartGWTIlian.java
server.properties
person.ds.xml
web.xml
My Hibernate are correct, I've already tested them on another project.
I can't seem to find the information that suits me and I'm quite a novice in the J2EE world. Could someone please direct me through the task and tell me where I'm messed up?
Thank you in advance,
Ilian
I've just started playing around with SmartGWT 2.4, SmartGWTEE 2.4, Hibernate 3.6.2 and GWT 2.3.0, using Eclipse.
I am trying to program a very basic web app, where I can take out all my objects in a ListGrid. So far I am getting this error:
Code:
20:26:08.031 [ERROR] [hibernatesmartgwtilian] Unable to load module entry point class com.astra.challenge.hibernate.client.HibernateSmartGWTIlian (see associated exception for details) java.lang.NullPointerException: null at com.smartgwt.client.widgets.grid.ListGrid.setDataSource(ListGrid.java:12535) at com.astra.challenge.hibernate.client.HibernateSmartGWTIlian.onModuleLoad(HibernateSmartGWTIlian.java:24) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396) at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:193) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352) at java.lang.Thread.run(Thread.java:662)
HibernateSmartGWTIlian.gwt.xml
Code:
<?xml version="1.0" encoding="UTF-8"?> <module rename-to='hibernatesmartgwtilian'> <!-- Inherit the core Web Toolkit stuff. --> <inherits name='com.google.gwt.user.User'/> <!-- Other module inherits --> <inherits name="com.smartgwtee.SmartGwtEE"/> <inherits name="com.smartgwt.SmartGwt"/> <!-- Specify the app entry point class. --> <entry-point class='com.astra.challenge.hibernate.client.HibernateSmartGWTIlian'/> <!-- Specify the paths for translatable code --> <source path='client'/> <source path='shared'/> </module>
Code:
package com.astra.challenge.hibernate.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.layout.VLayout; import com.smartgwt.client.types.ListGridEditEvent; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; /** * Entry point classes define <code>onModuleLoad()</code>. */ public class HibernateSmartGWTIlian implements EntryPoint { public void onModuleLoad() { final ListGrid listGrid = new ListGrid(); listGrid.setWidth(700); listGrid.setHeight(224); listGrid.setAlternateRecordStyles(true); listGrid.setDataSource(DataSource.get("person")); listGrid.setAutoFetchData(true); listGrid.setShowFilterEditor(true); listGrid.setCanEdit(true); listGrid.setEditEvent(ListGridEditEvent.CLICK); listGrid.setCanRemoveRecords(true); IButton newButton = new IButton("Add New"); newButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { listGrid.startEditingNew(); } }); VLayout layout = new VLayout(15); layout.addMember(listGrid); layout.addMember(newButton); layout.draw(); } }
server.properties
Code:
webRoot: __AUTODETECT__ gwtModuleName=hibernatesmartgwtilian isomorphicPathRootRelative: $gwtModuleName/sc # -------------- PICK DATABASE TO USE -------------------- sql.defaultDatabase: Mysql # -------------- SETTINGS FOR MYSQL -------------------- sql.Mysql.database.type: mysql sql.Mysql.interface.type: dataSource sql.Mysql.driver: com.mysql.jdbc.jdbc2.optional.MysqlDataSource sql.Mysql.driver.databaseName: astrachallenge sql.Mysql.driver.serverName: localhost sql.Mysql.driver.portNumber: 3306 sql.Mysql.driver.user: root sql.Mysql.driver.password: password # -------------- LOADING APP AND DATASOURCE DEFINITIONS -------------------- project.datasources: $webRoot/ds project.ui: $webRoot/shared/ui project.apps: $webRoot/shared/app RPCManager.enabledBuiltinMethods: *
person.ds.xml
Code:
<DataSource ID="person" serverType="hibernate" tableName="PERSON" > <fields> <field name="id" type="sequence" hidden="true" primaryKey="true" /> <field name="firstName" type="text" title="First Name" length="50" required="true" /> <field name="lastName" type="text" title="Last Name" length="50" required="true" /> <field name="age" type="integer" title="Age" /> <field name="address1" type="text" title="Address 1" length="500" /> <field name="address2" type="text" title="Address 2" length="500" /> <field name="city" type="text" title="City" length="100" /> <field name="country" type="text" title="Country" length="100" /> <field name="zipCode" type="text" title="Zip Code" length="20" /> <field name="gender" type="enum" title="Gender" > <valueMap> <value>Male</value> <value>Female</value> </valueMap> </field> <field name="email" type="text" title="E-mail" length="200" /> </fields> </DataSource>
Code:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <!-- Servlets --> <servlet> <servlet-name>greetServlet</servlet-name> <servlet-class>com.astra.challenge.hibernate.server.GreetingServiceImpl</servlet-class> </servlet> <servlet-mapping> <servlet-name>greetServlet</servlet-name> <url-pattern>/hibernatesmartgwtilian/greet</url-pattern> </servlet-mapping> <!-- Default page to serve --> <welcome-file-list> <welcome-file>HibernateSmartGWTIlian.html</welcome-file> </welcome-file-list> </web-app>
I can't seem to find the information that suits me and I'm quite a novice in the J2EE world. Could someone please direct me through the task and tell me where I'm messed up?
Thank you in advance,
Ilian
Comment