You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Deacon Marcus <de...@wwtech.pl> on 2001/06/09 00:26:50 UTC

Problems with aliased hosts (ver 4.0b5)

Hi,
I have:
  <Host name="d1.test" debug="0" appBase="/server/domains/d1.test/http"
unpackWARs="true">
    <Alias name="d2.test" />
in my server.xml. The goal is to have urls "http://d1.test/" and
"http://d2.test" pointing at the same webapp, with shared application-scope
objects, etc. Something like being able to get www.something.com and
something.com being equals. The problem is, while d1.test works exactly as
it should, d2.test gives me the default host (tomcat's docs in this case). I
have the same problem on tomcat 4.0b3 + win 98/se, 4.0b5 + win 98/se, and
4.0b5 + redhat 7.1, with jdk 1.3 and jdk 1.4. d1.test and d2.test are
aliases for 127.0.0.1 in /etc/hosts and /windows/hosts depending on
platform.

I hope I'm wrong, but it looks like <Alias/> is just not implemented ??

Is this a known problem? Is there any workaround? Could someone give me
working example of such configuration? This is critical to me, I have to
have it working next week.

Thanks in advance,
     deacon Marcus


RE: Problems with aliased hosts (ver 4.0b5)

Posted by Deacon Marcus <de...@wwtech.pl>.
I almost forgot - defining two hosts is out of question - some
application-scope objects wouldn't work.

> -----Original Message-----
> From: Deacon Marcus [mailto:deacon_marcus@wwtech.pl]
> Sent: Saturday, June 09, 2001 12:27 AM
> To: tomcat-dev@jakarta.apache.org
> Subject: Problems with aliased hosts (ver 4.0b5)
>
>
> Hi,
> I have:
>   <Host name="d1.test" debug="0" appBase="/server/domains/d1.test/http"
> unpackWARs="true">
>     <Alias name="d2.test" />
> in my server.xml. The goal is to have urls "http://d1.test/" and
> "http://d2.test" pointing at the same webapp, with shared
> application-scope
> objects, etc. Something like being able to get www.something.com and
> something.com being equals. The problem is, while d1.test works exactly as
> it should, d2.test gives me the default host (tomcat's docs in
> this case). I
> have the same problem on tomcat 4.0b3 + win 98/se, 4.0b5 + win 98/se, and
> 4.0b5 + redhat 7.1, with jdk 1.3 and jdk 1.4. d1.test and d2.test are
> aliases for 127.0.0.1 in /etc/hosts and /windows/hosts depending on
> platform.
>
> I hope I'm wrong, but it looks like <Alias/> is just not implemented ??
>
> Is this a known problem? Is there any workaround? Could someone give me
> working example of such configuration? This is critical to me, I have to
> have it working next week.
>
> Thanks in advance,
>      deacon Marcus


Re: Problems with aliased hosts (ver 4.0b5) - please help

Posted by Remy Maucherat <re...@apache.org>.
> Hi,
> 
> I think I got it, could someone please check and add it ?

I've just committed the fix.

Thanks !
Remy


RE: Problems with aliased hosts (ver 4.0b5) - please help

Posted by Deacon Marcus <de...@wwtech.pl>.
Hi,

I think I got it, could someone please check and add it ?

Class: org.apache.catalina.core.StandardHost:

-----
    public void addAlias(String alias) {

	alias = alias.toLowerCase();

	// Skip duplicate aliases
	for (int i = 0; i < aliases.length; i++) {
	    if (aliases[i].equals(alias))
		return;
	}

	// Add this alias to the list
	String newAliases[] = new String[aliases.length + 1];
	for (int i = 0; i < aliases.length; i++)
	    newAliases[i] = aliases[i];
	newAliases[aliases.length] = alias;

	// Inform interested listeners
	fireContainerEvent(ADD_ALIAS_EVENT, alias);

    }
-----
It should be:
-----
	// Add this alias to the list
	String newAliases[] = new String[aliases.length + 1];
	for (int i = 0; i < aliases.length; i++)
	    newAliases[i] = aliases[i];
	newAliases[aliases.length] = alias;

      aliases = newAliases; // <<== replace old array with new one

	// Inform interested listeners
	fireContainerEvent(ADD_ALIAS_EVENT, alias);
-----

Thanks in advance,
     deacon Marcus

> -----Original Message-----
> From: Remy Maucherat [mailto:remy@betaversion.org]
> Sent: Tuesday, June 12, 2001 12:35 AM
> To: tomcat-dev@jakarta.apache.org
> Subject: RE: Problems with aliased hosts (ver 4.0b5) - please help
>
>
> Quoting Deacon Marcus <de...@wwtech.pl>:
>
> > Hi,
> > Please, if you don't have the time to fix it or it's low priority let
> > me
> > know which classes control this behavior so I could try to fix it
> > myself.
>
> Oops, sorry. It's the J1 effect : don't put any urgent requests that week.
> I think you should have filed a bug.
>
> The host mapping is done in
> org.apache.catalina.core.StandardEngine/StandardEngineMapper.
>
> It may be a problem at init (maybe the alias list is incorrectly
> initialized)
> or runtime.
>
> Remy


RE: Problems with aliased hosts (ver 4.0b5) - please help

Posted by Remy Maucherat <re...@betaversion.org>.
Quoting Deacon Marcus <de...@wwtech.pl>:

> Hi,
> Please, if you don't have the time to fix it or it's low priority let
> me
> know which classes control this behavior so I could try to fix it
> myself.

Oops, sorry. It's the J1 effect : don't put any urgent requests that week.
I think you should have filed a bug.

The host mapping is done in 
org.apache.catalina.core.StandardEngine/StandardEngineMapper.

It may be a problem at init (maybe the alias list is incorrectly initialized) 
or runtime.

Remy

RE: Problems with aliased hosts (ver 4.0b5) - please help

Posted by Deacon Marcus <de...@wwtech.pl>.
Hi,
Please, if you don't have the time to fix it or it's low priority let me
know which classes control this behavior so I could try to fix it myself.

Thanks in advance,
     deacon Marcus

> -----Original Message-----
> From: Deacon Marcus [mailto:deacon_marcus@wwtech.pl]
> Sent: Saturday, June 09, 2001 12:27 AM
> To: tomcat-dev@jakarta.apache.org
> Subject: Problems with aliased hosts (ver 4.0b5)
>
>
> Hi,
> I have:
>   <Host name="d1.test" debug="0" appBase="/server/domains/d1.test/http"
> unpackWARs="true">
>     <Alias name="d2.test" />
> in my server.xml. The goal is to have urls "http://d1.test/" and
> "http://d2.test" pointing at the same webapp, with shared
> application-scope
> objects, etc. Something like being able to get www.something.com and
> something.com being equals. The problem is, while d1.test works exactly as
> it should, d2.test gives me the default host (tomcat's docs in
> this case). I
> have the same problem on tomcat 4.0b3 + win 98/se, 4.0b5 + win 98/se, and
> 4.0b5 + redhat 7.1, with jdk 1.3 and jdk 1.4. d1.test and d2.test are
> aliases for 127.0.0.1 in /etc/hosts and /windows/hosts depending on
> platform.
>
> I hope I'm wrong, but it looks like <Alias/> is just not implemented ??
>
> Is this a known problem? Is there any workaround? Could someone give me
> working example of such configuration? This is critical to me, I have to
> have it working next week.
>
> Thanks in advance,
>      deacon Marcus