Saturday, April 4, 2015

How to call GWT_SERVLET FROM SERVLET

I want to save data from HttpServlet to DataStore.

--> HttpServlet

 @Override
 
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
 
/**
 * response
 */

 res
.setContentType("text/html");
 
final PrintWriter out = res.getWriter();
 
 
/**
 * request
 */

 
final String strData = req.getParameter(Constants.REQ_DATA);
 
MyData data = new MyData(strData);

 
MyServer.getService().createData(data, new AsyncCallback<MyData>() {


 
@Override
 
public void onFailure(Throwable caught) {
 
// TODO Auto-generated method stub
 
 
}


 
@Override
 
public void onSuccess(MyData result) {
 
// TODO Auto-generated method stub
   
out.println("success!");
   
out.close();
 
}
 
});
}

But I get error in this line  MyServer.getService().createData(data, new AsyncCallback<MyData>() {

--> Error
java.lang.NoClassDefFoundError: com/google/gwt/core/client/GWTBridge
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:191)
at com.google.appengine.tools.development.agent.runtime.RuntimeHelper.checkRestricted(RuntimeHelper.java:70)
at com.google.appengine.tools.development.agent.runtime.Runtime.checkRestricted(Runtime.java:65)
at com.myserver.client.MyServer.<clinit>(MyServer.java:17)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:191)
at com.google.appengine.tools.development.agent.runtime.RuntimeHelper.checkRestricted(RuntimeHelper.java:70)
at com.google.appengine.tools.development.agent.runtime.Runtime.checkRestricted(Runtime.java:65)


Can you please guide me how to fix it.

Thanks in advance !

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment