Activator Play Framework with google app engine - java

I am wanting to develop a GAE application. However, I have used the play framework before and very much liked its layout. I was wondering whether the latest version (2.3 I think) works with Google App Engine? I have seen posts about this before. Some say it is not possible; I've seen a github project on porting the code over but no one has ever commented on the success of the project. I am concerned about losing efficiency/too much functionality.
Can it be done?
If not, any suggestions on frameworks (I know I am not really supposed to ask this second question on stackoverflow).

Have a look at this repo which enables you to package your Play app in a war that you can deploy onto GAE.
But you should consider the trade-offs before doing this. Play was designed to be stateless/Asynchronous and GAE runs on Java Servlet Spec. This means (generally):-
your Play app will not be truly asynchronous on GAE
you may reduce performance a bit because you are running in servlet container on GAE (depending on your app though you may not even be able to measure this so I wouldn't worry too much about it)
I have personally found that deploying my Play apps into Digital Ocean (I use Docker but you don;t have to) work really well for me. I have used GAE in the past but I wouldn't deploy a Play app there for the reasons stated above. Heroku is a nice alternative but gets a bit costly if you need to scale out.

I got Playframework to work on Goole App Engine (Flexible, Custom runtimes). It involves writing our own Docker image. The integration isn't seamless (e.g. default credential doesn't work, so we have to use a JSON credential).
See: http://tanin.nanakorn.com/blogs/345

Related

Easiest web development method from Java perspective?

I have always been a front-end Java programmer, sometimes had to do C# on .NET but for the most part, Java is probably all I know about.
Just currently I have to do a small-scale website doing extremely simple thing and I really don't know where to start. My HTML skill is probably as good as I am with XML on Android, which is fair to say far less complicated than the HTML source code modern website have. I have almost no experience with PHP either, and no strong background on building or managing a database.
Is there some sort of technology that builds fully working website using mainly Java? It may have other languages I have to familiarize with but for the most part, I'd like to have little learning curve. For the backend I'm very sure I'm going to use cloud server services like Azure or Parse.
This is a very special project of me so I can't let anyone code it rather than me and myself only. Thank you and have a good day.
Use Servlets and JSPs for web development it's a start point and then java webservices as you already know XML.
I suggest you to build all your front-end using the following set of technologies: HTML5, AngularJS, JQuery, javascript, bootstrap. Your backend could exchange json with the front-end. The Bootstrap is the base for all your website and you could get a free template from the web itself, which would severely reduce your hard work at web designing. You would need just to adapt the links and calls, and the AngularJS would handle the controller and other stuffs ( have a chance to learn about ). Some JQuery components, or even AngularJS components would enhance your system usability and combined with javascript would bring most of hard work to front-end. I had the chance do start a system from zero and this is what I did, and now I have an AngularJS app working together with java by having java on the backend ( spring, hibernate, etc ) receiving and providing json data. At github you find some angularjs seed examples which you could use in your app and, again, save time and effort.
My apologies in advance, My answer is a bit broader in scope,
The Best Development Model for developing any website regardless of your language choice in Azure App Service is to take advantage two powerful features offered by Azure App Service, the Continuous Deployment feature and Deployment slots.
Start your website on a git repository and you may have node modules or bower packages, but on build your git will crunch it down to a working website with proper gulp files. Check out this blog to understand the process.
Once you have the git repo working for a simple website, your development process becomes much smoother. You can commit a change and Continuous deployment will automatically start a deployment for you to get your latest bits into your web app.. Check this blog for more details on Continuous Deployment.
You can use deployment slots to stage your changes and swap to maintain multiple versions of your web app on the cloud to easily build a production level application that has a last known good state. Check this blog for more details on Deployment slots.
The two features are the most used features while developing, deploying and servicing any project I work and I have found them very useful to understand them and use them in all their glory.
I am not a Java developer, but from the your question I can see you are looking to start on web development, the quick and powerful way (purely subjective here :D) is to use Asp.Net 5 with Angular 2 Beta. Here is an end to end tutorial on how to setup a development environment. Asp.Net 5 should be friendly toward Java developers as it is very light weight and simple to use and works great with vscode and visual studio community edition.
Let me know if the long answer helped, if you need a pure java environment that should be possible too :).

How do you develop/deploy BIG enterprise applications in java

