I'm trying to deploy the WAR file of Apache Shindig to an apt-installed Tomcat 6 server on Ubuntu 10.04. Unfortunately, when it writes out things like <script> tags, all the URLs are http://localhost/..., even though I think I've told Tomcat that this server has an external name. The non-comment contents of my server.xml file are here. This is essentially the default configuration, save for that I've changed all instances of localhost to my.external.hostname (of course, my actual hostname in the actual configuration file).

How do I get Tomcat6/Shindig to realize that it lives at my.external.hostname so it doesn't refer to http://localhost/...?

<?xml version='1.0' encoding='utf-8'?>

<Server port="8005" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.core.JasperListener" />
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
    <Resource name="UserDatabase" auth="Container"
              description="User database that can be updated and saved"
              pathname="conf/tomcat-users.xml" />
  <Service name="Catalina">
    <Connector port="8080" protocol="HTTP/1.1" 
               redirectPort="8443" />
    <!-- *** THIS IS WHERE IT GETS INTERESTING: hostname set here: -->
    <Engine name="Catalina" defaultHost="my.external.hostname">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
      <!-- *** and here: -->
      <Host name="my.external.hostname"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

Have you seen this bug entry Shindig Jira Issue 272? At least in last December there were no news on a potential resolution. Obviously some hard coded paths are in the way of using a different servlet container than Jetty if your hostname should not be localhost. There is a temporary solution described in the Jira ticket. Does it work for you?

  • That seems to deal more with the path in the deployment; I have mine at ROOT... – Paul Fisher Feb 6 '11 at 19:21

It turns out that there's a separate settings file for Shindig that isn't mentioned in the setup documentation. You have to edit the WEB-INF/classes/containers/default/container.js file in order to change the host name. There are a bunch of places that use ${HOST_NAME} or localhost, which I changed to my.external.hostname. Now it works!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.