1

I have Ubuntu server on my computer and i have the tomcat9 there.

Last night everything was going well, put .war into webapp folder and it would run like it should on localhost:8080/app

Then i went to sleep and was prepared to continue from where i left off, but behold, yet again there is a problem with tomcat!

i restarted the server, went to /opt/tomcat9/bin and ran startup.sh

Using CATALINA_BASE:   /opt/tomcat9
Using CATALINA_HOME:   /opt/tomcat9
Using CATALINA_TMPDIR: /opt/tomcat9/temp
Using JRE_HOME:        /usr/lib/jvm/java-8-oracle/jre
Using CLASSPATH:       /opt/tomcat9/bin/bootstrap.jar:/opt/tomcat9/bin/tomcat-juli.jar
Tomcat started.

but at localhost:8080 is now unable to connect, as is the /app folder too.

In logs there is nothing.... It seems it dosent even write into logs anymore, last log post is from last night, despite running the server 5min ago.

Catalinalog (timestamp from last night)

07-Mar-2017 04:20:49.775 WARNING [http-nio-8080-exec-9] org.springframework.web.servlet.PageNotFound.noHandlerFound No mapping found for HTTP request with URI [/spring3-mvc-maven-xml-hello-world/hello2] in DispatcherServlet with name 'spring-web'

Catalina.out (also from last night)

07-Mar-2017 04:20:49.775 WARNING [http-nio-8080-exec-9] org.springframework.web.servlet.PageNotFound.noHandlerFound No mapping found for HTTP request with URI [/spring3-mvc-maven-xml-hello-world/hello2] in DispatcherServlet with name 'spring-web'
./catalina.sh: 1: eval: /usr/lib/jvm/java-8-oracle/jre/bin/java: not found
./catalina.sh: 1: eval: /usr/lib/jvm/java-8-oracle/jre/bin/java: not found
./catalina.sh: 1: eval: /usr/lib/jvm/java-8-oracle/jre/bin/java: not found
./catalina.sh: 1: eval: /usr/lib/jvm/java-8-oracle/jre/bin/java: not found
./catalina.sh: 1: eval: /usr/lib/jvm/java-8-oracle/jre/bin/java: not found

Am i really just bad with the service or what, it feels like majority, somewhere around 70% of my time is wasted on debuggin Tomcat alone, I would totally love to actually work on my project instead of tomcat...

  • Looks like your Java Runtime Environment went away. Try — in the terminal — to write /usr/lib/jvm/java-8-oracle/jre/bin/java -version – MichaelK Mar 07 '17 at 13:36
  • If you are not getting anything sensible there, then you need to re-install your JRE. – MichaelK Mar 07 '17 at 13:36
  • and now i need to get new JRE? what the... i just put my computer on sleep for few hours... –  Mar 07 '17 at 13:44

2 Answers2

2

Seems your Java Runtime Environment is missing

That end of the catalina.out is rather revealing: it cannot seem to find the java executable!

Try in a terminal to write

/usr/lib/jvm/java-8-oracle/jre/bin/java -version

Unless you get something along these lines...

java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

...then it is not your Tomcat that is broken but your Java Runtime Environment.

MichaelK
  • 2,859
  • 1
  • 14
  • 16
  • Any idea how i start repairing it? its bit confusing how would it even just break like that, i didnt even do anything, it just went away –  Mar 07 '17 at 13:46
  • @Clomez I would suggest you follow the normal procedure for installing JRE / JDK on Ubuntu. I cannot give you the details about that, but there should be plenty of resources on the subject out there. Or maybe you just need to **find** the JRE on your computer and fix the JRE_HOME variable to point at the right location. – MichaelK Mar 07 '17 at 13:49
  • but when i run java -version, it still says i have 1.8 here. Surely i cant just go and install another one on top of it? –  Mar 07 '17 at 13:51
  • @Clomez Well then you just need to find where that java is located and fix your JRE_HOME variable, either in general or in the startup.sh file. – MichaelK Mar 07 '17 at 13:53
  • Sure, i'll try that now, im just suuuper confused how the hell did this thing even break down.... i just set all this up yesterday, like less than 10h ago... everything went just fine, but now my JRE is not found even tho nothing has changed from yesterday. –  Mar 07 '17 at 14:00
1

For Linux,

you can default set by using the following command.

sudo update-alternatives --config java

For more, you can go through this link: https://stackoverflow.com/a/37479837/2293534

Java Full Installation in Linux: https://www.digitalocean.com/community/tutorials/how-to-install-java-on-ubuntu-with-apt-get

For windows,

you can follow this link: https://confluence.atlassian.com/doc/setting-the-java_home-variable-in-windows-8895.html

UPDATE:

Run the following command

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
export JRE_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre

UPDATE#2:

This is a suggestion. You can reinstall java8 and tomcat9 after removing current installation.

Full installation procedure is given here: https://tecadmin.net/install-tomcat-9-on-ubuntu/

Another installation procedure is also given here: http://www.linuxtechi.com/install-apache-tomcat9-centos7-rhel7-ubuntu16-04/

Community
  • 1
  • 1
SkyWalker
  • 28,384
  • 14
  • 74
  • 132
  • There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java Nothing to configure. –  Mar 07 '17 at 14:12
  • Thank you for your input, i tried these but nothing changed, error persists and server dosent work... –  Mar 07 '17 at 14:27