I feel like I’m attempting to accomplish a pretty simple task but I’m stumped. I’m attempting to use the Tomcat Manage App to deploy my app and then route my root domain name to point to that deployment.
Specifically, the app currently deployed at http://www.schmud.de/home/ should load when a person types http://www.schmud.de into their browser.
I tried deploying and configuring this in CPanel with no luck. It seems that the Tomcat Manage App interface or Host Manager interface is what I’m supposed to be use to configure my routing?
My .htaccess currently looks like this:
SetHandler jakarta-servlet
SetEnv JK_WORKER_NAME ajp13
My web.xml is generated by Clojure.
There is no way to do it within the Tomcat Web Interface nor the .htaccess file. The user must have deeper access on a CPanel system.
Assuming that you have deployed your application as "app" and configured your .htaccess as I described above, here are the specific instructions I gave my root admin to solve the routing issue:
open /usr/local/easy/share/easy-tomcat7/conf/server.xml
Under the <Host> tag add this:
<Context path="" docBase=“app” debug="0" reloadable="true" />
Restart the server
Upon restart, http://domain.com/ should load my homepage (just as http://domain.com/app/ does now)
Related
Today I have a problem reading the server.xml config file from Tomcat. What I mean by that is I want to verify the app context on server start so the app will know which configuration file to look for.
For example: I have in my Tomcat server configuration set a context for my app "/myapp". So it will be accessible by the :8080/myapp.
No I want my Java application to read the server.xml file on Tomcat startup, so it will look more-or-less like this:
- Tomcat is starting,
- App is checking the server.xml file for itself context parameter, and finds that it's "/myapp",
- Using the above context - the app looks for file /CATALINA_BASE/conf/myapp.conf.
I can't base on the URI because the app starting with Tomcat and doesn't require to open the web browser, so no URI is provided on startup.
Thank you in advance!
Tom
You shouldn't parse server.xml, as it's not guaranteed that your app is declared there (in fact, it's bad style to do so). The application's context path can be determined within a ServletContextListener from ServletContext.getContextPath().
totally new to deploying apps with websockets so I feel like I'm missing something. I'm using Tomcat 8.5 on a Debian 8 instance. Steps I've done to deploy it on GCE:
Used the Click to Deploy for Tomcat.
Uploaded my .war file onto the deployed site.
Promoted the instance's IP to static.
Added firewall rule on port 80 with the target 'websocket'
Made a load balancer on the instance group of the server's instance. (Not quite sure if that helps or if I set it up right)
The load balancer looks like this.
My javascript creates the websocket like this (VDMServer is the name of the .war):
var websocket = new WebSocket("ws://[EXTERNALIP]/VDMServer/gameServerEndpoint");
And here's how I made the server endpoint class:
#ServerEndpoint("/gameServerEndpoint")
public class GameServerEndpoint {
...
}
I am able to access the website on the virtual instance's external IP and the pages of my app, but even trying Tomcat's websocket examples give the error:
Error during WebSocket handshake: Unexpected response code: 404
Also here's how my Connecter in my server.xml looks like in /var/lib/tomcat8/conf:
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
Also seen solution about not including the javax websocket library so I made sure not to do that. Here's what my .war's lib folder looks like. That shouldn't affect the tomcat examples though right?
Any help on this case would be much appreciated, been looking for a way to fix this all day yesterday. Thanks!
In my case it worked when I deployed a war without exporting any sources file.
I am not clear on the following:
If we have a web application named: SomeWebApp under Tomcat's webapp directory, the url to access it is:
http://localhost:8080/SomeWebApp
My question is, is it possible to configure Tomcat so that other URLs would point to that web application?
E.g.
http://localhost:8080/ADifferentApp will also point to the SomeWebApp?
From the web.xml I think is not possible since it is about the url patterns when you are inside the SomeWebApp scope.
So what is the proper way to do it? If it is possible that is.
The approach I found to work best is to install Apache2 on the server and proxy all requests. Tomcat is surprisingly difficult to configure in other ways than intended. In my experience, Tomcat doesn't provide this functionality declaratively.
I'd rather recommend Nginx than Apache as proxy. I'm recently working on a project that incorporates tomcat and nginx works as proxy.
Once you've got nginx you can acctualy map as many url's to access the same web application as you want.
Yes,its possible to map different context path to single application edit conf/server.xml file
> **> <Context docBase="D:\Servers\apache-tomcat-7\webapps\SomeWebApp"
> > path="/SomeWebApp" />
> > <Context docBase="D:\Servers\apache-tomcat-7\webapps\SomeWebApp" path="/ADifferentApp "/>**
Access application with 2 URL's
I have a web application project which is deployed in tomcat 6.
I can access my application using the url:
http://localhost:8082/MyApplication
I also wan't to be able to access this application by another url like:
http://localhost:8082/myapp
Is this possible ? if yes what alternatives do i have ?
Off course, I don't want to change the original name of the application('MyApplication').
Thanks,
Abhishek.
If you add the Context within server.xml it will work as you want. Give the path attribute you wish.
<Context docBase="MyApplication" path="/myapp" />
Though it works, this approach is not recommended by the Tomcat docs, since any changes to server.xml means restarting the server disturbing all the web apps.
But, on the flip side, the practice of keeping this in Catalina_Home/conf/Catalina/localhost/context.xml (which is recommended by the docs) has some unreliabilities as others have reported - when you redeploy the war you can lose the context.xml too
See Why-does-tomcat-replace-context-xml-on-redeploy and
Why does tomcat like deleting my context.xml file?
I'm developing a Flex 3.4 app that interops with a Java EE backend running on a JBoss-4.2.2 server, through the most recent release of BlazeDS. When I ran the Flex app from Flash Builder 4 beta 2 on Tomcat, everything was fine, the Flex app was able to make the remote call needed. But my production environment is on JBoss, and when I moved the app to JBoss (with services-config.xml updated to fit JBoss), the Flex app keeps complaining Client.Error.MessageSend upon remote calls.
At first, when I manually deployed the app to JBoss, the faultDetail was "Channel.Security.Error error Error #2048 ... "; later I tried to run the app from Flash Builder, and then faultDetail became "Channel.Connect.Failed error NetConnection.Call.BadVersion".
In services-config.xml, under <security>, was:
<login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat"/>
when moving to JBoss, I updated it to:
<login-command class="flex.messaging.security.TomcatLoginCommand" server="JBoss"/>
I have a crossdomain.xml placed in JBoss' deploy folder, as follows:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy
SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>
But looks like it doesn't work. I've also tried to put crossdomain.xml in deploy/xxxxx.war folder, and the problem remains.
I'm using http://, not https://, so I guess it's not about security channel.
Tried to search for a solution, but most solutions were PHP related, which wasn't really helpful. Any one got any clues?
You have
<login-command class="**flex.messaging.security.TomcatLoginCommand**" server="Tomcat"/>
Where the class indicates that security is of tomcat you should change it to a class that implements the interface flex.messaging.security.LoginCommand or any security interface blaze.
If you browse to http://your.application.root/crossdomain.xml, does the file load? The simplest configuration is to put the file at the root of the domain.