Developing GWT App using Tomcat

83 views
Skip to first unread message

Ashwani

unread,
Sep 6, 2011, 1:14:36 AM9/6/11
to Google Web Toolkit
Hi,

I was developing simple app using embeded jetty server in GWT Designer
till i got stuck when i was connecting to mysql db.
The same code for connection works very well, if i run it as java
application. But was failing when running using embedded server.

The I decided to put the app on tomcat and then develop using it.
Now the connection works but i face issue while development:

1) The option Debug->Web Application (running on external server) does
not work. i.e break points are not hit.
2) Everytime i add code, i have re-deploy my application.

How can work properly with Tomcat as server and GWT Designer as IDE ?


Regards,
Ashwani Kr Sharma

Juan Pablo Gardella

unread,
Sep 6, 2011, 9:15:17 AM9/6/11
to google-we...@googlegroups.com
I recommend use embeded jetty server in GWT Designer. The problem with mysql connection is not related with jetty.  Can you paste the stracktrace error that you have?



2011/9/6 Ashwani <ashw....@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


Jeanpylone

unread,
Sep 6, 2011, 11:22:30 AM9/6/11
to google-we...@googlegroups.com
just remove App engine from your project (see https://groups.google.com/forum/#!msg/google-web-toolkit/j76nAJT7zgU/ylGhd8WeNBYJ)

Regards,

karim duran

unread,
Sep 6, 2011, 5:27:55 PM9/6/11
to google-we...@googlegroups.com
Hi Ashwani,

You have two parts in a GWT application :
1) Client part :
  • User interface ( panels, menus, grids, tree etc....)
  • javascript generated by the GWT compiler from your java client code
2) Server part :
  • Servlets which receive requests across RPC calls from the client
  • any logic business part for your application ( classes, packages, external java framework etc...)
So, you should have two package e.g com.myapp.client and com.myapp.server.

In Eclipse, add mysql connector reference  ( for me it's connector-java-5.1.14-bin.jar ) in your project settings, as you do for other java library.
In your server part code, connect to your database as you do in other standard J2EE application.

By proceeding like that, you ensure having a standard behaviour for your application.
You can test your applcation with your database in DEV and TEST mode.

When you deploy, the client part will be compiled in javascript to manage the UI ( DHTML scripting based ). The generated javascript will make the AJAX calls to your server part and feed your UI components as you decided in your client code.

Don't forget to put MySql connector jar, in the correct tomcat installation subfolder.( for me it's /usr/share/tomcat5.5/common/lib/mysql-connector-java-5.1.14-bin.jar ).

I'm surprised that you can't debug your code !!! It should work, you should be abble to debug your application. I think something is missing to your project settings.

I hope it helps.

Regards.

Karim Duran


2011/9/6 Ashwani <ashw....@gmail.com>

Ashwani

unread,
Sep 6, 2011, 10:21:37 PM9/6/11
to Google Web Toolkit
Thanks Karim.
I have done the same and then i am getting errors. Please refer to my
last post for more information about errors.

Regards,
Ashwani Kr Sharma

