https://issues.apache.org/bugzilla/show_bug.cgi?id=48612

           Summary: java.net.Inet4Address cannot be cast to
                    java.lang.String
           Product: Tomcat 6
           Version: 6.0.24
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: tmcc...@yahoo-inc.com


When I stop Tomcat, I get the following error message:

2010-01-25 14:33:52,891 ERROR
[org.apache.catalina.mbeans.ServerLifecycleListener] destroyMBeans: Throwable
javax.management.MalformedObjectNameException: Cannot create object name for
org.apache.catalina.connector.connec...@1d49247 java.lang.ClassCastException:
java.net.Inet4Address cannot be cast to java.lang.String
  at
org.apache.catalina.mbeans.MBeanUtils.createObjectName(MBeanUtils.java:758)
  at org.apache.catalina.mbeans.MBeanUtils.destroyMBean(MBeanUtils.java:1412)
  at
org.apache.catalina.mbeans.ServerLifecycleListener.destroyMBeans(ServerLifecycleListener.java:678)
  at
org.apache.catalina.mbeans.ServerLifecycleListener.destroyMBeans(ServerLifecycleListener.java:1005)
  at
org.apache.catalina.mbeans.ServerLifecycleListener.destroyMBeans(ServerLifecycleListener.java:971)
  at
org.apache.catalina.mbeans.ServerLifecycleListener.lifecycleEvent(ServerLifecycleListener.java:154)
  at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
  at org.apache.catalina.core.StandardServer.stop(StandardServer.java:748)
  at org.apache.catalina.startup.Catalina.stop(Catalina.java:643)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at org.apache.catalina.startup.Bootstrap.stop(Bootstrap.java:301)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at org.apache.commons.daemon.support.DaemonLoader.stop(DaemonLoader.java:200)

There are actually 2 errors here; the problem that is causing the exception
shown above, and the fact that the catch block that logs the exception is
swallowing the original exception and stack trace.

I changed:

} catch (Exception e) {
  throw new MalformedObjectNameException("Cannot create object name for " +
connector + e);
}

to

} catch (Exception e) {
   MalformedObjectNameException tim = new MalformedObjectNameException
       ("Cannot create object name for " + connector);
   tim.initCause(e);
   throw tim;
}

and determined the actual cause of the exception:

Caused by: java.lang.ClassCastException: java.net.Inet4Address cannot be cast
to java.lang.String
  at
org.apache.catalina.mbeans.MBeanUtils.createObjectName(MBeanUtils.java:745)

MBeanUtils.java line 745 looks like this:

String address = (String)
                IntrospectionUtils.getProperty(connector, "address");

The "address" property on the Http 1.1 connector is indeed of type
Inet4Address, and not of type String.  In the Tomcat 6.0.20 source, the line
above was wrapped inside of the following check:

if (connector.getClass().getName().indexOf("CoyoteConnector") >= 0 ) {

on line 737.  In the Tomcat 6.0.24 source, this check was removed, and this
causes the exception reported above.

Here is my <Connector> element from my server.xml if that helps:

<Connector allowTrace="false" emptySessionPath="false" enableLookups="false"
maxPostSize="2097152" maxSavePostSize="4096" redirectPort="-1" scheme="http"
secure="false" URIEncoding="UTF-8" acceptCount="100" address="0.0.0.0"
bufferSize="2048" compressableMimeType="text/html,text/xml,text/plain"
compression="off" connectionLinger="-1" connectionTimeout="20000"
disableUploadTimeout="true" maxHttpHeaderSize="8192" maxKeepAliveRequests="1"
maxSpareThreads="50" maxThreads="200" minSpareThreads="4"
noCompressionUserAgents="" port="4080" restrictedUserAgents=""
socketBuffer="9000" strategy="ms" tcpNoDelay="true"
threadPriority="java.lang.Thread#NORM_PRIORITY" server="Apache"/>

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to