I've build a RESTFul Service with Play 2.4 Scala2.11, now I want to deploy this to IBM Bluemix.
play2-war-plugin was used to package the project to a war package since Bluemix use Liberty as container.
But when I push the war package to Bluemix, I got error logs:
[ERROR ] SRVE0918E: The attempted blocking write is not allowed because the non-blocking I/O has already been started by the application registering the WriteListener [play.core.server.servlet31.Play2Servlet31RequestHandler$ResultWriteListener#d2487ee8].
I want to knwo:
Can Scala based PlayFramework project be deployed to IBM Bluemix?
Are there some better ways to package Play project to a war package?
In my circumstances, what can I do to confirm whether this ERROR caused by my codes or caused by the play2-war-plugin.
You don't need to package your Play Framework application in a war file in order to deploy it to Bluemix.
Simply build your application using play dist or activator dist and then use the java_buildpack to deploy it. For example:
$ cf push play-application -p target/universal/play-application-1.0-SNAPSHOT.zip -b java_buildpack
You can see Java buildpack documentation for Play Framework here:
https://github.com/cloudfoundry/java-buildpack/blob/master/docs/example-play_framework.md
Just for people (like me) coming to this page now. Alex de Silva's answer works great but needs some update:
Instead of the command play or activator use sbt The sbt dist or sbt stage command are described here. If you use play it won't work at all & in the case of activator--which is outdated--it will fail with some "can't find dependency" errors. Make sure you have latest version of sbt installed.
The same instructions apply in any sbt-based Scala application, not just Play Framework. You just have to be sure you have the sbt-native-packager plugin set up properly in your sbt build.
Related
I have gwt 2.7 project that i develop with eclipse.
from 1.9.20 I not success to deploy project to google app engine
I deploy the project with old gwt plugin in eclipse
when the deploy finished I get error
Unable to update:
java.lang.RuntimeException: Fatal problem encountered during deployment. Please refer to the
logs for more information.
at com.google.appengine.tools.admin.AppVersionUpload.isServing(AppVersionUpload.java:1051)
at com.google.appengine.tools.admin.AppVersionUpload.access$200(AppVersionUpload.java:43)
at com.google.appengine.tools.admin.AppVersionUpload$2.call(AppVersionUpload.java:884)
at com.google.appengine.tools.admin.AppVersionUpload$2.call(AppVersionUpload.java:881)
at com.google.appengine.tools.admin.AppVersionUpload$3.call(AppVersionUpload.java:1188)
at com.google.appengine.tools.admin.AppVersionUpload$3.call(AppVersionUpload.java:1185)
at com.google.appengine.tools.admin.AppVersionUpload.retryWithBackoffOptional(AppVersionUpload.java:1213)
at com.google.appengine.tools.admin.AppVersionUpload.retryWithBackoff(AppVersionUpload.java:1183)
at com.google.appengine.tools.admin.AppVersionUpload.commit(AppVersionUpload.java:881)
at com.google.appengine.tools.admin.AppVersionUpload.uploadFilesTransaction(AppVersionUpload.java:223)
at com.google.appengine.tools.admin.AppVersionUpload.doUpload(AppVersionUpload.java:197)
at com.google.appengine.tools.admin.AppAdminImpl.doUpdate(AppAdminImpl.java:580)
at com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java:65)
at com.google.appengine.eclipse.core.proxy.AppEngineBridgeImpl.deploy(AppEngineBridgeImpl.java:438)
at com.google.appengine.eclipse.core.deploy.DeployProjectJob.runInWorkspace(DeployProjectJob.java:158)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
I think is related the google app engine not supported to deploy project with appcfg.
they support only deploy with gcloud but my project is not maven and i do not know how to deploy project with gcloud.
I try to convert to maven project and deploy with gcloud but when I run
mvn package appengine:deploy -Dapp.deploy.projectId=myProjectId
from commandline
I get error
path to file /BaseResourceCss.java:[3,39] package com.google.gwt.resources.client does not exist
and I get like this for all files in project
thank you everyone
Since the last August 30th the appcfg is deprecated. As you can see in the shared link, it is recommended to use the gcloud commands.
Depends on the language you are using, is the command you need to execute. Below are the examples:
For Java 8 apps, build the app first. Then deploy with:
gcloud app deploy WEB-INF/appengine.xml
For Java 11 apps, you can deploy the source code to the Java 11 runtime without building locally:
gcloud app deploy pom.xml
To deploy a Java fatjar to the Java 11 runtime:
gcloud app deploy myapp.jar
You can also use the Cloud SDK-based Maven or Gradle plugins to build and deploy Java 8 and Java 11 apps.
I am using IntelliJ IDE for the development and started the project using Play 2.x framework instead of activator:
Now I want to deploy this project to EC2-Ubuntu but to do that everyone is suggesting to install the Typesafe activator which will not work in my case.
I tried to follow the official documentation but they are also redirecting to download "play with activator". Is there any other way to deploy it instead of converting the whole project to typesafe activator?
The play has a deployment system , you need to read the documentation to prepare the project in the right way , but basically you had used the command:
`activator dist
unzip file in target/universal/file.zip
`file.sh in bin folder
`Deploy documentation
I was wondering if IntelliJ has a built in Application Server (like Tomcat) that I can use without having to download Tomcat directly?
Right now when I go to Run | Edit Configurations, Defaults, Tomcat Server, Local, it asks me to specify the Tomcat home directory.
Previously I had used myEclipse and it came packaged with a Tomcat so I would be suprised if the ultimate version of IntelliJ does not have this.
Intellij does not include built in application server. It has simple web server they refer to as Webstorm. However it is not application server.
Here is excellent resource (official docs) for working with application servers in intellij which you may find to be useful including tips on integrating it IDE via plugins etc:
Working with Application Servers
You need to download an application server manually.
Or you could use a Maven/Gradle dependency to start Tomcat programmaticly from the Main method, or a plugin for starting it via command line e.g. mvn tomcat:run.
I'm new to Angularjs and i'm trying to run first angular program with Spring. I downloaded the code from here: http://javahonk.com/spring-mvc-angularjs-integration/. Imported it as a maven project. Downloaded JSDT and AngualrJs plugin from eclipse marketplace but it's still not running. There is no error message. I'm running this on tomcat 7. What am I missing?
Any help would be appreciated?
I'm not a Eclipse user. so I have no idea for that. But you can use nodejs as a static server. it is explained here
1) Install nodejs for your OS
2) Run this command in a terminal (console)
> npm install http-server -g
3) Start server
> cd /path/to/your/project
> http-server -o --cors
Now you can access your project from browser http://localhost:8080/yourfile.html
Work in Eclipse and just refresh page on browser to see changes.
If you are working on a Spring Application within Eclipse IDE, your best alternative would be to start you appliction using an embedded Application Server (Best I would recommand are Jetty or Tomcat if you ain't need EE level components).
You can follow this link, which holds basic steps for adding a new Application Server within Eclipse IDE.
Once you have added a new application server, you can deploy your application in it then launch it and you should have your applcation reachable at http://localhost:8080/SpringMVCAngularJS.
A good alternative when using Maven as a build tool, is using an embedded AS plugin such as Tomcat7 Plugin or Jetty Plugin. This plugin will provide the ability to start your applcation using the Maven different goals (which does not require adding a new AS into Eclipse IDE).
I've pushed a sample module based on the tutorial you mentioned. YOu can test the above described plugin as follows in a *nix shell (You may need to setup git if not already done):
git clone https://github.com/tmarwen/stackoverflow-showcase.git
cd stackoverflow-showcase/springmvc-angularjs
mvn tomcat7:run
I've got a Java web application that builds with Maven. My project uses RequireJS. I use a maven plugin at build time to compress the JS artifacts (https://github.com/bringking/requirejs-maven-plugin). The plugin calls out to NodeJS (with the r.js compressor) to do the actual work.
Local builds work wonderfully.
On Heroku, however, NodeJS is not available using the Heroku Java buildpack (the default for Java/Maven applications).
For now, I run the requireJS maven plugin locally using an active Maven profile that isn't present on the Heroku server. This prevents the RequireJS plugin from running on the Heroku server. This is less than ideal because it requires me to run the plugin locally, then check in the resulting build artifact. It's far better to generate the compressed JS file at build time in the Heroku system.
I'm looking for a good solution. Thanks in advance.
The best solution is to use Heroku Multi Buildpack with the Node.js and Java buildpacks. This is described in an article using Grunt with Java and Maven but the same principles apply for Require.js.