I already read a number of related questions, but i did not get to a solution for my situation.
I have a webapp in a war-file that includes the version number. E.g.,sourceWarName.war. I cannot use remote deployment, the war file will be deployed manually over the tomcat manager web-interface. I would like the webapp to be accessible over a static path (decoupled from the version), e.g, http://someserver:8080/targetPath
As specified in tomcat docs and stack overflow question, it is possible to create a context.xml in my application's META-INF folder like this:
<Context path="targetPath" debug="0" reloadable="true">
...
</Context>
The file is then supposed to be copied to /tomcat7/conf/Cataline/localhost/sourceWarName-1.0.0.xml. This does not work, however. No xml file is copied. I configured the host-entry in the server.xml to make sure we do not run into double-deployment like this:
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="false" deployOnStartUp="false" copyXml="true">
The app, however, is still reachable under /sourceWarName-1.0.0.
What did i miss?
I tried the answer to this question, but this did not work out for me. Only difference seems to be the docBase.
Tomcat doc says about docBase:
The value of this field must not be set unless the Context element is
defined in server.xml or the docBase is not located under the Host's
appBase.
I do not have a context element in server.xml and the appBase is the same.
Running Apache Tomcat/7.0.52 (Ubuntu).
Related
Tomcat8 is set to run as a service on ubuntu
I have deployed an application in tomcat8, I want the app to load(dev,local,prod)environment specific propety file
Which config file should I set -Dspring.profiles.active=\"prod\" value so the correct property file is read.
I tried in catalina.sh as JAVA_OPTS="$JAVA_OPTS -Dspring.profiles.active=\"prod\""
and also in /etc/default/tomcat8
In setenv.sh
CATALINA_OPTS="-Dspring.profiles.active=prod ...a whole bunch of stuff might already be here"
I have this servlet-mapping below. But whenever I access the url, it's always 404 Not Found.
<servlet-mapping>
<servlet-name>equinoxbridgeservlet</servlet-name>
<url-pattern>/console/*</url-pattern>
</servlet-mapping>
To give you an idea, I'm deploying an ear file with multiple war files. This also requires a security. After entering the correct credentials, I'm encountering 404 Not Found.
I'm not able to find anything from the log file as well. It's also working in jboss 5 but not in wildfly 9 or 10.
Yes that is a known "issue" or feature depends how you look at it.
To fix your problem, open standalone.xml locate undertow subsystem.
and add disable-console-redirect="true"
to <host name="default-host" ...
or in CLI execute:
/subsystem=undertow/server=default-server/host=default-host:write-attribute(name=disable-console-redirect, value=true)
or similar if you what to do that for different host/server
I modified the file conf/server.xml like this below
<Context path="AA" docBase="BB" reloadable="true" />
when I start tomcat from a shell file publish.sh:
#!/bin/bash
#defined
TOMCAT_HOME="/root/software/apache-tomcat-7.0.29"
#start tomcat
cd "$TOMCAT_HOME"/bin
sh startup.sh
echo "tomcat is starting,please try to access $PROJECT console url"
tomcat publish two projects under path "webapps/",AA and BB。And I tracked that BB was published after AA.
If you logged on the terminal , and start tomcat directly in the directory "$TOMCAT_HOME"/bin with command:
>./startup.sh
Only one project "BB" under path "webapps/"。
Who can tell me Why? Thanks!
You have double-deployed your web application.
How? Well, you put BB.war into webapps/ (which will be auto-deployed to /BB) and then you put <Context path="AA" docbase="BB"> into server.xml which deployed BB.war to /AA. What did you expect?
If you just want your application to be deployed to /AA, then just re-name the WAR file to AA.war and be done with it: take-out the <Context> in server.xml because it's just making your job harder. This is why it's explicitly recommended not to do that.
I edited context path in TomCat server.xml, so that my webapps/app is displayed as root app instead of TomCat app on mysite.com (not mysite.com/app). In my app i have some .jsp files that are displayed correctly (mysite.com/main, /register) but some sites give me 404 error (mysite.com/home, /rxmsg, /signout).
Yet when i go to mysite.com/app/home, everything works perfectly
Every URL like this works perfectly in local (localhost:8080/home)
My git pushes are transfered to tomcat_home/webapps/ via jenkins
What causes some urls to 404?
Redirects are made by
return "redirect:main"; //URL is changing
or
return "main"; //URL not changing
I managed to find the problem
In my tomcat server.xml changed
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
to
<Host name="mysite.com" appBase="webapps"
unpackWARs="true" autoDeploy="true">
and restarted my service.
BUT doing so, I cannot test my code on localhost now.
Simply create both Host tags and set localhost as the default host in the Engine tag:
<Engine defaultHost="localhost" ...
Kind of a noob with tomcat 7, how do you implement this setting found here: http://tomcat.apache.org/tomcat-7.0-doc/config/host.html#Common_Attributes
Trying to set unpackWARs to true so i dont have to manually unpack a war to deploy it, but have no idea where to do this.
This setting can be found in server.xml under your Tomcat 7 configuration directory. For example, on Ubuntu, this is /etc/tomcat7/server.xml, and the setting is part of the <Host> element:
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">