I've been using java + spring on tomcat for the past 2 years and my app is getting notably huge. Start up time is now almost 3 minutes and it consumes a lot of resources during the development.
So I am interested in ideas how to make developing a software fun again. I've looked at Spring DM/Gemini blueprint to make it a modular but the experience was not convenient.
Now more modules are about to be added, thinking about developing it another web application and use Spring integration for messaging. Apparently, this will be a very painful experience to develop it on one desktop computer.
Has anybody any experience with cloud development? How do I improve all these time and resource consuming tasks? Will developing in the cloud help me?
It is very common problem with typical java+spring web apps. With age they start getting bloated and Context Loading starts becoming painful. I can suggest a few pointers to mitigate the issue, but only you will be able to judge best for you depending on the what exactly goes in your app.
Don't depend heavily on server while doing development. Write Unit tests and run them outside the servlet container. Spring has excellent support for this.
Split you business logic in Rest/Soap web-services (judiciously and carefully). This gives you freedom of developing and testing the UI independent of core business logic.
If using maven/gradle, try jetty plugin. It can keep scanning for changes and reloads the webapp automatically (I think tomcat plugin can do the same). It has ability to store session between restarts, so you are not affected by restarts. Please see this for more details How can I speed up Maven and Netbeans
[Paid Option] may try JRebel.
Use CI server, that keeps on integrating/testing/deploying your app, taking some load off your developers machines.
First, take care of the bottlenecks. They have a tendency to creep into projects as they grow. The original design has been compromised again and again to meet insane deadlines and now bloat has killed a once lively application.
Do not guess at the problem but use real data to determine what is making you app slow. Use a profiler such as jProfiler: http://www.ej-technologies.com/products/jprofiler/overview.html
Next, use what you've learned to make the new modules more efficient. The bottom line is changing technology is not a fix all, as all technologies can present bottlenecks. You must find the reason behind the problem and fix that.
Once you fix the bottlenecks, you could create some test projects on a new technology to see if it is faster, easier, does what you need. But, chances are just fixing the problems on your current stack is all that is needed.

advantages of play framework for people coming from php / ruby / python

One of the strongest selling points of play framework is it's development cycle, just fix the code, go back to your browse, hit reload, and go one, all without the write, compile, deploy, hassle typical of j2ee web development.
Nevertheless, for web developers coming from php, ruby or python this is hardly surprissing, moreover it's considered the natural way to develop web apps.
Moreover, many of the advantages of play, (efficient template system, resolve errors quickly, stateless, fun & productive) are taken for granted in those frameworks...
So I'd like to know what do you think are the main advatages that play framework brings to web developer coming from dynamic languages.
From my point of view these are the main advantages
it's java, so if you don't feel confortable with java, and you are not willing to learn it, that might not be an advantage. On the other hand, if you HAVE to use java, coming from php or rails you will feel right at home with play
it's static (except for templates and routes, that's about to change on the next version), so you have compiler checks and safe refactoring.
tool support: IDE support (eclipse, intellij, netbeans)
endless collection of libraries to do everything you want, well, it's just java
runs on the jvm, which has years of experience and optimizations
it's compiled, so you may expect better performance
it's really fullstack: it comes with everything you need to develop a web app, compiler, web server, in memory db server, offline documentation, integrated database manager, local and distributed cache management, fixtures, evolutions, dependency management, lots of utility libraries, unit tests, selenium tests, ide support. You need no apache or mysql setup to get up and running
it has advanced features, like asynchronous requests, web sockets, asynchronous jobs
zero development environment setup: just unzip play.zip, play new my app, play run myapp
excellent documentation
great and fast growing community
scala is firmly in it's horizon, if you come from a dynamic language you might feel more comfortable with a language like scala, even though it's static
can be deployed to any servlet container, like tomcat, but also comes with it's own lightweight server
it's got an ever growing collection of community contributed modules
it's cloud friendly, works on gae, heroku, playapps, cloudbee, dotcloud, etc... (see this question)
source code: this is one of it's main advantages, even though it's often neglected. The source code is pretty readable, understandable and not over engineered. Even without much java knowledge, it's possible to have a look at the code, understand it, and begin contributing to the project
In my particular case, coming from a php & classic asp background, play allowed me get a web application up and running while learning java at the same time. it really let me enjoy my transition from dynamic languages to java...
Play has some advantages compared to other dynamic web frameworks, but I think that if you are proficient in codeignter, rails, django, etc, and if you are not willing to benefit from java's (or scala) ecosystem, you should stick to what you know...
A similar debate has been running on Google Groups recently, but more specifically comparing Play and Ruby (on Rails). I have tried to collate some of the feedback the community has provided on this topic, rather than just give me personal view. Hopefully this will make for a more rounded answer!
statically types business logic layer (and using the new templating engine, even your views will be statically typed). This has therefore the advantage of better IDE support as well.
Can use Java as well as Scala, so you are not restricted to a single technology stack.
Play just works out of the box, but is also highly configurable, so does not force you to work in a particular method.
In memory DB. Great for new developers, who just want to get started. No need to go through setting up WAMP/LAMP server etc, just to get started. Just download play, and you are ready to go!
Its Java (or Scala)! I got hooked on Play because I used PHP begrudgingly because it was the easiest way to host a personal website, but hated that I was building software in a way that I did not feel was well structured. Play allowed me to use Java without the bulk of a J2EE application.
Play framework. Play is heavily inspired by Ruby on Rails and Django. A developer familiar with any of these frameworks will feel at home.
1) Play leverages the power of Java to build web applications,By lifting away the Java EE constraints, Play provides developers with an easy-to-develop and elegant stack aimed at productivity.
2) It focuses on developer productivity and targets RESTful architectures. Play is a perfect companion to agile software development.
3) Folder structure of the play mostly match with the Rails.
4) Play loads the code dynamically. Just fix the bug in Java file and hit reload, the change will get reflected instantly on webpage. No need to go through those sluggish rebuild / deployment / server restart.
5) No configuration: No configuration required just download, unpack and start development.
6) Error discovery is very easy, When an error occurs, play shows the error message, the file path, line number, and relevant code snippet right in the browser.

Beginning Google App Engine Java - Which Framework to start with?

I am new to both JAVA and Google App Engine. My Interest in Java stems from its compiled nature, speed and widespread enterprise use, whereas my interest in app engine is mainly because of it's initial free nature along with scalalbility.
I have been through Google's Getting Started and FAQ, I have modified the guestbook app and generally played around with the datastore, creating a simple entry system for use at work, using database schemas similar to the guestbook app. I come from a hackish PHP background, and most of my app consists of JSP pages with HTML and scriptlets mixed, with classes for the datastore stuff.
I have read about JSP, JSTL & JSF(not much) and also the basics of appengine, it's limitations,strengths and quotas. I also understand that my current approach is flawed. I have searched for JAVA frameworks and found one too many. I have been through the Will it play in App Engine list, but I do no half of the stuff mentioned there. I understand that webapp(used in the overview) is a framework and so is GWT. I understand I have to learn core java first.
What framework should I begin with which is easy to use and also robust/secure enough to handle a financial app? The framework should also have value, if I were to host it in a pure J2EE environment independent of App Engine.
I would appreciate a word on study resources too. Currently I see this book on amazon as a resource but are there cheaper alternatives like a library with a monthly subscription from where I can peruse similar books.(and I know that Google is a real good resource.)
Are there any developers here who have apps hosted on appengine java and would like to share their personal experience of appengine java with a beginner?
I use Eclipse with the Google App Engine plugin to develop and upload my apps.
Regardless of what you want to do in Java you absolutely need to learn your way around the core language and the basic part of the runtime library.
The Java Tutorial covers this and is pretty straightforward.
Then you need to learn the Servlet API which underlies almost all Java-based web solutions today. Sun puts this in the full Java EE tutorial (which is a bit heavy) so have a look at this quick overview.
When you have gotten so far, you have a much better idea of what your basic toolbox is, and can give information allowing to give better advice on what technologies you should choose.
Sorry for the steep learning curve, but the view on top is fantastic.
If you aren't doing Java development currently, and/or haven't done much web development. I definitely wouldn't complicate things with adding frameworks.
What are you trying to accomplish that you need a framework for outside of the Google App Engine stack?
I've been developing with Java for years and only started using Spring with my Google App Engine app because I need a good security and authentication option. I wish I didn't have to use it since it's a rather steep learning curve.
You should be able to do most everything you need to for a simple app with JSP. If done correctly you can even do it in MVC if you wish.
On top of everything else people have recommended, I suggest you take a look at Objectify, a much simpler datastore API than the JDO/JPA ones included in the App Engine SDK.
This is, of course, after you've gotten familiar with the core of Java first.

RESTful application on Google App Engine Java?

