Hi Folks,
I am using GWT as a beginner and at the time of using
java.math.BigDecimal it gives me exception.
Compiling module com.techjini.app.SwordFish
Refreshing module from source
Validating newly compiled units
Removing units with errors
[ERROR] Errors in 'file:/D:/dev/GWT/gwt_workspace/
SwordFish/src/com/techjini/app/client/InvoiceService.java'
[ERROR] Line 3: The import java.math cannot be resolved
[ERROR] Line 13: BigDecimal cannot be resolved to a
type
Removing units with errors
[ERROR] Errors in 'file:/D:/dev/GWT/gwt_workspace/
SwordFish/src/com/techjini/app/client/invoice/CreateInvoice.java'
[ERROR] Line 341: No source code is available for type
java.math.BigDecimal; did you forget to inherit a required module?
[ERROR] Errors in 'file:/D:/dev/GWT/gwt_workspace/
SwordFish/src/com/techjini/app/client/InvoiceServiceAsync.java'
[ERROR] Line 10: No source code is available for type
java.math.BigDecimal; did you forget to inherit a required module?
Removing invalidated units
[WARN] Compilation unit 'file:/D:/dev/GWT/gwt_workspace/
SwordFish/src/com/techjini/app/client/invoice/InvoiceScreen.java' is
removed due to invalid reference(s):
[WARN] file:/D:/dev/GWT/gwt_workspace/SwordFish/src/com/
techjini/app/client/invoice/CreateInvoice.java
[WARN] Compilation unit 'file:/D:/dev/GWT/gwt_workspace/
SwordFish/src/com/techjini/app/client/SwordFish.java' is removed due
to invalid reference(s):
[WARN] file:/D:/dev/GWT/gwt_workspace/SwordFish/src/com/
techjini/app/client/invoice/InvoiceScreen.java
Computing all possible rebind results for
'com.techjini.app.client.SwordFish'
Rebinding com.techjini.app.client.SwordFish
Checking rule <generate-with
class='com.google.gwt.user.rebind.ui.ImageBundleGenerator'/>
[ERROR] Unable to find type
'com.techjini.app.client.SwordFish'
[ERROR] Hint: Previous compiler errors may have made
this type unavailable
[ERROR] Hint: Check the inheritance chain from your
module; it may not be inheriting a required module or a module may not
be adding its source path entries properly
Following is the code :
Model class :
import java.math.BigDecimal;
import java.util.Date;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import com.google.appengine.api.datastore.Blob;
import com.techjini.app.server.util.DateUtil;
@PersistenceCapable(identityType=IdentityType.APPLICATION)
public class Invoice {
public static final Short ACTIVE_STATUS = 1;
public static final Short INACTIVE_STATUS = 2;
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long invoiceId;
@Persistent
private ClientCustomer clientCustomer;
@Persistent
private InvoiceTemplate invoiceTemplate;
@Persistent
private InvoiceSetting invoiceSetting;
@Persistent
private Date dueDate;
@Persistent
private Date invoiceDate;
@Persistent
private BigDecimal amount;
@Persistent
private Short InvoiceStatus;
@Persistent
private Blob invoiceContent;
@Persistent
private Date createdAt;
@Persistent
private Long createdBy;
@Persistent
private Date lastUpdatedAt;
@Persistent
private Long lastUpdatedBy;
@Persistent
private boolean isDeleted;
@Persistent
private Integer version;
public Invoice(Long clientCustomerId, Date dueDate,
Date invoiceDate, BigDecimal amount, Short
invoiceStatus) {
this.amount = amount;
this.createdAt = DateUtil.getCurrentDate();
this.dueDate = dueDate;
this.invoiceDate = invoiceDate;
this.lastUpdatedAt = DateUtil.getCurrentDate();
this.InvoiceStatus = invoiceStatus;
}
// and getter setter of the fields
}
Interface :
import java.math.BigDecimal;
import java.util.Date;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@RemoteServiceRelativePath("createInvoice")
public interface InvoiceService extends RemoteService {
String createInvoice(String invoiceNo, Long clientCustomerId, Date
dueDate, Date invoiceDate, BigDecimal amount ) throws Throwable;
}
import java.math.BigDecimal;
import java.util.Date;
import com.google.gwt.user.client.rpc.AsyncCallback;
public interface InvoiceServiceAsync {
String createInvoice(String invoiceNo, Long clientCustomerId, Date
dueDate, Date invoiceDate, BigDecimal amount, AsyncCallback<String>
callback);
}
Action
import java.math.BigDecimal;
import java.util.Date;
import javax.jdo.PersistenceManager;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.techjini.app.client.InvoiceService;
import com.techjini.app.persistance.PMF;
import com.techjini.app.server.pojo.Invoice;
public class CreateInvoiceAction extends RemoteServiceServlet
implements InvoiceService {
//private static transient Log LOG = LogFactory.getLog
(CreateInvoiceAction.class);
Invoice invoice;
@Override
public String createInvoice(String invoiceNo, Long clientCustomerId,
Date dueDate, Date invoiceDate, BigDecimal amount) throws Throwable {
PersistenceManager pm = PMF.get().getPersistenceManager();
invoice = new Invoice(clientCustomerId, dueDate, invoiceDate,
amount, Invoice.ACTIVE_STATUS);
try {
pm.makePersistent(invoice);
} catch (Exception ex) {
ex.printStackTrace();
throw new Throwable( "Sorry due to " + ex + " invoice could
not created" );
}
finally {
pm.close();
}
return "Successfully created invoice";
}
}
Client side code
public class CreateInvoice {
//private static transient Log LOG = LogFactory.getLog
(CreateInvoice.class);
/**
* Create a remote service proxy to talk to the server-side Invoice
service.
*/
private final InvoiceServiceAsync invoiceService = GWT
.create(InvoiceService.class);
.........................
.......................
private void sendInvoiceDetailToServer() {
//Invoice invoice = new Invoice();
//invoice.setInvoiceStatus(invoice.ACTIVE_STATUS);
invoiceService.createInvoice(invoiceNo.getText(), new
Long
(customerList.getSelectedIndex()), dueDate.getValue(),
invoiceDate.getValue()
, new BigDecimal(amount.getText()), new
AsyncCallback<String>() {
public void onFailure(Throwable
caught) {
// Show the RPC error
message to the user
try {
System.out.println("Remote Procedure Call - Failure");
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
@Override
public void onSuccess(String
result) {
System.out.println("Remote Procedure Call");
System.out.println("Remote");
}
});
}
......................
}
Can you please help me if I have to add anything to the module gwt.xml
class.
Looking forward for help!
Thanks in advance.
Akshi
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---