Bug 49883

Summary: java.lang.UnsupportedOperationException: The getName() method should never be called
Product: Tomcat 7 Reporter: Kevin <kevin>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: trunk   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Kevin 2010-09-04 22:58:52 UTC
Hi, I am running Tomcat trunk (revision 992708, 2010-09-03). I added this line to conf/logging.properties:

org.apache.catalina.level=FINEST

The server fails to start with:

Throwable occurred: java.lang.UnsupportedOperationException: The getName() method should never be called
	at org.apache.catalina.realm.CombinedRealm.getName(CombinedRealm.java:268)
	at org.apache.catalina.realm.RealmBase.toString(RealmBase.java:1015)
	at java.text.MessageFormat.subformat(MessageFormat.java:1258)
	at java.text.MessageFormat.format(MessageFormat.java:807)
	at org.apache.tomcat.util.res.StringManager.getString(StringManager.java:152)
	at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:320)
	at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:305)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:98)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:131)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1020)
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:276)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:429)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:649)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:584)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:600)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:416)
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:600)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:416)
Caused by: java.lang.UnsupportedOperationException: The getName() method should never be called
	at org.apache.catalina.realm.CombinedRealm.getName(CombinedRealm.java:268)
	at org.apache.catalina.realm.RealmBase.toString(RealmBase.java:1015)
	at java.text.MessageFormat.subformat(MessageFormat.java:1258)
	at java.text.MessageFormat.format(MessageFormat.java:807)
	at org.apache.tomcat.util.res.StringManager.getString(StringManager.java:152)
	at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:320)
	at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:305)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:98)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:131)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1020)
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:276)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:429)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:649)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:584)
	... 6 more


If I comment out that line in logging.properties, the server starts fine. Looking at the code in LifecycleBase line 320, it is a log.debug call:

        if (log.isDebugEnabled()) {
            log.debug(sm.getString("lifecycleBase.setState", this, state));
        }
Comment 1 Mark Thomas 2010-09-05 16:43:58 UTC
Thanks for the report.

This has been fixed in trunk and will be included in 7.0.3 onwards.