Score:0

How to start Tomcat 9 on Ubuntu 18.04 as a service in debug mode?

ru flag

(looks like my question is evolving, after solving it I will edit it appropriately)

As in the title. I can run Tomcat as a service, but I have no idea how to run it in debug mode.

I've tried to run it in debug mode from terminal as in this question: https://stackoverflow.com/questions/16689274/how-to-start-debug-mode-from-command-prompt-for-apache-tomcat-server

For unix first export variables:

export JPDA_ADDRESS=8000
export JPDA_TRANSPORT=dt_socket

and to start server in debug mode:

%TOMCAT_HOME%/bin/catalina.sh jpda start

So I ran

$ export JPDA_ADDRESS=8000  
$ export JPDA_TRANSPORT=dt_socket
$ sudo /usr/share/tomcat9/bin/catalina.sh jpda start

I got in response

Using CATALINA_BASE:   /usr/share/tomcat9
Using CATALINA_HOME:   /usr/share/tomcat9
Using CATALINA_TMPDIR: /usr/share/tomcat9/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/share/tomcat9/bin/bootstrap.jar:/usr/share/tomcat9/bin/tomcat-juli.jar
Tomcat started.

netstat -tpln | grep 8080 or 8000 shows me nothing.

However, when I'm running Tomcat as a service it starts listening on 8080 port. That's why I'm thinking that it would be nice to have it running in debug mode as a service, but I don't know how to do this.

cn flag
Did you change `%TOMCAT_HOME%` to the dir that is `%TOMCAT_HOME%` or did you copy/paste `%TOMCAT_HOME%` into the service? Why run the service in debug mode? why not run tomcat in debug mode with the service off , fix the issue and then use the service?
kujaw avatar
ru flag
Yes, I changed the dir, in my case it's `/usr/share/tomcat9/bin/catalina.sh jpda start`. I'm trying to run the service because I don't know how where is the issue and I can't make it to run it with the service off. When I start it from terminal I'm getting `Tomcat started.` message but I can't access it from the broswer on 8080 port (when ran as a service, I can access it), which (the port) is written in server.xml file.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.