I would like to create a RESTful app on Google App Engine. I would like to provide XML and JSON services. I have briefly experimented with Restlet, Resteasy, and Jersey. I haven't had much success with any of them, other than some simple examples in Restlet.
Could you share your experiences creating a Restful web application on Google App Engine using Java or provide any insight on the aforementioned toolkits on GAE?
Thanks!
Edit (2009-07-25):
I have decided to use Restlet for the time being. It seems to work flawlessly so far. Please post any other insights/opinions you may have. What problems have you encountered? Have you successfully used Jersey/Restlet/Resteasy on GAE/J? If so, we want to hear about it!
I'm happy to report that Restlet M3 works FLAWLESSLY on AppEngine 1.2.2. I have followed the "First steps" and "First resource" tutorials found http://restlet.com/technical-resources/restlet-framework/guide.
So, it seems to me that Restlet is the answer for your GAE/J Restful applications.
I'm using Jersey on GAE. Here is the link for those who are interested about setting it up: (I'm using GAE SDK v1.4.0):
http://tugdualgrall.blogspot.com/2010/02/create-and-deploy-jax-rs-rest-service.html
I am going to begin exploring this as well, but haven't started yet. I did find this framework, that says it should work, but like I said haven't tried it yet.
http://wiki.restlet.org/docs_1.2/13-restlet/275-restlet/252-restlet.html
If you get it working, or manage to get one of the above suggestions working, update everyone as I am sure there is interest in this.
I'm using Restlet together with Guice on Google AppEngine. IMHO they fit together very well. See my recent blog post for further details: http://haraldpehl.blogspot.com/2009/11/google-appengine-restlet.html
Since these valiant older solutions were patched together, Google has apparently supplied an Eclipse plugin to create a starter project that produces an App Engine app, an Android APK, and a Web app, all talking to one another over an interface defined by a single set of annotated object declarations.
Haven't tried this yet myself, but do have a look before trying any of the more heterogeneous examples described in the earlier messages above:
https://developers.google.com/eclipse/docs/appengine_connected_android
This Google video is also quite informative:
http://www.youtube.com/watch?v=NU_wNR_UUn4
For what it's worth, there has been quite a bit of discussion on Jersey user lists wrt how to make Jersey work on GAE. It is bit tedious work due to GAE restrictions (missing classes from white lists -- hopefully resolved over time), but apparently can be made to work.
So while not trivially easy, that might be your best bet; esp. since many of the problems faced are the same for all frameworks (imposed by GAE).
Well, I would highly advice you to have a look at play framework
Have a look at the video on the homepage
It has a gae module
With siena as a orm to handle gae datastore
From all the java frameworks I've seen so far, I think it has the easier learning curve,
great documentation,
a tutorial to develop a complete application
very active and helpfull community,
free as in beer and also as in speech
highly scalable due to it's stateless out of the box design
rest friendly
highly customizable via it's modules and plugin approach
more over, taking into account it's for a college course, it's really easy to hack into the code, I could handle a couple of tickets and new features without any experience at all with java, just a couple of year developing web applications with php
other benefits
it's really easy to start, no complicated setup involved, just download and unzip the file and your are ready
great development experience, just fix the code and hit refresh, play autocompiles changes on the fly when running on development mode
fast and lightweight
fullstack, you don't have to integrate cumbersome frameworks to make it work
great errors report, no more endless error stack trace, just shows you the line with error
no xml configuration anywhere around
great support for tdd with selenium integrated test
I think the main advantage as a learning tool, is that it's possible to peek into the source code without feeling lost and the community support... The documentation is very clear, and you can learn a lot by just having a look at the source code...
I recently put together a project template with Jersey, Guice and AppEngine at GitHub. It has been developed with SimpleDS, but it can be modified to work with Objectify / JDO easily. The project is live here.
It should be a good starting point for new projects.
Here is a very very good tutorial Restlet/Android/GAE/Objectify with an example of a simple application. Sorry it's in french, but you can juste copy/paste the code, or use google traduction.
I followed it and had a working Android / GAE server communicating together in a 2 hours. It's a good base to start or test Restlet.
http://www.tutos-android.com/webservice-rest-android-appengine-restlet-objectify
Good Luck
The 2 most cumbersome GAE REST API actions to make work, whether Java or .py, are graphics and how to undisplay private information. My little gae rest feed forked another project. I'm sure Java succeeds where python stuck due to the Java takes and gives more ways (advantages) as well as longer (slower) time to succeed (disadvantage) while python projects opens less ways to succeed (disadvantageous) and less development time (advantageous rapid development) to succeed the same.

Categories

Resources