Monday 3 November 2014

Spring MVC + Google App Engine + Deployment

Spring MVC Integration with Goggle App Engine and its deployment.

Pre-Requisites:
1)Eclipse 4.3
2)JDK 1.7


1)Install Google Plugin for Eclipse =
  click “Help” –> “Install New Software…“, copy and paste following URL
  http://dl.google.com/eclipse/plugin/4.3

  Select “Google Plugin for Eclipse (required), and Google App Engine SDK for Java.

  Eclipse prompts you to restart once installation finish.

  After Restart ,A small Google icon is available in the Eclipse toolbar.'g'

2)In Eclipse toolbar, click on the Google icon, and select “New Web Application Project…”
Deselect the “Google Web ToolKit“, and link your GAE Java SDK via the “configure SDK” link.
Click finished, Google Plugin for Eclipse will generate a sample project automatically.

3)Right click on the project and run as “Web Application“.
  Access URL http://localhost:8888/, see output

4)Deploy to Google App Engine
  Register an account on https://appengine.google.com/, and create an application ID for your web application
  and put it in appengine-web.xml.

5)Click on GAE deploy button on the toolbar.
6)Sign in with your Google account and click on the Deploy button.
7)Done :)

Now Integration of Spring MVC project with Google App Engine

1)Create sample 'Spring MVC Project'(Better install "Spring tool suite") with some package ie. com.sat.first
2)Create 'Web Application project' same as above.(keep package name same as com.sat.first)
3)Copy 'appengine-web.xml' and logging.properties from 'WAP' to 'Spring project location' -> \WEB_INF\
4)Right Click on project google-> App Engine Setting select as Use Google App Engine
5)Go to 'Web Application select the 'Tick' Box.
6)Press 'OK'

Now Run As-> Web Application and check the URL in Browser.

If Eclipse creates problem then go to Eclipse Installation DIR
and Edit Ecilpse.ini and paste vm arguments as:
-vm
C:\Program Files\Java\jdk1.7.0_40\bin
just below 'openFile'.

and restart eclipse again.

Now go to projeect dir and copy 'E:\Eclipse_GAE\workspace\FirstApp_Spring\target\first-1.0.0-BUILD-SNAPSHOT'

Rigt Click on the project and select 'Run\Debug Setting'.
Edit the configuration. Select Arguments Tab then paste copied above with space i.e:
--port=8888 E:\Eclipse_GAE\workspace\FirstApp_Spring\target\first-1.0.0-BUILD-SNAPSHOT

and save with 'OK'

Now run Web Application project then deploy at google App Enngine.

2) Now 'Maven Clean' and 'Maven Install' to create War file.
3) WAR file should be present

Useful Links:
http://www.mkyong.com/google-app-engine/google-app-engine-hello-world-example-using-eclipse
http://www.mkyong.com/google-app-engine/how-to-install-google-plugin-for-eclipse/
https://www.youtube.com/watch?v=i_vK6U24vsE

No comments:

Post a Comment