Discussion:
How to disable a servlet?
Ron Cecchini
2018-08-20 19:30:49 UTC
Permalink
Hi there.


I am trying to run 2 Spring Boot / Camel applications at the same time, and the 2nd app complains about port 8080 already being in use.


However, the 2nd app doesn't even need to expose any endpoints; it's just reading messages off a RabbitMQ bus that the first app is producing. So I tried getting the 2nd app to *not* start up a 'servlet' -- and that's where I've run into trouble. I'm not explicitly doing anything with endpoints in this 2nd app or configuring a servlet. It just has one simple route to read from a bus and transform the message.


I tried getting rid of the servlet dependency in the POM (it was copy and pasted there), thinking that maybe the servlet is auto-started if the dependency is there -- but that didn't do it.


After much digging, I eventually discovered that I can set 'server.port' to something other than 8080 -- and that worked, in the sense that I can now start up the 2 apps and write/read to/from the bus.


But for my own education, I would *still * like to know how I can disable that 2nd servlet, esp. since it's not needed.


Thank you very much.


Ron
Claus Ibsen
2018-08-20 20:54:52 UTC
Permalink
Hi

If its a spring boot application then you can remove the -web-starter
dependency if you dont need servlet/http.

Then you need to set Camel's main controller to true in the
application.properties to keep the app/JVM running.
camel.springboot.main-run-controller = true

Otherwise if you must have SB -web-starter then you can do as you
found out, reconfigure it to use a different port number than 8080.
Post by Ron Cecchini
Hi there.
I am trying to run 2 Spring Boot / Camel applications at the same time, and the 2nd app complains about port 8080 already being in use.
However, the 2nd app doesn't even need to expose any endpoints; it's just reading messages off a RabbitMQ bus that the first app is producing. So I tried getting the 2nd app to *not* start up a 'servlet' -- and that's where I've run into trouble. I'm not explicitly doing anything with endpoints in this 2nd app or configuring a servlet. It just has one simple route to read from a bus and transform the message.
I tried getting rid of the servlet dependency in the POM (it was copy and pasted there), thinking that maybe the servlet is auto-started if the dependency is there -- but that didn't do it.
After much digging, I eventually discovered that I can set 'server.port' to something other than 8080 -- and that worked, in the sense that I can now start up the 2 apps and write/read to/from the bus.
But for my own education, I would *still * like to know how I can disable that 2nd servlet, esp. since it's not needed.
Thank you very much.
Ron
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Ron Cecchini
2018-08-20 21:46:29 UTC
Permalink
Thanks, Claus. Worked perfectly.

(sent off list because I didn't want to add more noise to the list.)
Post by Claus Ibsen
Hi
If its a spring boot application then you can remove the -web-starter
dependency if you dont need servlet/http.
Then you need to set Camel's main controller to true in the
application.properties to keep the app/JVM running.
camel.springboot.main-run-controller = true
Otherwise if you must have SB -web-starter then you can do as you
found out, reconfigure it to use a different port number than 8080.
Post by Ron Cecchini
Hi there.
I am trying to run 2 Spring Boot / Camel applications at the same time, and the 2nd app complains about port 8080 already being in use.
However, the 2nd app doesn't even need to expose any endpoints; it's just reading messages off a RabbitMQ bus that the first app is producing. So I tried getting the 2nd app to *not* start up a 'servlet' -- and that's where I've run into trouble. I'm not explicitly doing anything with endpoints in this 2nd app or configuring a servlet. It just has one simple route to read from a bus and transform the message.
I tried getting rid of the servlet dependency in the POM (it was copy and pasted there), thinking that maybe the servlet is auto-started if the dependency is there -- but that didn't do it.
After much digging, I eventually discovered that I can set 'server.port' to something other than 8080 -- and that worked, in the sense that I can now start up the 2 apps and write/read to/from the bus.
But for my own education, I would *still * like to know how I can disable that 2nd servlet, esp. since it's not needed.
Thank you very much.
Ron
--
Claus Ibsen
-----------------
Camel in Action 2: https://www.manning.com/ibsen2
Loading...