Deploying my Java Dynamic Web Project to Heroku - heroku

I've been trying to deploy a dynamic web project created in Eclipse to Heroku but I've been having a few difficulties. This project does not use a pom file/maven and does not seem to work with any of the java buildpacks that I try to use. I added a jvm buildpack and this appeared to help my project pass deployment, but when I try to open my app, I get the following error:
"Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail"
Is there a specific buildpack that I should use for this project?

Related

Heroku unable to find spring-boot-gradle-plugin:3.0.2

I've gone through the steps at the below link to create a spring boot demo app and deploy to heroku, but I am getting an exception when pushing to heroku:
https://devcenter.heroku.com/articles/deploying-spring-boot-apps-to-heroku
The short exception is:
Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.2.
Any idea what's going on?
Found the answer. The error references java 8 some lines down. It turns out heroku configures java 8 by default. To change the java version, follow the steps here:
https://devcenter.heroku.com/articles/java-support#specifying-a-java-version
Basically, add a system.properties file to your project base directory and add:
java.runtime.version=17
To configure java 17.

heroku: Deploying angular app inside spring boot app

I've one repo sunixi and it has two projects sun-angular(angular) and sun-admin(spring boot) in ts-admin i'm building ts-angular via executions and moving dist into resources/static of sun-admin project after that i'm building the sun-admin. On local enviroment it is working fine but how can i do same in heroku deployment.
structure of repo
sunixi
---sun-angular
---sun-admin
in sun-admin i'm setting workingDirectory as ../sun-angular but while deploying to heroku i'm getting
Cannot run program "npm" (in directory "/tmp/build_02607c07/sun-angular"): error=2, No such file or directory
If you are using a monorepository strategy, an option is to use subdir buildpack to select where is the path of your folder: https://github.com/timanovsky/subdir-heroku-buildpack
If you want to deploy backend and frontend in the same heroku app, the project folder should contains a npm package. Otherwise, i will not work.

Problem in deploying to IBM bluemix java/spring service

I am deploying a java spring boot application as a deployable war into an IBM bluemix environment via jenkins. I am able to build and run the service in my local environment. During the build pipeline, I am getting this. Any ideas?
Staging app and tracing logs...
Downloading liberty-for-java...
Downloaded liberty-for-java
Cell 26776ec2-6370-4ef1-8987-54aa61d8fe79 creating container for instance 1cc919a5-8e81-4c91-aa64-9b7274d7715d
Cell 26776ec2-6370-4ef1-8987-54aa61d8fe79 successfully created container for instance 1cc919a5-8e81-4c91-aa64-9b7274d7715d
Downloading app package...
Downloaded app package (2.6K)
-----> Liberty Buildpack Version: v3.44-20200430-1451
E, [2021-02-22T22:06:45.730075 #22] ERROR -- /tmp/buildpacks/fb2e823ce09e8909e2afd757be3d1971/lib/liberty_buildpack/buildpack.rb:50:in `rescue in drive_buildpack_with_logger': Compile failed with exception #<RuntimeError: No supported application type was detected>
No supported application type was detected
Failed to compile droplet: Failed to compile droplet: exit status 1
Exit status 223
Cell 26776ec2-6370-4ef1-8987-54aa61d8fe79 stopping instance 1cc919a5-8e81-4c91-aa64-9b7274d7715d
Cell 26776ec2-6370-4ef1-8987-54aa61d8fe79 destroying container for instance 1cc919a5-8e81-4c91-aa64-9b7274d7715d
Error staging application: App staging failed in the buildpack compile phase
FAILED
The error basically means the buildpack did not find an artifact it recognizes as an app it supports. The liberty buildpack recognizes wars, jars, liberty server directories and packaged servers.
The buildpack will look for an artifact in the current directory or in the directory specified with the -p CLI flag or path in the manifest.
Ensure your artifact exists where the buildpack can find it.

How to deploy and run clojurescript application in Heroku

I have a template of a clojurescript application from https://github.com/Day8/re-frame-template. So I want to deploy that template without any modifications to Heroku. So I followed the instructions on the README
lein clean lein cljsbuild once min. Then I follow the instructions on Heroku as well on deploying clojure on https://devcenter.heroku.com/categories/clojure-support
But when I check if the application runs all I get is an application error.
So my questions are:
How does one build and deploy a clojurescript app to heroku?
What is the difference in deploying a clojurescript app vs a clojure app
Do I need a clojure server in order to run clojurescript?
How does one even run a standalone clojurescript app on the desktop?
How is the generated app.js related to running a clojurescript app?
I have found it pretty easy to deploy and run a clojure app on Heroku as well as a standalone applicaton on my desktop, I was hoping the same would be true for clojurescript.
Edited:
The error is here: https://floating-depths-33030.herokuapp.com/
To clear the topic for future people finding heroku + clj/cljs, following is a list of working examples. The clojure support on heroku means you can have Clojure webapp deployed. But cljs (like re-frame) actually is pure javascript, have nothing to do with heroku clojure support.
https://github.com/kawasima/back-channeling
https://github.com/zerg000000/table-tmpl
To deploy a re-frame application to Heroku one needs a clojure server, this is where ring comes in. In order to add ring one needs to add +handler while creating a new re-frame project as so:
lein new re-frame <project-name> +handler
This will create a project with a configuration that allows it to be deployable to Heroku.
Steps to deploy to Heroku:
lein clean
lein with-profile prod uberjar
git init
git add .
git commit -m "first commit"
git push heroku master
heroku ps:scale web=1
heroku open
This is application is now readily accessible.

jhipster : angularjs files and browser cache

I am developping a Jhipster web app.
My problem is that when I update some angularjs files and then deploy the new war file in Tomcat7 the modifications are not taken into account, the clients pc is still reading the old angularjs file.
Is there a way(or a jhipster configuration) to tell the client pc to reload all angularjs file in order to be up to date?
Thanks you.
When you build your app with prod profile using mvn -Pprod package or gradlew -Pprod bootRepackage the web assets are minified and prefixed with a unique code in dist folder. An older version of same file has a different prefix so if it is cached it will not prevent the new one from being loaded.
If you don't see this behavior, it's probably because you didn't set the spring.profiles.active property to prod in Tomcat and so your app is running in dev mode and not using the files from dist.
If your frontend and backend are in the same war: 0.0.1-SNAPSHOT change this version in pom.xml before making a build to avoid angular caching issues.
If your frontend is split then go to: gulp/utils.js and change this version: '0.0.5-SNAPSHOT';

Resources