rabolfazl
rabolfazl

Reputation: 552

Defining alias for Tomcat Context inside web application

I have set up a Tomcat 8.0 with two Hosts:

  <Realm className="org.apache.catalina.realm.LockOutRealm">
    <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
           resourceName="UserDatabase"/>
  </Realm>

  <Host name="sub1.mydomain.com"  appBase="sub1"
        unpackWARs="true" autoDeploy="true">
  </Host>

  <Host name="sub2.mydomain.com"  appBase="sub2"
        unpackWARs="true" autoDeploy="true">
  </Host>

The application deployed to sub1 has a META-INF/context.xml with the following setting:

<Context path="/" aliases="/upload=/home/myuser/somepath"></Context>

where /upload is used inside the webapp as a virtual path to save uploaded files. When the application is started this warning is shown:

org.apache.catalina.startup.SetContextPropertiesRule.begin [SetContextPropertiesRule]{Context}     
Setting property 'aliases' to '/upload=/home/myuser/somepath' did not find a matching property

and when I save a file in /upload in the application it is simply saved in upload directory inside the deployed application (instead of being saved in /home/myuser/somepath). This setting used to work when there were not two Hosts. Is is a bug or this feature does not work in this configuration or it is some misconfiguration?

Upvotes: 1

Views: 5373

Answers (1)

Kayaman
Kayaman

Reputation: 73528

You'll note from the error message and from Tomcat 8 documentation here, that the aliases property no longer exists.

Refer to The Migration Guide to fix it (and possible other problems).

Upvotes: 1

Related Questions