How to run spring web app (jdk 8) with embedded Tomcat 8 - maven

We have a Spring web app (JDK 1.8) and (for development purposes) we're running it on embedded tomcat container, i.e. - we're using tomcat7-maven-plugin. The app is being started with
mvn tomcat7:run ...
For what I found out on I-net, there is no tomcat8-maven-plugin yet.
I found a few posts that claim that this also works with Tomcat 8, but it's not clear how to configure maven plugin to run Tomcat version 8, instead of version 7.
I tried this:
https://tomcat.apache.org/maven-plugin-2.2/tomcat7-maven-plugin/adjust-embedded-tomcat-version.html
and the build was successful, but the run failed with:
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:
run (default-cli) on project spotbuy: Execution default-cli of goal org.apache.t
omcat.maven:tomcat7-maven-plugin:2.2:run failed: An API incompatibility was encountered while executing org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:run: java.lang.NoSuchMethodError: org.apache.catalina.startup.Tomcat.setDefaultRealm(Lorg/apache/catalina/Realm;)
I researched again and I found out, this is known unresolved problem.
Provided it's even possible, can anybody, please, give more details what and where should be configured?

It's not possible ... for now ...

Related

maven-deploy-plugin goal failed to achieved - working fine in window agent, build failed in Unix agent (Azure Pipeline)

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project **xxxxxxxxxx**: Execution default-deploy of goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy: java.lang.NoSuchMethodError: org.apache.maven.wagon.shared.http.AbstractHttpClientWagon.getBufferCapacityForTransfer(J)I
Same pom.xml was used in two agents but error occurs in unix agent. Anyone knows what is the possible reason for the error?
The version of Maven on the Unix system is probably old and not compatible with the Mule Maven Plugin. Try upgrading to a newer version that is compatible.
The issue is documented at this KB article: https://help.mulesoft.com/s/article/An-API-incompatibility-was-encountered-while-executing-org-apache-maven-plugins-maven-deploy-plugin-while-deploying-an-asset-to-Exchange-using-Exchange-Maven-Facade-v3

Looking into what's wrong with the Quarkus 1.2.Final and Kogito 0.7.1 project

I am forced not to use Kogito parent bom for reasons I can't explain.
So I got a Maven project which is based on Quarkus 1.2.Final and Kogito 0.7.1, and was able to resolve all the version mismatch issues. The code compiles but fails to run tests. It throws the following error and I do have kogito-ruleunits in my dependencies.
9:18:53,268 ERROR [io.qua.dev.DevModeMain] Failed to start Quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.kogito.deployment.KogitoAssetsProcessor#generateModel threw an exception: java.lang.NoClassDefFoundError: org/kie/kogito/rules/impl/AbstractRuleUnits
I have publish the project on github : https://github.com/mravi786/junk/tree/master/dingo-dmn
You have this issue because you use a version incompatible with Quarkus 1.2.1.
I don't know exactly why you can't use the Kogito BOM but there's definitely some artifact that is not the right version.
Update: Quarkus 1.2.x supports Kogito 0.6.x. Due to the tight integration between the two, you cannot upgrade Kogito like this. If you absolutely need Kogito 0.7.1, you can start playing with Quarkus 1.3.0.Alpha2. We will release CR1 soon and the Final a week after that.

Maven clean package lead to random "Application failed to start"

I encounter a very strange issue with my jhipster application (Spring Boot + Angular, v5.0.2).
Randomly, maven compilation (./mvnw -Pprod clean package -DskipTests) give me a war that cannot be executed : I can compile and launch the war and all work fine, and one minute later, without any change, I can compile but when I launch the war I get this stack trace :
11:46:32.286 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.NoSuchMethodError: org.yaml.snakeyaml.Yaml.<init>(Lorg/yaml/snakeyaml/constructor/BaseConstructor;Lorg/yaml/snakeyaml/representer/Representer;Lorg/yaml/snakeyaml/DumperOptions;Lorg/yaml/snakeyaml/LoaderOptions;Lorg/yaml/snakeyaml/resolver/Resolver;)V
This behaviour is seen on my laptop, my collegue laptop, and a Jenkins Docker image, so does not seem to be an environment issue.
** EDIT : **
Here is the pom : http://jsfiddle.net/ewn6qLzd/ (sorry I did not found something more appropriate to share it)
Any help would be much appreciated.
Best Regards,

Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.18:redeploy (default-cli) on project

I am running and deploying on Windows. The app server is Tomcat 8. Not clear what this error means or how to resolve it.
Any help is greatly appreciated.
your question is similar my problem, I solved it. perhaps you have not properly started your server before using maven. for more details take a look at Deploying the JavaEE 8 Tutorial, by maven gets Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.6.4:redeploy (deploy) on project hello1

jenkins - maven - sonar 3.7

we had
Jenkins 1.513 - Maven 3.0.5 - Sonar 3.5
combo setup for our projects.
After upgrading Sonar to version 3.7 i get the following error, on all projects:
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.1:sonar (default-cli) on project RC: Can not execute SonarQube analysis: Unable to execute Sonar: Task null does not exist -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.1:sonar (default-cli) on project RC: Can not execute SonarQube analysis
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
...
Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute SonarQube analysis
at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:109)
at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:67)
at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:109)
...
Caused by: org.sonar.api.utils.SonarException: Task null does not exist
at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:78)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:88)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:73)
Now, i get that it's a NullPointerException, but i couldn't find what/where to do to make things works again.
Any ideas would be appreciated :)
Thank you,
Marian
Ok, so obviously the error was human:
I should've understood, not just read this particular line:
If for any reason, has to change (moving the SonarQube distribution into another directory, generating the WAR and deploying it on different machines, etc.), set the SONAR_HOME environment variable to the new path to .
from the
Deploying SonarQube on Tomcat documentation.
Since I was doing an upgrade, i didn't want to remove the Sonar's old installation just yet, so i installed the new version in sonar-3.7 without updating the $SONAR_HOME variable which pointed to the /sonar folder (doh)
I found out after my initial post that the above mentioned error occured only when running SonarQube as webapp in Tomcat. In standalone mode, it was running fine.
Maybe this is one of the reasons why it is stated :
Note that the support of Tomcat will be dropped in version 4.1 of SonarQube.
Thus, it is highly recommended to stick with the standalone mode and not deploy SonarQube on Tomcat.
on the mentioned page.
It's easier to make an application more stupid proof just saying "don't do that" rather than fixing your own NullPointerExceptions. The only risk with this approach is that the stupid must understand what he's reading.

Resources