tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jim ma <mail2ji...@gmail.com>
Subject MapListener update
Date Wed, 15 Jul 2009 02:48:51 GMT
Hi ,

When I update my code for embedding tomcat 5.x to embedding 6.x, a null
pointer exception blocks me .
I dug the code , I found it cause by the
org.apache.catalina.connector.MapperListener difference :

Tomcat5.x
-------------------
    /**
     * Register host.
     */
    private void registerHost(ObjectName objectName)
        throws Exception {
        String name=objectName.getKeyProperty("host");
        if( name != null ) {
            String[] aliases = (String[])
                mBeanServer.invoke(objectName, "findAliases", null, null);
            mapper.addHost(name, aliases, objectName);
            if(log.isDebugEnabled())
                log.debug(sm.getString
                     ("mapperListener.registerHost", name, domain));

        }
    }

Tomcat6.x
-----------------
    /**
     * Register host.
     */
    private void registerHost(ObjectName objectName)
        throws Exception {
        String name=objectName.getKeyProperty("host");
        if( name != null ) {
            Host host = (Host) ServerFactory.getServer().findService(
                    domain).getContainer().findChild(name);
            String[] aliases = host.findAliases();
            mapper.addHost(name, aliases, objectName);
            host.addContainerListener(this);
            if(log.isDebugEnabled())
                log.debug(sm.getString
                     ("mapperListener.registerHost", name, domain));

        }
    }


Is this change to fix an issue ? Or Tomcat6.x totally change the host name
looking up mechanism .
Could you also point to me where can I find the Tomcat6.x document about
difference with Tomcat5.x if there is ? for example architecture , execution
etc.

Thanks in advance .

Jim Ma

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message