Re: GWT-RPC-AsyncCallback

2020-07-22 Thread JonL

Depending on your architecture, the server generating the file might not 
have any control over the timeout.  You could have proxies, firewalls, etc 
that can affect the timeout.  It is best to remove the timeout from the 
equation.  

If you can not fix the fetch, I would split it into a call that spawns a 
separate thread to do the generation, returns to the client saying "your 
request was successful and is pending", then use a secondary async call to 
poll periodically to check if the file creation is finished, then when 
available, the user can click a button to download and you can immediately 
write the file to the browser.  The secondary request could possibly 
include progress to display to the user if you can provide feedback on the 
number of records being processed, etc.

On Wednesday, July 22, 2020 at 9:32:10 AM UTC-4 vie...@gmail.com wrote:

> Hi Paddy,
>
> maybe you can split the request. ATM you trigger the export and fetch the 
> data. I suggest to write a request for trigger the export (and you receive 
> a unique export id) and then check the download service from time to time 
> with the export id. If the export is not finished yet the callback is 
> rescheduled, otherwise you fetch the data. 
> I think you can build better solutions with webhooks and stuff, but the 
> main idea is split the two actions ;)
>
> Hope this helps.
>
> Norbert
> Paddy schrieb am Mittwoch, 22. Juli 2020 um 03:01:14 UTC+2:
>
>> Hi All,
>> We have a UI application, where user searches for records and exports the 
>> data to an excel. Once the export is completed at the server side, it 
>> notifies the client by async call back and then there is code at client 
>> side to give a popup to the customer saying, the file is ready for download 
>> and give an option to download the file from server.
>> However, when server side fetch takes more than 3 minutes, the client is 
>> closing the socket(I think). Though the report is getting generated at the 
>> server, the user is not getting the pop up to download the report. Is there 
>> anyway to stop the client from closing the socket? This issue happens only 
>> when there are more than 400 records to be fetched. One way to fix this, is 
>> to fix the fetch (which at this point cannot be done as there are some 
>> encryption calls happening during this). But wanted to know if there is any 
>> timeout parameters that can be configured, so that we can somehow stop 
>> client from closing the socket?
>> I am seeing socket timeout exceptions in the GWT logs.
>>
>>
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/14b9d0b7-d36c-470a-a31a-07ff2dc8d1d8n%40googlegroups.com.


Re: GWT-RPC-AsyncCallback

2020-07-22 Thread vie...@gmail.com
Hi Paddy,

maybe you can split the request. ATM you trigger the export and fetch the 
data. I suggest to write a request for trigger the export (and you receive 
a unique export id) and then check the download service from time to time 
with the export id. If the export is not finished yet the callback is 
rescheduled, otherwise you fetch the data. 
I think you can build better solutions with webhooks and stuff, but the 
main idea is split the two actions ;)

Hope this helps.

Norbert
Paddy schrieb am Mittwoch, 22. Juli 2020 um 03:01:14 UTC+2:

> Hi All,
> We have a UI application, where user searches for records and exports the 
> data to an excel. Once the export is completed at the server side, it 
> notifies the client by async call back and then there is code at client 
> side to give a popup to the customer saying, the file is ready for download 
> and give an option to download the file from server.
> However, when server side fetch takes more than 3 minutes, the client is 
> closing the socket(I think). Though the report is getting generated at the 
> server, the user is not getting the pop up to download the report. Is there 
> anyway to stop the client from closing the socket? This issue happens only 
> when there are more than 400 records to be fetched. One way to fix this, is 
> to fix the fetch (which at this point cannot be done as there are some 
> encryption calls happening during this). But wanted to know if there is any 
> timeout parameters that can be configured, so that we can somehow stop 
> client from closing the socket?
> I am seeing socket timeout exceptions in the GWT logs.
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/31e4abab-aca1-4ff6-bc5c-5fe622a2a673n%40googlegroups.com.


GWT-RPC-AsyncCallback

