Join us on Discord!
You can help CodeWalrus stay online by donating here.

tomcat and ubuntu

Started by p2, December 01, 2016, 04:06:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

p2

I tried to setup a Java Servlet on a Tomcat-8 on Ubuntu server and ran in thousands of problems. Maybe you can learn from them :) Even if not... I stilll got +1 post (quantity, yaay) ^^
I am referring to tomcat8 that was NOT installed using the official repository. If oyu used it (recommended) many things (like paths) will be different.

How to solve stupid problems with servlets on tomcat:

to see if your tomcat is working, jost go on yourdomain.com:8080/
you should then see the welcome screen of tomcat:



[spoiler= I DO NOT SEE THIS SCREEN ]if you're NOT seeing this, you should check if your tomcat is running.
To do this go to the terminal and enter:
sudo systemctl restart tomcat
systemctl status tomcat

you should see something like this:

to go back press CTRL + C
[spoiler= NUUU, MINE IS DIFFERENT ]
if you're getting different results (or in general if that text does NOT say "active (running)" then you should concider a reinstallation as this will be insanely hard to fix.[/spoiler]
[spoiler= YAAAY, SAME HERE ]
If you see this but the site isn't working, that probably means your permission aren't set correctly.
You should make sure the owners/groups are set correctly.
To set them, enter this:
sudo chown tomcat:tomcat /opt/tomcat/webapps/MYFILE.WAR
sudo chown tomcat:tomcat /opt/tomcat/webapps/
sudo systemctl restart tomcat


You should put in the correct name for your WAR file (your servlet).
Then you should again check if you see the site now.
[spoiler= NUU STILL NOTHING ]
You should also concider a little reinstallation as your problem will be pretty hard to fix... I'm sorry :/
[/spoiler]
[spoiler= YAAAAY SEE IT ]Great. Your problem was solved ^^
If your servlet still wont work, follow these instructions a second round :)[/spoiler]
[/spoiler]
[/spoiler]
[spoiler= YEAH, CAN SEE IT ]
Great, that means at least your Tomcat is running.
But your servler is still not working... else you wouldn't read this. :/
The first step now is to check the logs. The fastest way to do so is just reading them directly on the Server.
To read the logs, do this:
sudo nano /opt/tomcat/logs/catalina.1984-01-01.log

Please be aware you have to enter the current date in the filename.
The result should look like this: (sorry for the quality)

You can scroll the text up and down with the arrow keys.
If all of the text looks about the same (no strange paragraphs or super short lines) thats a good sign :)
To exit this, press CTRL + X

[spoiler= AAAH THATS 9001 LINES!! ]
In this case we ahould clear your log files and create some new entries.
Lets first delete the old files:
sudo rm /opt/tomcat/logs/ -R
sudo mkdir /opt/tomcat/logs
sudo chown tomcat:tomcat /opt/tomcat/logs -R


Then you should try to create some new entries by reloading the site and accessing the servlet again.
Afterwards try to read the logs, again:
sudo nano /opt/tomcat/logs/catalina.1984-01-01.log

Again, please be aware you have to enter the current date in the filename.
The result should look like this: (sorry for the quality)

You can scroll the text up and down with the arrow keys.
If all of the text looks about the same (no strange paragraphs or super short lines) thats a good sign :)
To exit this, press CTRL + X
[spoiler= JEP, SEEMS FINE ]
Okey, then that might mean something with your servlet isn't right. Your tomcat seems not to be the problem.
You should now check if your servlet was automatically unpacked by tomcat. If not, it didnt even load it in the first place.
To do that, enter this:
sudo dir /opt/tomcat/webapps/

As a result you get a list of all files/folders in your webapps/ folder.
There should be a directory (folder) names the same as your WAR file:

[spoiler= YAAAY IT'S THERE]THATS NO REASON TO BE HAPPY!!
Actually that means you TOTALLY messed omething up.
Go reinstall your tomcat. Nothing else will help you I'm afraid.[/spoiler]
[spoiler= NUU, NO SUCH FOLDER! ]That mean's your Servlet wasn't accepted by tomcat because you didn't set the group/owner correctly.
To fix that, type this:
sudo chown tomcat:tomcat /opt/tomcat/webapps -R
sudo systemctl restart tomcat


After that please retry if it works now.
[spoiler= YAAAY MY SERVLET WORKS]Fnie. Now bring me cookies![/spoiler]
[spoiler= NUUU *CRY* STILL NOT WORKING [/spoiler]
in that case.. you're just stupid. You messed something up and I cant even imagine how.
Go reinstall your tomcat.
And be ashamed of yourself...
bye <3[/spoiler]
[/spoiler]
[spoiler= NUU, STILL  NO ENTRIES! ]
If your log file is still empty that means you should definitely try a reinstallation. Else you won't be happy anytime soon...
[/spoiler]
[spoiler= NUU, ERROR MESSAGES!! ]
Actually thats great as you can now get some REAL help.
Just search the internet for them :)
Byye <3[/spoiler]
[/spoiler]
[spoiler= HUH? IT'S EMPTY! ]
If your log file is still empty that means you should definitely try a reinstallation. Else you won't be happy anytime soon...
[/spoiler]
[spoiler= NUU, ERROR MESSAGES!! ]
Actually thats great as you can now get some REAL help.
Just search the internet for them :)
Byye <3[/spoiler]
[/spoiler]
[spoiler= NUU, ERROR MESSAGES!! ]
Actually thats great as you can now get some REAL help.
Just search the internet for them :)
Byye <3[/spoiler]
[spoiler= HUH? IT'S EMPTY! ]
In this case lets recreate the logs folder and restart tomcat.
Please enter this:
sudo rm /opt/tomcat/logs/ -R
sudo mkdir /opt/tomcat/logs
sudo chown tomcat:tomcat /opt/tomcat/logs -R


Then you should try to create some new entries by reloading the site and accessing the servlet again.
Afterwards try to read the logs, again:
sudo nano /opt/tomcat/logs/catalina.1984-01-01.log

Again, please be aware you have to enter the current date in the filename.
The result should look like this: (sorry for the quality)

You can scroll the text up and down with the arrow keys.
If all of the text looks about the same (no strange paragraphs or super short lines) thats a good sign :)
To exit this, press CTRL + X
[spoiler= ERM... IT'S STILL EMPTY ]
If your log file is still empty even now, then your tomcat is beyond repair (at least I think so).
Please try a reinstallation.
Thx for reading <3[/spoiler]
[spoiler= NUU, ERROR MESSAGES!! ]
Actually thats great as you can now get some REAL help.
Just search the internet for them :)
Byye <3[/spoiler]
[spoiler= JEP, SEEMS FINE NOW ]
Okey, then that might mean something with your servlet isn't right. Your tomcat seems not to be the problem.
You should now check if your servlet was automatically unpacked by tomcat. If not, it didnt even load it in the first place.
To do that, enter this:
sudo dir /opt/tomcat/webapps/

As a result you get a list of all files/folders in your webapps/ folder.
There should be a directory (folder) names the same as your WAR file:

[spoiler= YAAAY IT'S THERE]THATS NO REASON TO BE HAPPY!!
Actually that means you TOTALLY messed omething up.
Go reinstall your tomcat. Nothing else will help you I'm afraid.
[/spoiler]
[spoiler= NUU, NO SUCH FOLDER! ]That mean's your Servlet wasn't accepted by tomcat because you didn't set the group/owner correctly.
To fix that, type this:
sudo chown tomcat:tomcat /opt/tomcat/webapps -R
sudo systemctl restart tomcat


After that please retry if it works now.
[spoiler= YAAAY MY SERVLET WORKS]Fnie. Now bring me cookies![/spoiler]
[spoiler= NUUU *CRY* STILL NOT WORKING [/spoiler]
in that case.. you're just stupid. You messed something up and I cant even imagine how.
Go reinstall your tomcat.
And be ashamed of yourself...
bye <3[/spoiler]
[/spoiler][/spoiler][/spoiler]
[spoiler= JEP, SEEMS FINE ]
Okey, then that might mean something with your servlet isn't right. Your tomcat seems not to be the problem.
You should now check if your servlet was automatically unpacked by tomcat. If not, it didnt even load it in the first place.
To do that, enter this:
sudo dir /opt/tomcat/webapps/

As a result you get a list of all files/folders in your webapps/ folder.
There should be a directory (folder) names the same as your WAR file:

[spoiler= YAAAY IT'S THERE]THATS NO REASON TO BE HAPPY!!
Actually that means you TOTALLY messed omething up.
Go reinstall your tomcat. Nothing else will help you I'm afraid.[/spoiler]
[spoiler= NUU, NO SUCH FOLDER! ]That mean's your Servlet wasn't accepted by tomcat because you didn't set the group/owner correctly.
To fix that, type this:
sudo chown tomcat:tomcat /opt/tomcat/webapps -R
sudo systemctl restart tomcat


After that please retry if it works now.
[spoiler= YAAAY MY SERVLET WORKS]Fnie. Now bring me cookies![/spoiler]
[spoiler= NUUU *CRY* STILL NOT WORKING [/spoiler]
in that case.. you're just stupid. You messed something up and I cant even imagine how.
Go reinstall your tomcat.
And be ashamed of yourself...
bye <3[/spoiler]
[/spoiler][/spoiler]
[/spoiler]
If you see any mistakes, pls tell me
*10000 letters ^.^
  • Calculators owned: ti-83+, ti-84+, ti-84+, ti-84+se, ti-84+se(te), ti-nsphire, ti-nsphire CAS, ti-nsphire CX-CAS, ti-voyage, ti-voyage, Who reads this list anyways...?
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)


Dream of Omnimaga

  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Powered by EzPortal