Pages

2015/02/17

How to create Google App Engine eclipse project with frontend module and backend module

In this article, i will create a Google App Engine eclipse project support frontend module and backend module.
Why i doing this, because GAE console keep annoying me whit this.

"This application uses Backends, a deprecated feature that has been replaced by Modules, which offers additional functionality. Please convert your backends to modules as described at: Python | Java | Go"

Step1:Prepare eclipse environment
Switch eclipse to Java EE perspective.


Step2:Create new Enterprise Application Project

Setting Project name and target runtime.


Select existed modules.


Setting Google App engine Application ID.


You may has this error message after create a new project.
"vc-complex-type.2.4.b: The content of element 'application' is not complete. One of '{"http://java.sun.com/xml/ns/javaee":display-name, "http://java.sun.com/xml/ns/javaee":icon, "http://java.sun.com/xml/ns/javaee":module}' is expected."


Change the xsi:schemaLocation content from
 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
       http://java.sun.com/xml/ns/javaee/application_5.xsd">


To
 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee;
                     http://java.sun.com/xml/ns/javaee/application_5.xsd">



Step3:Create new Dynamic Web Project for frontend default module

Setting Project name and add this project to EAR project.


Setting source folder.


Configure web module setting. Set the Context root as "default", because GAE need a default front module name as "default".


Configure Google App Engine. Again, GAE needs a module named "default".


The default frontend module is created.


Step4:Create new Dynamic Web Project for backend module

Setting Project name and add this project to EAR project.


Setting source folder.


Configure web module setting.


Configure Google App Engine.


The modules are created.




Modify the GAEJModuleBackend/WebContent/WEB-INF/appengine-web.xml to support the backend instance.
 
 

  gaejmoduletest
  backend
  2
 true

  
  B1
  
    11
    10m
  
  
  
  
    
  

Create background threads to run the instance in backend.We modify the GAEJModuleBackendServlet.java.
public class GAEJModuleBackendServlet extends HttpServlet 
{
 public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException 
 {
  Thread thread = ThreadManager.createBackgroundThread(
  new Runnable() 
  {
   public void run() 
   {
    try 
    {
     Thread.sleep(10);
    } 
    catch (InterruptedException ex) 
    {
     throw new RuntimeException("Exception:", ex);
    }
   }
  });
  thread.start();
 }
}


Step4:Setting remote server

Click the link to create remote server.


Define a new server.


Configure server.


Add server.


We created a App Engine localhost server.


Step5:Uploading to Google App Engine

12 comments:

  1. Great day! I might have sworn I've visited this site before however in the wake of perusing a considerable lot of the posts I understood it's unfamiliar to me. In any case, I'm unquestionably cheerful I found it and I'll be bookmarking it and returning frequently!best interiors

    ReplyDelete
  2. I think I have never seen such blogs ever before that has complete things with all details which I want. So kindly update this ever for us. 안전공원

    ReplyDelete
  3. That appears to be excellent however i am still not too sure that I like it. At any rate will look far more into it and decide personally! 메이저놀이터

    ReplyDelete
  4. Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. There tend to be not many people who can certainly write not so simple posts that artistically. Continue the nice writing สล็อตNi Shu Shen Me

    ReplyDelete
  5. Howdy! I simply wish to offer you a huge thumbs up for the excellent information you have got here
    on this post. I’ll be coming back to바다이야기
    your site for more
    soon.

    ReplyDelete
  6. 바카라사이트
    This is my site It has been a great help to my site. This is similar to my site. That's good info. One of the most effective blogs on the internet. Nice to meet someone with an original idea on this topic. Thanks though. Please visit my site here and give us your opinion.

    ReplyDelete
  7. They're additionally given a role as heels, supposedly made because of the McMahon family's conviction that the extreme right cost Linda the race. A label fight between these two appears to be a characteristic fit, with Darren Young give a role as the hero. business benchmarks

    ReplyDelete
  8. Thanks for sharing nice information with us. I like your post and all you share with us is up to date and quite informative, I would like to bookmark the page so I can come here again to read you, as you have done a wonderful job. situs dominoqq

    ReplyDelete