Its been 5 days, I can't seems to run Tomcat 9.0.16 on IntelliJ IDEA Ultimate 2019.1.3 in Ubuntu 19.04 because of this error message:

Answered

Someone save me from above error message or I am going to blast any seconds.

The main question is: What am I missing?

-----------------------------------------------------------------------------------------------------These are few things I did to make Tomcast work IntelliJ:

  1. First I used sudo apt install tomcast9 to install the latest stable build.
  2. And then spending another zillion hour to figure out:
  • /usr/share/tomcat9 in Tomcat_Home.

  • /var/lib/tomcat9 in Tomcat base directory.

So that I use it on IntelliJ like this: 

 

22 comments
Comment actions Permalink

@Parnav,

As for "Permission denied" error, please check this StackOverflow thread: 

https://stackoverflow.com/questions/16428126/intellij-needs-to-copy-tomcat-conf-directory-to-project-directory. The following command:

# chmod -R 644 /var/lib/tomcat9/conf/

Should help.

0
Comment actions Permalink

@Konstantin

As u can see, I ran the commad u mentioned, 

But sitll, I got this:

Error running 'Tomcat 9.0.16 (Ubuntu)': Error copying configuration files from /var/lib/tomcat9/conf to /home/pranav/.IntelliJIdea2019.1/system/tomcat/Unnamed_Servlet/conf: /var/lib/tomcat9/conf/server.xml (Permission denied) ".

 

Please help me. I really need this to work.

0
Comment actions Permalink

@Pranav, 

Try deleting /home/pranav/.IntelliJIdea2019.1/system/tomcat/ and restart both Tomcat and IntelliJ IDEA. 

If it does not help, please share the output of the following commands: 

$ ls -ld /var/lib/tomcat9/conf/ 

