You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2010/01/25 23:44:49 UTC

DO NOT REPLY [Bug 48612] New: java.net.Inet4Address cannot be cast to java.lang.String

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: tmccune@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.Connector@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 48612] java.net.Inet4Address cannot be cast to java.lang.String

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48612

--- Comment #1 from Mark Thomas <ma...@apache.org> 2010-02-01 09:40:44 GMT ---
This was already fixed in trunk by the fix for bug48424. I have fixed the
swallowed exception in trunk and proposed both fixes for 6.0.x

-- 
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 48612] java.net.Inet4Address cannot be cast to java.lang.String

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48612

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #2 from Mark Thomas <ma...@apache.org> 2010-02-18 10:47:55 UTC ---
This has been fixed in 6.0.x and will be included in 6.0.25 onwards.

-- 
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org