我有这个方法从数据库获取数据并将其发送到客户端。在一个阶段我试图将日期从格里高利转换为波斯日期,但由于某种原因,我得到了这个错误,我在下面附上。
private DataProvider getSupplierOrderData(Long supplierorderid)
{
SupplierOrder supplierOrder = SupplierOrderBussinessLogic.getInstance().getSupplierOrderById(supplierorderid);
List<SupplierOrderDetails> list = SupplierOrderDetailBussinessLogic.getInstance().getSupplierOrderDetailsFromsupplierOrder(supplierOrder);
DataProviderBuilder dpb = new DataProviderBuilder();
// add heading data
dpb.add("so", supplierOrder.getSupplierOrderNo());
dpb.add("sn", supplierOrder.getSupplier().getPerName());
dpb.add("sec", supplierOrder.getSection().getAlternateName());
// I GET THE ERROR ON THIS BELOW LINE
String date = CommonUtil.gregorianToJalali(supplierOrder.getSupplierOrderCreated()).toString();
System.out.println("Document render date !!!! "+date);
dpb.add("od", supplierOrder.getSupplierOrderCreated().toString());
// add table data
dpb.addJavaObject(list, "data");
return dpb.getDataProvider();
}
我得到的错误是
java.lang.ExceptionInInitializerError
at com.kaizen.erp.client.utill.CommonUtil.<clinit>(CommonUtil.java:17)
at com.kaizen.erp.server.docmosis.SupplierOrderPrintController.getSupplierOrderData(SupplierOrderPrintController.java:138)
at com.kaizen.erp.server.docmosis.SupplierOrderPrintController.handleRequest(SupplierOrderPrintController.java:64)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:859)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:793)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:431)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1097)
at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:260)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Caused by: java.lang.UnsupportedOperationException: ERROR: GWT.create() is only usable in client code! It cannot be called, for example, from server code. If you are running a unit test, check that your test case extends GWTTestCase and that GWT.create() is not called from within an initializer or constructor.
at com.google.gwt.core.shared.GWT.create(GWT.java:51)
at com.google.gwt.core.client.GWT.create(GWT.java:85)
at com.kaizen.erp.client.Kaizenerpweb.<clinit>(Kaizenerpweb.java:25)
... 30 more
[WARN] Nested in java.lang.ExceptionInInitializerError:
java.lang.UnsupportedOperationException: ERROR: GWT.create() is only usable in client code! It cannot be called, for example, from server code. If you are running a unit test, check that your test case extends GWTTestCase and that GWT.create() is not called from within an initializer or constructor.
at com.google.gwt.core.shared.GWT.create(GWT.java:51)
at com.google.gwt.core.client.GWT.create(GWT.java:85)
at com.kaizen.erp.client.Kaizenerpweb.<clinit>(Kaizenerpweb.java:25)
at com.kaizen.erp.client.utill.CommonUtil.<clinit>(CommonUtil.java:17)
at com.kaizen.erp.server.docmosis.SupplierOrderPrintController.getSupplierOrderData(SupplierOrderPrintController.java:138)
at com.kaizen.erp.server.docmosis.SupplierOrderPrintController.handleRequest(SupplierOrderPrintController.java:64)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:859)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:793)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:431)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)