$ ls -lah /var/lib/tomcat9/conf/*

$ whoami

And share the idea.log file https://intellij-support.jetbrains.com/hc/en-us/articles/207241085-Locating-IDE-log-files

0
Comment actions Permalink

@Konstantin

I think the second-best answer from the StackOverflow link u mentioned worked for me.

Instead of using: sudo chmod -R 644 /var/lib/tomcat9/conf/

I used: sudo chmod -R 777 /var/lib/tomcat9/conf/

Now i don't have any "permission error" popus message.

Now luckily now I have a new error message: "Port out of range:-1"

God bless me. #HelpMe  

(Note I didn't get to read ur above answer cause I was writing this answer. But my case is now different. It is now related to "ports". So, do u still suggest me try the method u mentioned above!?)

1
Comment actions Permalink

@Serge, I am getting new error message:

 

0
Comment actions Permalink

There is a high possibility that it is the source code issue like that: 

https://community.oracle.com/thread/1182945?start=0&tstart=0

Do you have the rest of the stacktrace, so we could say what causes this? 

0
Comment actions Permalink

@Konstantin

The thread u mention doesn't contain any solution or anything that I can understand.

"Do you have the rest of the stack trace, so we could say what causes this? " can u elaborate this so that I can do something about it.

 
0
Comment actions Permalink

@Pranav

I would try reinstalling Tomcat from the beginning. There is a very high possibility that changes were made to Tomcat's configuration results in this error. 

If you are sure that reinstalling does not help, share IDE logs and Tomcat run log from IDEA console, also provide the fullscreen screenshots of the errors. See https://intellij-support.jetbrains.com/hc/en-us/articles/206869619-Uploading-Large-Files-for-JetBrains-Support-Team to share log files with us. 

0
Comment actions Permalink

I reinstalled and changed -1 to 8085 in server.xml. Now i am getting new error:

0
Comment actions Permalink

Make sure no other service is using port 8080 before you click Run or Debug in IntelliJ IDEA.

sudo lsof -i -P | grep 8080
0
Comment actions Permalink

Now i am getting new error:

0
Comment actions Permalink

The app is available at the context you've configured here:

 

Is it set to /Aug6  ?

0
Comment actions Permalink

Do u mean this:   (Aug6 is my project name)

0
Comment actions Permalink

Yes, see the full log in the Run console about the Tomcat startup and deployment process. If there are any errors, the app may be not deployed. Fix the errors to proceed.

See also https://www.mkyong.com/intellij/intellij-idea-run-debug-web-application-on-tomcat/ . Make sure you deploy the properly configured artifact (war or exploded war).

0
Comment actions Permalink

@Serge Baranov

After running "sudo service tomcat9 stop" every day, clearly, I don't get the error message "8080 port already in use.

So to fix this, I use permanently "sudo update-rc.d tomcat9 remove", hoping this works.

Now, that I can use 8080 port I get this error in IntelliJ console:

/usr/share/tomcat9/bin/catalina.sh run
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
[2019-08-08 07:28:59,926] Artifact Aug6: Waiting for server connection to start artifact deployment...
<6>Server version name: Apache Tomcat/9.0.16 (Ubuntu)
<6>Server built: Feb 26 2019 08:31:13 UTC
<6>Server version number: 9.0.16.0
<6>OS Name: Linux
<6>OS Version: 5.0.0-23-generic
<6>Architecture: amd64
<6>Java Home: /usr/lib/jvm/java-11-openjdk-amd64
<6>JVM Version: 11.0.4+11-post-Ubuntu-1ubuntu219.04
<6>JVM Vendor: Ubuntu
<6>CATALINA_BASE: /home/pranav/.IntelliJIdea2019.1/system/tomcat/Tomcat_9_0_16_Aug6_2
<6>CATALINA_HOME: /usr/share/tomcat9
<6>Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED
<6>Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED
<6>Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
<6>Command line argument: -Djava.util.logging.config.file=/home/pranav/.IntelliJIdea2019.1/system/tomcat/Tomcat_9_0_16_Aug6_2/conf/logging.properties
<6>Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
<6>Command line argument: -Dcom.sun.management.jmxremote=
<6>Command line argument: -Dcom.sun.management.jmxremote.port=1099
<6>Command line argument: -Dcom.sun.management.jmxremote.ssl=false
<6>Command line argument: -Dcom.sun.management.jmxremote.password.file=/home/pranav/.IntelliJIdea2019.1/system/tomcat/Tomcat_9_0_16_Aug6_2/jmxremote.password
<6>Command line argument: -Dcom.sun.management.jmxremote.access.file=/home/pranav/.IntelliJIdea2019.1/system/tomcat/Tomcat_9_0_16_Aug6_2/jmxremote.access
<6>Command line argument: -Djava.rmi.server.hostname=127.0.0.1
<6>Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
<6>Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
<6>Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
<6>Command line argument: -Dignore.endorsed.dirs=
<6>Command line argument: -Dcatalina.base=/home/pranav/.IntelliJIdea2019.1/system/tomcat/Tomcat_9_0_16_Aug6_2
<6>Command line argument: -Dcatalina.home=/usr/share/tomcat9
<6>Command line argument: -Djava.io.tmpdir=/home/pranav/.IntelliJIdea2019.1/system/tomcat/Tomcat_9_0_16_Aug6_2/temp
<6>Loaded APR based Apache Tomcat Native library [1.2.21] using APR version [1.6.5].
<6>APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
<6>APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
<6>OpenSSL successfully initialized [OpenSSL 1.1.1b 26 Feb 2019]
<6>Initializing ProtocolHandler ["http-nio-8080"]
<6>Server initialization in [1,237] milliseconds
<6>Starting service [Catalina]
<6>Starting Servlet engine: [Apache Tomcat/9.0.16 (Ubuntu)]
<6>Starting ProtocolHandler ["http-nio-8080"]
<6>Server startup in [660] milliseconds
Connected to server
[2019-08-08 07:29:04,762] Artifact Aug6: Artifact is being deployed, please wait...
<6>At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
[2019-08-08 07:29:07,173] Artifact Aug6: Artifact is deployed successfully
[2019-08-08 07:29:07,174] Artifact Aug6: Deploy took 2,412 milliseconds

Along with the browser saying this: 

This is all the details till now. Hope it will be solve in few days.

0
Comment actions Permalink

The app is deployed and runs on Tomcat according to the log, but what it serves and at what contexts would depend on your code, project structure and the artifact configuration. A sample project would be needed to investigate further.

0
Comment actions Permalink

 

After following the article you mentioned, I am able to use the Tomcat server. The changes I made in IntelliJ Tomcat configuration are these:

  1. In the Deployment section, Aug6: war exploded (Don't know what it means by 'war').
  2. In Server section > VM options: 
       i> On 'Update' action: Update resources and Classes
       ii> On frame deactivation: Update resources and Classes

This is the terminal output:

/usr/share/tomcat9/bin/catalina.sh run
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
[2019-08-08 11:18:51,632] Artifact Aug6:war exploded: Waiting for server connection to start artifact deployment...
<6>Server version name: Apache Tomcat/9.0.16 (Ubuntu)
<6>Server built: Feb 26 2019 08:31:13 UTC
<6>Server version number: 9.0.16.0
<6>OS Name: Linux
<6>OS Version: 5.0.0-23-generic
<6>Architecture: amd64
<6>Java Home: /usr/lib/jvm/java-11-openjdk-amd64
<6>JVM Version: 11.0.4+11-post-Ubuntu-1ubuntu219.04
<6>JVM Vendor: Ubuntu
<6>CATALINA_BASE: /home/pranav/.IntelliJIdea2019.1/system/tomcat/Tomcat_9_0_16_Aug6_2
<6>CATALINA_HOME: /usr/share/tomcat9
<6>Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED
<6>Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED
<6>Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
<6>Command line argument: -Djava.util.logging.config.file=/home/pranav/.IntelliJIdea2019.1/system/tomcat/Tomcat_9_0_16_Aug6_2/conf/logging.properties
<6>Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
<6>Command line argument: -Dcom.sun.management.jmxremote=
<6>Command line argument: -Dcom.sun.management.jmxremote.port=1099
<6>Command line argument: -Dcom.sun.management.jmxremote.ssl=false
<6>Command line argument: -Dcom.sun.management.jmxremote.password.file=/home/pranav/.IntelliJIdea2019.1/system/tomcat/Tomcat_9_0_16_Aug6_2/jmxremote.password
<6>Command line argument: -Dcom.sun.management.jmxremote.access.file=/home/pranav/.IntelliJIdea2019.1/system/tomcat/Tomcat_9_0_16_Aug6_2/jmxremote.access
<6>Command line argument: -Djava.rmi.server.hostname=127.0.0.1
<6>Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
<6>Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
<6>Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
<6>Command line argument: -Dignore.endorsed.dirs=
<6>Command line argument: -Dcatalina.base=/home/pranav/.IntelliJIdea2019.1/system/tomcat/Tomcat_9_0_16_Aug6_2
<6>Command line argument: -Dcatalina.home=/usr/share/tomcat9
<6>Command line argument: -Djava.io.tmpdir=/home/pranav/.IntelliJIdea2019.1/system/tomcat/Tomcat_9_0_16_Aug6_2/temp
<6>Loaded APR based Apache Tomcat Native library [1.2.21] using APR version [1.6.5].
<6>APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
<6>APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
<6>OpenSSL successfully initialized [OpenSSL 1.1.1b 26 Feb 2019]
<6>Initializing ProtocolHandler ["http-nio-8080"]
<6>Server initialization in [1,056] milliseconds
<6>Starting service [Catalina]
<6>Starting Servlet engine: [Apache Tomcat/9.0.16 (Ubuntu)]
<6>Starting ProtocolHandler ["http-nio-8080"]
<6>Server startup in [265] milliseconds
Connected to server
[2019-08-08 11:18:54,117] Artifact Aug6:war exploded: Artifact is being deployed, please wait...
<6>At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
[2019-08-08 11:18:55,796] Artifact Aug6:war exploded: Artifact is deployed successfully
[2019-08-08 11:18:55,796] Artifact Aug6:war exploded: Deploy took 1,679 milliseconds

 

1 lesson learned: I think selecting the project folder in the Deployment section, don't resolve the issue. Unlike in Windows or other OS. We need to choose the 'artifact'.

1 doubt/question: What is the usually followed standard protocol, when it comes to selecting 'VM options' in 'Server' section?

Because no matter what I put in these options, it seems to work. Is there a default/standard option I should select just in case I might run into a problem in future. 

0
Comment actions Permalink

@Pranav,

You could find full descriptions of the options you mentioned in our help portal:

https://www.jetbrains.com/help/idea/run-debug-configuration-tomcat-server.html#4523f01b

 

0
Comment actions Permalink

These options are related to updating your web application (hot reload/hot deploy, hotswap, etc). See https://www.jetbrains.com/help/idea/updating-applications-on-application-servers.html.

0
Comment actions Permalink

Instead of changing permissions of the configuration files, try adding yourself to the tomcat9 group: sudo usermod yourname -aG tomcat9, then log out and back in or restart your computer.

I had the same issue as you did with tomcat8, but there's a good chance this solution will work for tomcat9 as well. Please tell me if it did!

0
Comment actions Permalink

Leon

➜ ~ sudo usermod pranav -aG tomcat9
usermod: group 'tomcat9' does not exist

Are you asking me to create a new group?

0

Please sign in to leave a comment.