2020-07-21 Thread Paddy
Hi All,
We have a UI application, where user searches for records and exports the 
data to an excel. Once the export is completed at the server side, it 
notifies the client by async call back and then there is code at client 
side to give a popup to the customer saying, the file is ready for download 
and give an option to download the file from server.
However, when server side fetch takes more than 3 minutes, the client is 
closing the socket(I think). Though the report is getting generated at the 
server, the user is not getting the pop up to download the report. Is there 
anyway to stop the client from closing the socket? This issue happens only 
when there are more than 400 records to be fetched. One way to fix this, is 
to fix the fetch (which at this point cannot be done as there are some 
encryption calls happening during this). But wanted to know if there is any 
timeout parameters that can be configured, so that we can somehow stop 
client from closing the socket?
I am seeing socket timeout exceptions in the GWT logs.




-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/d6da9d82-94dd-450f-a846-91a80ff6eecbo%40googlegroups.com.


Re: GWT RPC AsyncCallBack is always failing persistently.

2013-11-01 Thread zhenliang . low
com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: This 
application is out of date, please click the refresh button on your 
browser. ( Blocked attempt to access interface 
'com.mycompany.project.client.Connection', which is not implemented by 
'com.mycompany.project.server.MySQLConnection'; this is either 
misconfiguration or a hack attempt )
at 
com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException_FieldSerializer.instantiate(IncompatibleRemoteServiceException_FieldSerializer.java:16)
at 
com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException_FieldSerializer.create(IncompatibleRemoteServiceException_FieldSerializer.java:25)
at 
com.google.gwt.user.client.rpc.impl.SerializerBase.instantiate(SerializerBase.java:115)
at 
com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader.deserialize(ClientSerializationStreamReader.java:396)
at 
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readObject(AbstractSerializationStreamReader.java:119)
at 
com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:216)
at 
com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:258)
at 
com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:412)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at 
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at 
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
at 
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
at 
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
at 
com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
at 
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:242)
at sun.reflect.GeneratedMethodAccessor50.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at 
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at 
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
at 
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
at 
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
at java.lang.Thread.run(Unknown Source)

This is the entire error code which appeared at the console and I'm so 
confused about all these errors. I have google about the error on 
mismatching but with no aid.

-- 
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+unsubscr...@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/groups/opt_out.


Re: GWT RPC AsyncCallBack is always failing persistently.

2013-10-31 Thread zhenliang . low
I'm sorry I'm pretty lousy in this so I could really understand what you 
meant.

How I check if the call back is failing is by running a web application and 
by clicking the button I would hence try to call the server side, in which 
it should reply or return the value of my latest database entry.

To check if it is failing I had 2 labels, one which is to show the database 
entry and the other is to print Fail on the label if the AsyncCallBack is 
onFailure.


How do I check the exception in onFailure says at? Is it on my Entry point 
side?

 



On Wednesday, October 30, 2013 6:08:28 PM UTC+8, Jens wrote:

 And what does the exception in onFailure say?

 -- J.


-- 
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+unsubscr...@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/groups/opt_out.


Re: GWT RPC AsyncCallBack is always failing persistently.

2013-10-31 Thread Ahmet Dakoglu
Inspect the caught and look into the errorMessage in it.

 *public void onFailure(Throwable caught) {
 Hi.setText(You fail!);
}
​*​

*
*
*

Ahmet DAKOĞLU*


On Thu, Oct 31, 2013 at 10:27 AM, zhenliang@gmail.com wrote:

 I'm sorry I'm pretty lousy in this so I could really understand what you
 meant.

 How I check if the call back is failing is by running a web application
 and by clicking the button I would hence try to call the server side, in
 which it should reply or return the value of my latest database entry.

 To check if it is failing I had 2 labels, one which is to show the
 database entry and the other is to print Fail on the label if the
 AsyncCallBack is onFailure.


 How do I check the exception in onFailure says at? Is it on my Entry point
 side?





 On Wednesday, October 30, 2013 6:08:28 PM UTC+8, Jens wrote:

 And what does the exception in onFailure say?

 -- J.

  --
 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+unsubscr...@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/groups/opt_out.


-- 
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+unsubscr...@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/groups/opt_out.


Re: GWT RPC AsyncCallBack is always failing persistently.

2013-10-31 Thread zhenliang . low
I'm not sure about this but i get wad you meant. Technically there is not 
error in this,it is just that everytime i run my gwt application, When my 
button is being clicked, no results is returned from the server side

On Thursday, October 31, 2013 4:55:28 PM UTC+8, Ahmet Dakoglu wrote:

 Inspect the caught and look into the errorMessage in it.

  *public void onFailure(Throwable caught) {
  Hi.setText(You fail!);
 }
 ​*​

 *
 *
 *

 Ahmet DAKOĞLU*


 On Thu, Oct 31, 2013 at 10:27 AM, zhenli...@gmail.com javascript:wrote:

 I'm sorry I'm pretty lousy in this so I could really understand what you 
 meant.

 How I check if the call back is failing is by running a web application 
 and by clicking the button I would hence try to call the server side, in 
 which it should reply or return the value of my latest database entry.

 To check if it is failing I had 2 labels, one which is to show the 
 database entry and the other is to print Fail on the label if the 
 AsyncCallBack is onFailure.


 How do I check the exception in onFailure says at? Is it on my Entry 
 point side?

  



 On Wednesday, October 30, 2013 6:08:28 PM UTC+8, Jens wrote:

 And what does the exception in onFailure say?

 -- J.

  -- 
 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+unsubscr...@googlegroups.com javascript:.
 To post to this group, send email to 
 google-we...@googlegroups.comjavascript:
 .
 Visit this group at http://groups.google.com/group/google-web-toolkit.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
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+unsubscr...@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/groups/opt_out.


Re: GWT RPC AsyncCallBack is always failing persistently.

2013-10-31 Thread Jens
You would probably already know whats the reason if you would just print 
out the exception like you do on the server.

Change

public void onFailure(Throwable caught) {
  Hi.setText(You fail!);
}

to

public void onFailure(Throwable caught) {
  *caught.printStackTrace();*
  Hi.setText(You fail!);
}

and take a look in your Eclipse console!

-- J.

-- 
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+unsubscr...@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/groups/opt_out.


Re: GWT RPC AsyncCallBack is always failing persistently.

2013-10-31 Thread zhenliang . low
I got this error message on the consolue but i totally do not understand 
what is it talking about 

 meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1/

 titleError 404 NOT_FOUND/title

 /head

 bodyh2HTTP ERROR: 404/h2preNOT_FOUND/pre

 pRequestURI=/com.mycompany.project.Alternate/MySQLConnection/ppismalla
  
 href=http://jetty.mortbay.org/;Powered by 
 Jetty:///a/small/i/pbr/   
  

 br/ 

  

On Friday, November 1, 2013 12:12:56 AM UTC+8, Jens wrote:

 You would probably already know whats the reason if you would just print 
 out the exception like you do on the server.

 Change

 public void onFailure(Throwable caught) {
   Hi.setText(You fail!);
 }

 to

 public void onFailure(Throwable caught) {
   *caught.printStackTrace();*
   Hi.setText(You fail!);
 }

 and take a look in your Eclipse console!

 -- J.


-- 
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+unsubscr...@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/groups/opt_out.


Re: GWT RPC AsyncCallBack is always failing persistently.

2013-10-31 Thread Jens
GWT tries to send its request to 
/com.mycompany.project.Alternate/MySQLConnection 
but your servlet isn't deployed at that location. 

Check your servlet configuration in your web.xml file. 

Maybe you should also 
read: 
http://www.gwtproject.org/doc/latest/DevGuideServerCommunication.html#DevGuideImplementingServices

-- J.

-- 
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+unsubscr...@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/groups/opt_out.


