Apache camel app behaves differently in Tomcat when deployed with Maven - maven

I do not understand the situation: whe I use Maven to deploy Apache camel routes to the Tomcat I do not see any routes with JMX. But if I package war with Maven and deploy it manually (copy *.war to webapps directory) - everything works fine.
What could cause such a behavior!?

Related

What is the use of Apache Tomcat Webserver

When building the Java web application through the maven build tool we get the war file as the artifact which is an executable file. So I have a basic doubt which is if we can execute the war file directly then why do we need an Apache tomcat webserver to host this war artifact?

Control order of WAR file deployment in JBoss EAP 7.2.0

I have developed two Spring Boot applications, one is Cloud Config Server and the other is a Spring Boot application that fetches property from Config Server. I have deployed the two applications as WAR files in JBoss EAP. I am deploying the WAR files in sequence, deploying the Config Server before the other application. Problem is happening after I restart the server, the second war file is getting deployed before the war file for Config Server.
I Jboss EAP 7.2.0, how will I ensure that the WAR file for Config Server is always deployed before the WAR file of the other application?
You can control the startup order of deployment by using jboss-all.xml deployment descriptor to declare dependencies between the deployments.
Example:
If you want foo.ear is deployed before bar.ear then you can create an bar.ear/META-INF/jboss-all.xml file like this:
<jboss xmlns="urn:jboss:1.0">
<jboss-deployment-dependencies xmlns="urn:jboss:deployment-dependencies:1.0">
<dependency name="foo.ear" />
</jboss-deployment-dependencies>
</jboss>
[1] https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.1/html/configuration_guide/deploying_applications#control_order_deployments
[2] https://access.redhat.com/solutions/88763

How do I go from a Maven Dynamic web project to some executable

I have a Maven Dynamic web project in Spring - I can run this in eclipse with a tomcat server and serve all my code a web page via localhost.
I am looking to create an executable which can be ran locally on a machine with no internet connection and when ran will serve the web project to a specified localhost URL.
If you have included an embedded server (like tomcat) as a dependency in you POM.xml file, then you have to Right Click on your Project -> Run as -> Maven Install. This will build a Maven Executable Jar file in the target folder of your Maven Application.
Take the Jar file and Run it from command line using
java -jar <jarfilename>.jar
After building project you will have <project_name>.war file created in target folder inside the project.
You should deploy it to a J2EE application server, like: Glassfish, JBoss Wildfly, etc.

Spring Maven rest web service - What is the URL when deploying on real web server?

I followed this tutorial https://spring.io/guides/gs/rest-service/ by creating maven project in intellij, addind pom.xml etc. Then I run on localhost exactly as written in the tutorial and all works:
http://localhost:8080/greeting
When greeting came from the annotation of method in the controller #RequestMapping("/greeting").
Then I made JAR artifact & deployed it to Tomact on 'real server' (Elastic beanstalk environment running EC2 instance on AWS).
I got from AWS the base URL of my webserver running Tomact. What is now the suffix to my service? This is NOT working:
http://someEnvironmentName.elasticbeanstalk.com/greeting
EDIT: How I made the artifact JAR
In intellij I can compile & run maven project and then test it in localhost. So what I did:
Right click on the project name->Open Module Settings->Artifacts->Add->Jar
Build->Build Artifacts->Selecting the Jar from above
Maybe I need to build WAR? And how to deal with the POM.xml? Now my pom is exactly as in the linked tutorial.
Thanks,
If you use spring-boot, you donĀ“t need a tomcat because spring include an embedded tomcat. Only you run the application with Maven. So, the advantage of spring-boot is not dependent on an application server and using other containers such as Docker.
Do you put the port in the call to your webserver?
On the other hand, check your server logs to see if there are any problem.
Solution (Thanks to #JBNizet suggestion):
Follow this link http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-create-a-deployable-war-file
Modify the Application.java file
Modify the pom.xml (By adding one more dependency)
Then if you are using Intellij IDE under Build->Build Artifacts will be automatically option for WAR file.
Just deploy to AWS elasticbeanstalk instance running EC2 in the usual way. The URL is:
http://someEnvironmentName.elasticbeanstalk.com/greeting

How do I deploy ejb jar in TomEE

M exploring openejb 4 beta with TomEE, could anyone explain how I deploy ejb jar on TomEE? I'm using it for testing purposes. Also, is it possible to configure tomee in eclipse and debug through ejbs??
Thanks in advance.
There are several scenarios for using EJB through the TOMEE(included OpenEJB), if you have an EAR file (consists of JARs and WAR) for deployment you need first active the APP folder in installed(means copied) TOMEE folder then you just drop your EAR file into APP folder and TOMEE unpack it and will be deployed properly.

Resources