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">
Related
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 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).
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" ...
I've been trying to find a solution to what I think should be a very common use of Alias with Tomcat & Apache Httpd but I can't find it.
I have Tomcat running my application server and I want to be able to use aliases to serve dynamic content. I configured Apache Httpd as the front end with Mod_JK to serve all dynamic files via Tomcat. This works fine except when using aliases as Tomcat doesn't know how to handle the Alias.
Basically I have my Tomcat application /webapps/myApp inside that I have "/folderA" so using http:localhost:8080/myApp/folderA works fine as well as localhost/myApp/folderA. I want to be able to user /folderB to point to /folderA and serve dynamic content and that's when things fail.
I have everything working well with mod_jk and the alias requests get redirected to Tomcat, however Tomcat does not know what to do with the alias so it tries to find /webapps/myApp/folderB which doesn't exists so I get a "file not found" error.
I tried using a <Context path... but then I get served static content. I also tried using Apache RewriteRule to pass requests from /folderB to /folderA but that doesn't work either. Below is an example of the VirtualHost settings I have. I'm guessing I need to do something in Tomcat's end so that it knows how to handle /folderB and point it to /folderA OR to make httpd translate /folderB to /folderA before passing the info to Tomcat.
Any help is appreciated. Thanks!
<VirtualHost *:80>
DocumentRoot "/webapps/ROOT"
Alias /folderB "webapps/ROOT/folderA"
JkMount /folderB/* myWorker
ServerName myServer.local
ServerAlias www.myServer.local
ErrorLog "logs/myServer.local-error.log"
</VirtualHost>
Really late, but I have the same problem and here is a working solution: The Alias within the VirtualHost is ignored for all files handled by the mod_jk.
Update your tomcat/conf/server.xml and add a Context to your Host:
<Host name="your-domain.com" appBase="webapps">
<!-- root path -->
<Context path="" docBase="/your/app/" />
<!-- alias for folderB -->
<Context path="/folderB" docBase="/your/app/somewhere/else/folderb/" />
</Host>
This really confuses me, because ColdFusion and the Connector know the Apache Aliases. I will update my answer if I have any progress..