Java Web - Tomcat não carrega no Eclipse Ubuntu

1. Java Web - Tomcat não carrega no Eclipse Ubuntu

Marco Brainiac
mbrainiac

(usa Debian)

Enviado em 22/03/2018 - 19:20h

Eclipse Neon
Ubuntu mate 16.04

fiz
# apt-get install tomcat8
# apt-get install tomcat8-examples tomcat8-docs tomcat8-admin

teste no browser:
localhost:8080
Apareceu: It works

No Eclipse:
[IMG]http://i63.tinypic.com/2vcyhxw.jpg[/IMG]


Erro ao rodar Java Web no Eclipse:
[IMG]http://i67.tinypic.com/2hr0jmg.png[/IMG]

[IMG]http://i65.tinypic.com/2edxmrk.png[/IMG]


root@brainiac-desktop:/etc/tomcat8# ls /usr/share/tomcat8
bin defaults.template logrotate.md5sum
defaults.md5sum lib logrotate.template


root@brainiac-desktop:/etc/tomcat8# ls /etc/tomcat8
Catalina context.xml policy.d tomcat-users.xml
catalina.properties logging.properties server.xml web.xml








  


2. Re: Java Web - Tomcat não carrega no Eclipse Ubuntu

Marco Brainiac
mbrainiac

(usa Debian)

Enviado em 23/03/2018 - 10:04h

Instalação do tomcat9:

root@brainiac-desktop:/usr/local# ls
apache-tomcat-9.0.6 etc include lib netbeans-8.2 share
bin games jdk1.8.0_111 man sbin src
root@brainiac-desktop:/usr/local# cd apache-tomcat-9.0.6
root@brainiac-desktop:/usr/local/apache-tomcat-9.0.6# chgrp -R tomcat /usr/local/apache-tomcat-9.0.6
root@brainiac-desktop:/usr/local/apache-tomcat-9.0.6# chmod -R g+r conf
root@brainiac-desktop:/usr/local/apache-tomcat-9.0.6# chmod g+x conf
root@brainiac-desktop:/usr/local/apache-tomcat-9.0.6# chown -R tomcat webapps/ work/ temp/ logs/
root@brainiac-desktop:/usr/local/apache-tomcat-9.0.6#

root@brainiac-desktop:/usr/local/apache-tomcat-9.0.6# update-java-alternatives -l
java-1.8.0-openjdk-amd64 1081 /usr/lib/jvm/java-1.8.0-openjdk-amd64
java-1.9.0-openjdk-amd64 1091 /usr/lib/jvm/java-1.9.0-openjdk-amd64
java-8-oracle 1081 /usr/lib/jvm/java-8-oracle

root@brainiac-desktop:/usr/local/apache-tomcat-9.0.6# nano /etc/systemd/system/tomcat.service

[Unit]
Description=Apache Tomcat Web Application Container
After=network.target

[Service]
Type=forking

Environment=JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre
Environment=CATALINA_PID=/usr/local/apache-tomcat-9.0.6 /temp/tomcat.pid
Environment=CATALINA_HOME=/usr/local/apache-tomcat-9.0.6
Environment=CATALINA_BASE=/usr/local/apache-tomcat-9.0.6
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'

ExecStart=/usr/local/apache-tomcat-9.0.6/bin/startup.sh
ExecStop=/usr/local/apache-tomcat-9.0.6/bin/shutdown.sh

User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always

[Install]
WantedBy=multi-user.target
F2 S(sim)
Next, reload the systemd daemon so that it knows about our service file:
root@brainiac-desktop:/usr/local# systemctl daemon-reload
root@brainiac-desktop:/usr/local# systemctl start tomcat
To ensure the Tomcat service re-starting at boot, you have to enable it:
root@brainiac-desktop:/usr/local# systemctl enable tomcat


root@brainiac-desktop:/usr/local/apache-tomcat-9.0.6/conf# ls
Catalina context.xml logging.properties tomcat-users.xsd
catalina.policy jaspic-providers.xml server.xml web.xml
catalina.properties jaspic-providers.xsd tomcat-users.xml

root@brainiac-desktop:/usr/local/apache-tomcat-9.0.6/conf# nano tomcat-users.xml
colar dentro da tag <tomcat-users> </tomcat-users>:
<role rolename="manager-gui"/>
<user username="tomcat" password="tomcat" roles="manager-gui,admin-gui"/>
F2 S(sim)
root@brainiac-desktop:/usr/local/apache-tomcat-9.0.6/conf# systemctl restart tomcat
No browser digite localhost:8080
http://tinypic.com/view.php?pic=b7c0mq&s=9#.WrT6itYh0b0

Clicando com user tomcat e pass tomcat:
http://tinypic.com/view.php?pic=30sbw1x&s=9#.WrT7UtYh0b0


3. Re: Java Web - Tomcat não carrega no Eclipse Ubuntu

Marco Brainiac
mbrainiac

(usa Debian)

Enviado em 23/03/2018 - 10:12h

Configuração no Eclipse:
http://tinypic.com/view.php?pic=kc04t4&s=9#.WrT8bdYh0b0

Não parece em libraries o tomcat e webapp:
http://tinypic.com/view.php?pic=raxijd&s=9#.WrT9EtYh0b0

Dei stop no terminal e ele aparenta estar ok no eclipse:
http://tinypic.com/view.php?pic=qy9ymd&s=9


Por favor me ajudem, não quero voltar ao Windows!!


4. Re: Java Web - Tomcat não carrega no Eclipse Ubuntu

Marco Brainiac
mbrainiac

(usa Debian)

Enviado em 24/03/2018 - 18:32h

Resolvido, desinstalei no Eclipse Neon e instalei o Oxygen.

Em breve lançarei um tutorial completo para instalação do Apache Tomcat e Eclipse, mantendo o conceito de software livre e troca de informações!

Obrigado






Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts