I freshly installed Apache Tomcat via ansible on CentOS 7 VM but it seems that I can't access anything. I tried editing the tomcat-users.xml with
<?xml version="1.0" encoding="UTF-8"?>
<tomcat-users>
<role rolename="admin"/>
<role rolename="admin-gui"/>
<role rolename="manager"/>
<role rolename="manager-gui"/>
<user username="hultanu" password="hultanu" roles="admin,admin-gui,manager,manager-gui"/>
</tomcat-users>
Still nothing, it keep giving me 403 when I try to access "Server Status, Manager App or Host Manager". Any ideas?
Thank you !
I have just downloaded and installed a fresh/clean version of Apache 8.5.16, copied your tomcat-users.xml into my conf folder and able to browse to the server and login to the management/admin pages using the defined user (hultanu) perfectly fine. However this was done on my Windows 10 machine.
This plus the fact you are getting a 403 (Forbidden) rather than a 401 (Unauthorized) would make me think that your user settings are fine, but there is something more fundamentally wrong with your installation of Tomcat.
Are you able to browse to the tomcat instance when running and see the standard welcome screen (by default that would be localhost:8080)?
At what point do you get the 403 response (do you get asked for login details)?
Also - not sure if this is a duplicate of this question here
Related
I have a web-site that I have deployed locally on IIS/ColdFusion but Tomcat/Lucee in production (the production server is Windows Server). Tomcat is not running as a Windows Service
I am trying to set up virtual directories since IIS and Tomcat seem to handle relative paths differently. I have a virtual directory called "/style" set in IIS that points to my style sheet directory which works just fine. When I try to modify the server.xml file in Tomcat8, it never works.
I am using the following tag in my cfm header file:
<link rel="Stylesheet" media="screen" href="/style/styles.css">
Here is a portion of my server.xml file:
<Host name="127.0.0.1" appBase="webapps" unpackWARs="true" autoDeploy="true">
<context path="/style" docBase="C:\lucee\tomcat\webapps\ROOT\mysite\_style" ></context>
I have tried moving the context to different locations within the server.xml file, I have tried different context attributes. Nothing seems to work.
Any suggestions?
I used the information from the following link:
https://www.petefreitag.com/item/867.cfm
and used the following:
<Context path=""
docBase="C:\lucee\tomcat\webapps\ROOT"
WorkDir="C:\lucee\tomcat\temp">
<Resources>
<PreResources base="C:\lucee\tomcat\webapps\ROOT\mysite\_style"
className="org.apache.catalina.webresources.DirResourceSet"
webAppMount="/mysite/style"/>
</Resources>
</Context>
Im new to tomcat and I'm having issues launching my tomcat webapp.
I have tomcat setup on localhost:8081 and the tomcat main page comes up if I put localhost:8081 in the address bar after launching launch-tomcat.bat
I've been stuck on this issue for a week now so I'm going to try and provide as much information as possible. Please let me know if you needed any other additional information.
Any help is greatly appreciated.
If I try to go to http://localhost:8081/week12app_novak/
I get the following error.
Here's a screenshot of the directory path to the webapp.
Also here's a pastebin of catalina.2015-11-22.log http://pastebin.com/U2Dqjqhc
launch-tomcat.bat
setlocal
SET TOOLS_HOME=C:\projects\tools\
SET TOMCAT_HOME=tomcat\apache-tomcat-8.0.14-windows-x64\apache-tomcat-8.0.14
::SET CATALINA_HOME=D:\tools\java\tomcat\apache-tomcat-8.0.14-windows-x64\apache-tomcat-8.0.14
::SET CATALINA_HOME=C:\projects\tools\tomcat\apache-tomcat-8.0.14-windows-x64\apache-tomcat-8.0.14
SET CATALINA_HOME=%TOOLS_HOME%%TOMCAT_HOME%
SET JAVA_HOME=C:\Program Files\Java\jdk1.8.0_65
:: Start Tomcat
%CATALINA_HOME%\bin\startup.bat
endlocal
UPDATED IMAGE AFTER ADDED CODE TO WEB.XML
You didn't post your web.xml, but it probably does not have a welcome file list. If you don't supply one, Tomcat will look for index.html, index.htm, or index.jsp in the week12app_novak directory when you try to access http://localhost:8080/week12app_novak/.
You could rename user-accounts.html to index.html. Or you could add a welcome-file-list tag block to your web.xml.
<welcome-file-list>
<welcome-file>/user-accounts.html</welcome-file>
</welcome-file-list>
I have have a domain name (for example myapp.com) that I am using it to redirect to a web application (for exmple "myapp"), which is deployed on my tomcat server (for example in "myserver.es/myapp"). I added this fragment to the server.xml file of the tomcat to configure the redirection:
<Host name="myapp.com" appBase="webapps/myapp"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="/" docBase="."/>
<Alias>www.myapp.com</Alias>
</Host>
Apparently it is working good, if I write "mydomain.com" in the browser the app is shown correctly.
The problem: when I generate a new WAR file of that app and I upload it to the Tomcat server (after stopping and undeploying the previous version), the changes related with Java code are not shown. I have to restart my tomcat server to access to the last version of the app from "myapp.com".
In contrast, if I access to "mydomain.com/myapp", I can see the last version of the app, showing the changes made in the last WAR.
So, I think that the problem is related with the redirection. It is anything wrong with the previous XML code?
The other "Host" configured in the server.xml is this one:
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
You might be having issues with Parallel Deployement
You could set undeployOldVersions="true" inside your host to see if that works.
Finally, I've discovered the solution! I needed to set privileged="true" inside the Context tag.
I'd like run jsp files directly from /srv/http without deploying them the Tomcat-way. For example, I want to be able to create symbolic link to my webapp directory (e.g. /home/user/myapp/) in /srv/http and access some app's page through http://localhost/myapp/page.jsp.
Is this possible and how would I set this up?
NOTE: This is not for production. We have to use JSP at university and I want to be able to quickly test my pages.
Open the server.xml of your Tomcat. Assuming if your are using Tomcat 6.x+ then it would be at /tomcatDir/conf/server.xml.
Make an entry with your path
<Context path="/myapp" docBase="yourPathGoesHere" debug="0" reloadable="true" />
Restart Tomcat if already running.
What I did at the moment was creating a symlink in /var/lib/tomcatX/webapps to my project path. This is not the answer I was looking for though, but it is a way to deploy an app without much work.
(X in the above path means your Tomcat version)
If you set <Host name="localhost" appBase="/srv/http"> then all of the directories in it will be deployed as web applications.
If you want /srv/http to be the ROOT application/directory add a file: tomcat/conf/Catalina/localhost/ROOT.xml
with the Context docBase="/srv/http", rather than adding a Context definition to server.xml - this has been strongly discouraged for years.
I have a server app with Apache 2.2 (+mod_jk) + Apache Tomcat 6.0 that works fine. I can get to the web application's home page typing http://the_ip/application in the browser. But I want to access that page at the root address http://the_ip. Right now I am getting Tomcat's Root page
Can someone point me to a doc or posting that explains how to proceed with this?
Thanks
Peter
You want to set webapp application as the default web app (i.e. access it directly via http://localhost:8080/), then you can set the path as "" in Context within <Host> in server.xml
. This should work
<Context docBase="/var/lib/tomcat6/webapps/application/" path="" reloadable="true>
From the Tomcat docs,
If you specify a context path of an
empty string (""), you are defining
the default web application for this
Host, which will process all requests
not assigned to other Contexts
Note: From the Tomcat 6 docs http://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Introduction it is recommended not to put this in server.xml since you need to restart Tomcat for any changes.
The default web application may be
defined by using a file called
ROOT.xml
but i have not tried that option myself