Re: GWT RPC AsyncCallBack is always failing persistently.

2013-10-31 Thread zhenliang . low
module
inherits name=com.google.gwt.user.User/
inherits name=com.google.gwt.user.theme.standard.Standard/
entry-point class=com.mycompany.project.client.Alternate/entry-point
servlet class = com.mycompany.project.server.MySQLConnection 
path=/MySQLConnection/

This was my previous xml file in the system.

I read the website you have given me, I tried to copy and paste the website 
you have given me and edit accordingly but the results is the module would 
not load, hence i re-edited with a new line 

servlet-mapping 
url-pattern=com.mycompany.project.client.Connection/servlet-mappingservlet


but the module would not load either, it gives Line 6: Unexpected element 
'servlet-mapping'.

i would like to ask also, for the url pattern, does it link it to my 
interface which is the Synchonous interface?
 

On Friday, November 1, 2013 1:01:34 AM UTC+8, Jens wrote:

 GWT tries to send its request to 
 /com.mycompany.project.Alternate/MySQLConnection 
 but your servlet isn't deployed at that location. 

 Check your servlet configuration in your web.xml file. 

 Maybe you should also read: 
 http://www.gwtproject.org/doc/latest/DevGuideServerCommunication.html#DevGuideImplementingServices

 -- J.


-- 
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+unsubscr...@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/groups/opt_out.


Re: GWT RPC AsyncCallBack is always failing persistently.

2013-10-31 Thread zhenliang . low
As for i read the website for URL-pattern it is based of If i have a 
module what does modulemeant by?

-- 
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+unsubscr...@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/groups/opt_out.


Re: GWT RPC AsyncCallBack is always failing persistently.

2013-10-31 Thread Jens


 module
 inherits name=com.google.gwt.user.User/
 inherits name=com.google.gwt.user.theme.standard.Standard/
 entry-point class=com.mycompany.project.client.Alternate/entry-point
 servlet class = com.mycompany.project.server.MySQLConnection 
 path=/MySQLConnection/


You don't need that servlet tag anymore if you use GWT 1.6 or above. If 
you use an earlier version of GWT then you can probably stop reading now as 
I have no clue how things work for these versions (I started with GWT 2.0).



I read the website you have given me, I tried to copy and paste the website 
 you have given me and edit accordingly but the results is the module would 
 not load, hence i re-edited with a new line 

 servlet-mapping 
 url-pattern=com.mycompany.project.client.Connection/servlet-mappingservlet


 but the module would not load either, it gives Line 6: Unexpected element 
 'servlet-mapping'.



What you have copied from the website has to be put into the web.xml file 
and not into your *.gwt.xml GWT module.

 

i would like to ask also, for the url pattern, does it link it to my 
 interface which is the Synchonous interface?


The url pattern describes the url under which your servlet should be 
accessible. This url pattern can be anything as long as your GWT app and 
your server use the same url. In your case you have configured your service 
using 

String moduleRelativeURL = GWT.getModuleBaseURL() + MySQLConnection;
target.setServiceEntryPoint(moduleRelativeURL);

which means that GWT will now make requests to /com.mycompany.project.
Alternate/MySQLConnection and thus the url pattern should be the same.

By the way, if you annotate your synchronous service interface with 
@RemoteServiceRelativePath(MySQLConnection) you can remove the above two 
lines as GWT will then set the same service entry point automatically.


-- J.

-- 
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+unsubscr...@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/groups/opt_out.


Re: GWT RPC AsyncCallBack is always failing persistently.

2013-10-31 Thread zhenliang . low
Oh! I'm sorry for the misunderstanding of which xml file to edit. I'm using 
GWT 2.5.1 thus I've to edit the web xml file instead.

However i have placed the stuff which is copied from the website and I 
assumed it is placed in between the web-app portion but it still does 
generate some errors.