On Sep 7, 2:27 am, karim duran <karim.du...@gmail.com> wrote:
> Hi Ashwani,
>
> You have two parts in a GWT application :
> 1) Client part :
>
>    - User interface ( panels, menus, grids, tree etc....)
>    - javascript generated by the GWT compiler from your java client code
>
> 2) Server part :
>
>    - Servlets which receive requests across RPC calls from the client
>    - any logic business part for your application ( classes, packages,
>    external java framework etc...)
>
> So, you should have two package e.g com.myapp.client and com.myapp.server.
>
> In Eclipse, add mysql connector reference  ( for me it's
> connector-java-5.1.14-bin.jar ) in your project settings, as you do for
> other java library.
> In your server part code, connect to your database as you do in other
> standard J2EE application.
>
> By proceeding like that, you ensure having a standard behaviour for your
> application.
> You can test your applcation with your database in DEV and TEST mode.
>
> When you deploy, the client part will be compiled in javascript to manage
> the UI ( DHTML scripting based ). The generated javascript will make the
> AJAX calls to your server part and feed your UI components as you decided in
> your client code.
>
> Don't forget to put MySql connector jar, in the correct tomcat installation
> subfolder.( for me it's
> /usr/share/tomcat5.5/common/lib/mysql-connector-java-5.1.14-bin.jar ).
>
> I'm surprised that you can't debug your code !!! It should work, you should
> be abble to debug your application. I think something is missing to your
> project settings.
>
> I hope it helps.
>
> Regards.
>
> Karim Duran
>
> 2011/9/6 Ashwani <ashw.ku...@gmail.com>
>
>
>
>
>
>
>
> > Hi,
>
> > I was developing simple app using embeded jetty server in GWT Designer
> > till i got stuck when i was connecting to mysql db.
> > The same code for connection works very well, if i run it as java
> > application. But was failing when running using embedded server.
>
> > The I decided to put the app on tomcat and then develop using it.
> > Now the connection works but i face issue while development:
>
> > 1) The option Debug->Web Application (running on external server) does
> > not work. i.e break points are not hit.
> > 2) Everytime i add code, i have re-deploy my application.
>
> > How can work properly with Tomcat as server and GWT Designer as IDE ?
>
> > Regards,
> > Ashwani Kr Sharma
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.> To post to this group, send email togoogle-w...@googlegroups.com.

Ashwani

unread,
Sep 6, 2011, 10:19:52 PM9/6/11
to Google Web Toolkit
Hi,

For Option 1: I tried to remove the app engine by doing following
steps:
1) In project -> properties go to Google->App Engine
2) Unselect the option Use Google App Engine

I get following error when running the Application as Web Application

Exception in thread "main" java.lang.NoSuchMethodError:
org.mortbay.thread.Timeout.<init>(Ljava/lang/Object;)V
at org.mortbay.io.nio.SelectorManager
$SelectSet.<init>(SelectorManager.java:306)
at org.mortbay.io.nio.SelectorManager.doStart(SelectorManager.java:
223)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
39)
at
org.mortbay.jetty.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:
303)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
39)
at org.mortbay.jetty.Server.doStart(Server.java:233)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
39)
at
com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:
667)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:500)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1055)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:804)
at com.google.gwt.dev.DevMode.main(DevMode.java:309)

If i use Google App Engine, i get following error when i tried to
access the DB:

java.sql.SQLException: URL is not in the correct format: jdbc:mysql://
localhost:3306/upskillingdb
at
com.google.cloud.sql.jdbc.internal.Exceptions.driverUrlNotInCorrectFormat(Exceptions.java:
103)
at com.google.cloud.sql.jdbc.Driver.connect(Driver.java:47)
at com.google.cloud.sql.jdbc.Driver.connect(Driver.java:24)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at
com.sap.upskillingmanager.server.DataBaseConnector.getConnection(DataBaseConnector.java:
54)
at
com.sap.upskillingmanager.server.DataBaseServicesImpl.addTraining(DataBaseServicesImpl.java:
17)

Any hints on how i can remove GAE from my project and use jetty server
for development ?

Thanks and Regards,
Ashwani Kr Sharma


On Sep 6, 8:22 pm, Jeanpylone <jeanpyl...@gmail.com> wrote:
> just remove App engine from your project (seehttps://groups.google.com/forum/#!msg/google-web-toolkit/j76nAJT7zgU/...
> )
>
> Regards,

dreamer

unread,
Sep 7, 2011, 12:28:14 AM9/7/11
to Google Web Toolkit
My short answer is develop in dev mode as is and deploy in any servlet
container you prefer.

If you go to debug configuration, in server tab, you only see
"embedded server" which is nothing but jetty dev mode.
In short there may not be any easy way to debug in other servers.

But you should be able to develop in DEV mode and deploy in any
servlet container.
Once you make war file, there is nothing specific to jetty.

I just have three jars in my web/lib - "gwt_servlet.jar,appengine-
api-1.0-sdk-1.5.2.jar,appengine-api-labs-1.5.2.jar" -
If you want to run on tomcat you may or may not need any of these.

Global School District
http://schoolk12.appspot.com/
Reply all
Reply to author
Forward
0 new messages