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

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.

Related

Problem running BIRTViewer in Oracle Weblogic 14.1.1

I have created a war file of birt-runtime-4.12.0-20221128 as in the instructions for POJO deploymnet. I am running weblogic 14.1.1 and I can successfully deploy it. Weblogic is running Java Version: 1.8.0_331. Is this sufficient?
When I browse to the following path: http://localhost:7001/birt/index.jsp
I get the following error: Error 404--Not Found
Any suggestions on how to make it work?
I tried building it many times and many ways and this is the only way that it successfully deployed but doesnt work.
Sorry, but BIRT 4.12 needs Java >= 11.

How to resolve compileJava errors during heroku deployment?

I worked as follows to deploy Intellij Spring Boot using gradle on heroku. I proceeded from the directory containing the source files.
> git init
> git add .
> git commit -m "first commit"
> heroku create
> git push heroku master
However, the following error occurred during the push process.
What went wrong: Execution failed for task ':compileJava'.
invalid source release: 11
After the problem occurred, a file called system.properties was also created in the source file and the following input was also entered.
java.runtime.version=11
But it is still unresolved. How do I solve this problem?
First you have to ensure your local development and your deployed instance are using the same version.
You specified a version with system.properties with content java.runtime.version=11 but haven't provided an image of the updated log. The log still says you are installing JDK 1.8.
Furthermore you should specify a Java version that is currently being supported. You can find the versions here: https://devcenter.heroku.com/articles/java-support#supported-java-versions
Java 7 - 1.7.0_302
Java 8 - 1.8.0_292
Java 11 - 11.0.11
Java 13 - 13.0.7
Java 15 - 15.0.3
Java 16 - 16.0.1
I've just face this problem following a course. Solve it by change the sourceCompatibility='17'(on my file) to '1.8' on my built.gradle file change sourceCompatibility='1.8' on build.gradle file
and change the Gradle JMV on setting and JKD on project structure to 1.8.
enter image description here
duno if the last change anything, but worked for me.

Springboot Strange Resource Loading Behavior

I'm working on a springboot 1.5.1 application that I'm trying to load a WSDL included in my resources directory in the wsdl directory. Depending on where my application executes I'm getting different results (command line, intellij, cloud foundry) and I can't seem to get all three to work at the same time.
I've tried several ways of locating the resource:
From prior to the migration to springboot we had this (worked in IntelliJ but not java -jar myboot.jar):
this.getClass().getResource("/wsdl/my.wsdl");
I switched it to the typically more correct version and got it to work in IntelliJ and java -jar but not Cloud Foundry:
this.getClass().getClassLoader().getResource("/wsdl/my.wsdl");
I switched it to use the Spring Resource Loader version and it worked in IntelliJ and CloudFoundry but not java -jar:
#Value("classpath:/wsdl/my.wsdl")
private Resource wsdlResource;
wsdlResource.getURL();
On the command line what I've noticed is that it seems to be thinking that BOOT-INF/classes is a JAR file (Note the ! after classes):
Caused by: javax.xml.ws.WebServiceException: Failed to access the WSDL at: jar:file:/C:/dev/redacted/build/libs/redacted.jar!/BOOT-INF/classes!/wsdl/my.wsdl. It failed with:
JAR entry BOOT-INF/classes!/wsdl/my.wsdl not found in C:\dev\redacted\build\libs\redacted.jar.
From looking at IntelliJ's URL, it's referring to the actual source folder which explains why it seems to always work.
What is causing this and how might I universally load these class path resources successfully with springboot?

Jersey bug when starting Spring-boot app Unix style

A question has already been posted here at Spring-boot jersey maven failed to run war file and its author has found a work around to get the Spring-boot app to run, but it's still an annoying bug.
Basically, when running a Spring-boot app with a Jersey configuration using ResourceConfig's public final ResourceConfig packages(final String... packages) with java -jar command or using Unix style ./app.jar start the following exception occurs:
java.io.FileNotFoundException:/path/app-1.0-SNAPSHOT.war!/WEB-INF/classes (No such file or directory)
Caused by: org.glassfish.jersey.server.internal.scanning.ResourceFinderException:
This does not occur when the app is ran with mvn spring-boor:run.
Not using packages("com.company.app.rest") is a work around, but it's a pain not to be able to have Jersey scan a base package.
Is this listed as a bug by the Spring-boot team?
I think it is but for some reason nobody complained hard enough. Can you please share your issue on #3413?

Sphinx4 breaks on AWS Elastic Beanstalk, works on dev machine

I created a dummy Maven project that wraps CMU Sphinx4 in a servlet. The dependencies are sphinx4-core:1.0-SNAPSHOT and sphinx4-data:1.0-SNAPSHOT. When running locally (Eclipse) it works great, but then I deploy it to AWS Elastic Beanstalk and I get the following exception:
Property exception component:'null' property:'null' - java.io.FileNotFoundException: JAR entry edu/cmu/sphinx/models/en-us/en-us//means not found in /var/lib/tomcat8/webapps/ROOT/WEB-INF/lib/sphinx4-data-1.0-SNAPSHOT.jar
edu.cmu.sphinx.util.props.PropertyException: java.io.FileNotFoundException: JAR entry edu/cmu/sphinx/models/en-us/en-us//means not found in /var/lib/tomcat8/webapps/ROOT/WEB-INF/lib/sphinx4-data-1.0-SNAPSHOT.jar
Caused by: java.io.FileNotFoundException: JAR entry edu/cmu/sphinx/models/en-us/en-us//means not found in /var/lib/tomcat8/webapps/ROOT/WEB-INF/lib/sphinx4-data-1.0-SNAPSHOT.jar
I suspect it's that double slash in there but I cannot explain why it doesn't happen on my dev machine (OSX).
thanks!
Edit:
My dev machine: OSX running Eclipse Luna with AWS plugin. I am using a J2EE project with a single servlet, and getting Sphinx JARs (core & data) through Maven. When I run the server in my dev machine (port 8080) I feed it a WAV file through a POST message, the file gets loaded correctly and I get the analysis as a textual response.
My prod machine: AWS Elastic Beanstalk. I deploy using AWS plugin. When I comment out the Sphinx part of the code, the server works (i.e. gets the file, and returns it to me, etc.)
If the problem is not the double slash, then the JARs are not being cooked right. This would make sense since the file it's looking for is not a class so the JAR cooking part of Maven should be told how to include resource files in the JAR it makes when it deploys.
Any idea how to do this ?
thanks again!
Double slash seems to be a problem on some JVMs, on other JVMs it works.
I've just committed an update to avoid double slashes. Please update sphinx4 and try again.
Turns out the problem was I was developing (OSX) on Java 7 and deploying to AWS to Tomcat/Java 8. Once I deployed to Tomcat/Java 7, everything worked as expected.

Resources