com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: This 
application is out of date, please click the refresh button on your 
browser. ( Blocked attempt to access interface 
'com.mycompany.project.client.Connection', which is not implemented by 
'com.mycompany.project.server.MySQLConnection'; this is either 
misconfiguration or a hack attempt )
This was generated when I place 
/com.mycompany.project.Alternate/MySQLConnection as my url mapping 

com.google.gwt.user.client.rpc.StatusCodeException: 404 html
head
meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1/
titleError 404 NOT_FOUND/title
/head
bodyh2HTTP ERROR: 404/h2preNOT_FOUND/pre
pRequestURI=/com.mycompany.project.Alternate/MySQLConnection/ppismalla
 
href=http://jetty.mortbay.org/;Powered by 
Jetty:///a/small/i/pbr/   
br/  

while this was generated by changing the url-pattern to 
/com.mycompany.project.AlternateConnection

On Friday, November 1, 2013 1:01:34 AM UTC+8, Jens wrote:

 GWT tries to send its request to 
 /com.mycompany.project.Alternate/MySQLConnection 
 but your servlet isn't deployed at that location. 

 Check your servlet configuration in your web.xml file. 

 Maybe you should also read: 
 http://www.gwtproject.org/doc/latest/DevGuideServerCommunication.html#DevGuideImplementingServices

 -- J.


-- 
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+unsubscr...@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/groups/opt_out.


GWT RPC AsyncCallBack is always failing persistently.

2013-10-30 Thread zhenliang . low
I'm trying to retrieve data from database with GWT and RPC. 

public class MySQLConnection extends RemoteServiceServlet implements 
 Connection{

 private Connection conn = null;

 private ResultSet rs = null;

 private PreparedStatement pstmt = null;

  public static Connection getConnection() throws Exception {

 String driver = com.mysql.jdbc.Driver;

 String url = jdbc:mysql://localhost:3306/temperature;

 String username = root;

 String password = 123456;

 Class.forName(driver);

 Connection conn = DriverManager.getConnection(url, username, password);

 return conn;

   }

  public String[] sensor() throws Exception{

 String [] user = null;

 try {

   conn = getConnection();

   String query = SELECT ID, times FROM sensor ORDER BY id DESC LIMIT 
 1;;


   pstmt = conn.prepareStatement(query); // create a statement

   pstmt.setInt(1, 1001); // set input parameter

   rs = pstmt.executeQuery();

   // extract data from the ResultSet

   while (rs.next()) {

 user = new String[] {rs.getString(1),rs.getString(2)};

   }

 } catch(SQLException e) {

   e.printStackTrace();

 } finally {

   try {

 rs.close();

 pstmt.close();

 conn.close();

   } catch (SQLException e) {

 e.printStackTrace();

   }

 }

 return user;

 }

  public String[] sensors() throws Exception{

 return sensor();

 }


This is the server side programming where I would return 2 parameters to 
the client side which will then be shown in the web application. However it 
is always unsuccessful as it is always onFailure that is occuring.

btnNewButton.addClickListener(new ClickListener() {
public void onClick(Widget event) {
 ConnectionAsync Abra =(ConnectionAsync) GWT.create(Connection.class);
ServiceDefTarget target = (ServiceDefTarget) Abra;
String moduleRelativeURL = GWT.getModuleBaseURL() + MySQLConnection;
target.setServiceEntryPoint(moduleRelativeURL);
 AsyncCallback callback = new AsyncCallback(){
 public void onSuccess (Object result){
textbox2.setText((String)result);
Hi.setText(You Pass!);
}
public void onFailure(Throwable caught) {
Hi.setText(You fail!);
}
};
Abra.sensors(callback);
}
});

This is my program on the client side.

Hope if anyone would help me with this
With Regards,
Zhen Liang
 

-- 
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+unsubscr...@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/groups/opt_out.


Re: GWT RPC AsyncCallBack is always failing persistently.

2013-10-30 Thread Jens
And what does the exception in onFailure say?

-- J.

-- 
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+unsubscr...@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/groups/opt_out.