Friday, November 9, 2007

GWT hosting

Tomcat hosting that works great with GWT
After searching for some time I have finally started a hosting account with a Tomcat + Java provider that will allow for GWT Java hosting.

Mochahost offers Tomcat hosting at different levels depending on your needs. I have setup my account using their JSP/Tomcat hosting from $2.95/month. For the types of GWT applications that I would like to host these are some of the key items I need:
  • Ability to restart Tomcat instance. This is necessary when you add shared libraries or if you make any changes to your Tomcat configuration files.
  • Ability to also host a database. Mochahost offers unlimited MySQL databases with this plan. You can modify the Tomcat context.xml file and add any JDBC resources that your application requires.
  • Complete control over my Tomcat instance including, selection of the Tomcat version I want to run, ability to map any domain name to my Tomcat instance, and the ability to define the JVM for my tomcat instance.
How NGASI AppServer Manager can make your life easier
I really love the NGASI AppServer Manager. This is the tool that you use to select your JVM version, Tomcat Version, and map your entire domain to Tomcat or you can use path mapping.

To keep things simple I have chosen to do a complete domain wildcard mapping. Now I can deploy individual GWT apps under gwt.mynumnum.com/* and they will be available without any additional mapping needed. My Tomcat instance is available at http://gwt.mynumnum.com where I can login to Tomcat and use the Tomcat deplorer to deploy my GWT war file. Once the application is deployed it is available on the web.

What can you do with Tomcat Hosting and GWT?
Currently I only have one application deployed. My application is an Eight Queens solution. My GWT application is here: http://gwt.mynumnum.com/EightQueens

The application is still very rough around the edges, and I will continue to makes changes. Basically it uses the same java code on the client and server to demonstrate that Java code can be compiled un-modified and run either in your browser or on a Tomcat server. Just for fun it also tracks how long your browser takes to complete all 92 solutions to the puzzle. You can display last 10 runs or top 10 runs based on Javascript speed. Google Chrome is currently the leader due to its super fast Javascript engine.

21 comments:

George Dawoud said...

are you still happy with mochahost? Looking for a good tomcat host...

Jim said...

Overall I am still happy with Mochahost. I have had other hosting (non-Java) with Bluehost and npsis in the past. Mochahost has responded very quickly to my concerns, and performance is very good. I researched for many months before finally deciding to give Mochahost a try. I would rather host it myself, but internet were I live is very hard to get beyond dial-up.
At work I use Windows server, IIS and Tomcat for hosting several GWT applications with great success.

Zoltán said...

HI!

I am just a newbie to gwt, writing a program, got to a point to deploy it somewhere....but having some difficulties.
Could you help me on how to deploy stuff on mochahost site.. to have it running.

I know it is stupid.. asking like this... I hope though that you could point out some very easy solution to this,

Jim said...

Just a few days ago I canceled my hosting package with mochahost. I am now using the google app engine to host my GWT apps. There are several tutorials on the web that explain how to create and deploy your app using the app engine.

Zoltán said...

Thanks. Eventually I have succeeded.

Unknown said...
This comment has been removed by the author.
Unknown said...

Dear Zoltan

I hve been trying to host my site (written using GWT ) on mochahost for the past 1 week, however it does not work as it is not able to find the servlet.

can you point out some material on how to do that.

the app work perfectly fine on my local machine

i spoke to Mochahost support but could not get any solution from them
Much Appreciated

Zoltán said...

Hej!

Frankly, I don't remember. I was satified with mochahost.. but my friend got a virtual server so, I moved my stuff there.

Perhaps the whole stuff has to be copied to the web-inf folder.

And one more thing... any call that you do, to servlets, has to include the "servlet" or something similar.. they mention it somewhere.... but you have to include it in your web.xml file .

Hope it as a help for you.

z.

Unknown said...

Hi,

thanks for a quick response, i tried searching for the example/documentation/manual all over the net but am unable to find any reference point on it.

i tried putting /servlet/xxx and also /domain/servlet/xxx also in the web.xml sevlet mapping but :(

i keep getting

File does not exist: /home/domain/public_html/recipes/greet

if not asking for too much can you please point me to the reference material !

I am getting bonkers right now.

~V

Zoltán said...

First of all I don't remember exactly how it was.

however:
- there is a disclaimer, that your path of rpc call has to include the /servlet/ to be treated as rpc call.

So you have to set it up. so.. in the class it will look like this, or similar like this.:

@RemoteServiceRelativePath("../servlet/clientDataService")
public interface WebClientDataService extends RemoteService {

than the mappig would be something like this:


webClientDataServiceImpl
com.google.gwt.backbone.server.WebClientDataServiceImpl



webClientDataServiceImpl
/servlet/clientDataService


this was for rpc calls.

For servlets it is the same:


UploadCustomerHistoryFile
com.google.gwt.backbone.server.formsubmit.UploadCustomerHistoryFile


UploadCustomerHistoryFile
/servlet/uploadCustomerHistoryFile



So the servlet has to be there in the mapping, otherwise it will not get there ever.

And the deploying would be.. you have to copy the web-inf folder.
And after you copied it, try the "restart" button.

One more thing, if you manage to do it, please post here a comment with the complete description.

If you need more help, let me know.

Zoltán said...

The tags did not go through, hope they will now:

the mapping:

1st:
<servlet>
<servlet-name>webClientDataServiceImpl</servlet-name>
<servlet-class>com.google.gwt.backbone.server.WebClientDataServiceImpl</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>webClientDataServiceImpl</servlet-name>
<url-pattern>/servlet/clientDataService</url-pattern>
</servlet-mapping>


2nd:
<servlet>
<servlet-name>UploadCustomerHistoryFile</servlet-name>
<servlet-class>com.google.gwt.backbone.server.formsubmit.UploadCustomerHistoryFile</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>UploadCustomerHistoryFile</servlet-name>
<url-pattern>/servlet/uploadCustomerHistoryFile</url-pattern>
</servlet-mapping>

Jim said...

I don't have a Mochahost account any longer so I cannot remember exactly what I did.

It seems like I mapped my tomcat instance to a URL. Any requests to a folder like public_html seems like it would be trying to access files via Apache or IIS (and not your tomcat instance).

Joshi said...

@Zoltan:
I am also new to gwt. I was trying to host GWT application on a domain. My servlet mappings are also not working. I get a 404 error. Could you please post how you resolved your issue. Thanks.

Jonathan L. Elano said...

Nice Idea! Anywy, Even without their discounts www.jvmhost.com seems to be the cheapest Java provider on the market.

Jim said...

Thanks for the comment on jvmhost. Are you using them to host your projects?

Zoltán said...

Hey!

When I was using them, I had to include "/servlet/" in the path of the rpc call.

please check my post above.

Jonathan L. Elano said...

Zoltan should be a cool genius guy... Am right guys...
Mikrowelle

Jonathan L. Elano said...

I have not yet encountered mochahost. I am more familiar with the daily razor. And, we are happy and satisfied with this java provider. In fact, its almost one year already since we started it. hcg, hcg drops, hcg diet drops

Anonymous said...

www.jvmhost.com is only offering dedicated JVMs (64MB+ heap) and custom JVM/appserver control panel. You can try it with demo or when ordering a full featured trial account.

rnglbd said...

mocha is not that cheap if we're talking about private tomcat instance and can be only considered with 2-3 years plans as it include some discounts. JVM Host is not that cheap either, it's almost $8 for 64 MB heap size. Personally I'm hosting my apps with gojava.net on private tomcat (7 on java 7) with 128 MB heap, cpanel, custom java hosting control panel where I can check tomcat logs and restart tomcat with 2 clicks, and that cost me less than $8/month. Theirs control panel is very similar to the one from JVM host :)

Alefon said...

Do not use Mochahost .. I have worked with them for 4 years ago .. poor technical support,delaying replay, server went down many times WITHOUT a reason .. even without apology on that .. and when it comes to money they have no problem to kick your ass, and loose you rather than giving you back a compensation .. its cheap so just use it for testing .. but as production server hosting provider .. I personally * strongly against