java.lang.NoSuchMethodException: java.util.Collections$UnmodifiableMap.<init>()

Spring JIRA | Mike Youngstrom | 1 decade ago
  1. 0

    [SPR-1986] Cannot inject a map without a default constructor such as UnmodifiableMap into a bean. - Spring JIRA

    spring.io | 1 year ago
    java.lang.NoSuchMethodException: java.util.Collections$UnmodifiableMap.<init>()
  2. 0

    This bug exist in latest head checkout a couple of days before I created this bug. Test Case: <bean id="map" class="java.util.HashMap"/> <bean id="unmodifiableMap" class="java.util.Collections" factory-method="unmodifiableMap"> <constructor-arg ref="map"/> </bean> <bean id="unmodifiableMap2" class="java.util.Collections" factory-method="unmodifiableMap" lazy-init="false"> <constructor-arg ref="unmodifiableMap"/> </bean> Exception: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'unmodifiableMap2' defined in ServletContext resource [/WEB-INF/spring-contexts/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [java.util.Collections$UnmodifiableMap]: No default constructor found; nested exception is java.lang.NoSuchMethodException: java.util.Collections$UnmodifiableMap.<init>() org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [java.util.Collections$UnmodifiableMap]: No default constructor found; nested exception is java.lang.NoSuchMethodException: java.util.Collections$UnmodifiableMap.<init>() java.lang.NoSuchMethodException: java.util.Collections$UnmodifiableMap.<init>() at java.lang.Class.getConstructor0(Unknown Source) at java.lang.Class.getDeclaredConstructor(Unknown Source) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:149) at org.springframework.beans.PropertyTypeConverter.convertToTypedMap(PropertyTypeConverter.java:316) at org.springframework.beans.PropertyTypeConverter.convertIfNecessary(PropertyTypeConverter.java:188) at org.springframework.beans.PropertyTypeConverter.convertIfNecessary(PropertyTypeConverter.java:124) at org.springframework.beans.BeanWrapperImpl.doTypeConversionIfNecessary(BeanWrapperImpl.java:792) at org.springframework.beans.factory.support.AbstractBeanFactory.doTypeConversionIfNecessary(AbstractBeanFactory.java:673) at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:371) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:235) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:520) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:373) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:241) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:152) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:253) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:331) at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:155) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3727) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4162) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012) at org.apache.catalina.core.StandardHost.start(StandardHost.java:718) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442) at org.apache.catalina.core.StandardService.start(StandardService.java:450) at org.apache.catalina.core.StandardServer.start(StandardServer.java:700) at org.apache.catalina.startup.Catalina.start(Catalina.java:551) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:275) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

    Spring JIRA | 1 decade ago | Mike Youngstrom
    java.lang.NoSuchMethodException: java.util.Collections$UnmodifiableMap.<init>()
  3. 0

    This bug exist in latest head checkout a couple of days before I created this bug. Test Case: <bean id="map" class="java.util.HashMap"/> <bean id="unmodifiableMap" class="java.util.Collections" factory-method="unmodifiableMap"> <constructor-arg ref="map"/> </bean> <bean id="unmodifiableMap2" class="java.util.Collections" factory-method="unmodifiableMap" lazy-init="false"> <constructor-arg ref="unmodifiableMap"/> </bean> Exception: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'unmodifiableMap2' defined in ServletContext resource [/WEB-INF/spring-contexts/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [java.util.Collections$UnmodifiableMap]: No default constructor found; nested exception is java.lang.NoSuchMethodException: java.util.Collections$UnmodifiableMap.<init>() org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [java.util.Collections$UnmodifiableMap]: No default constructor found; nested exception is java.lang.NoSuchMethodException: java.util.Collections$UnmodifiableMap.<init>() java.lang.NoSuchMethodException: java.util.Collections$UnmodifiableMap.<init>() at java.lang.Class.getConstructor0(Unknown Source) at java.lang.Class.getDeclaredConstructor(Unknown Source) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:149) at org.springframework.beans.PropertyTypeConverter.convertToTypedMap(PropertyTypeConverter.java:316) at org.springframework.beans.PropertyTypeConverter.convertIfNecessary(PropertyTypeConverter.java:188) at org.springframework.beans.PropertyTypeConverter.convertIfNecessary(PropertyTypeConverter.java:124) at org.springframework.beans.BeanWrapperImpl.doTypeConversionIfNecessary(BeanWrapperImpl.java:792) at org.springframework.beans.factory.support.AbstractBeanFactory.doTypeConversionIfNecessary(AbstractBeanFactory.java:673) at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:371) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:235) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:520) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:373) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:241) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:152) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:253) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:331) at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:155) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3727) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4162) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012) at org.apache.catalina.core.StandardHost.start(StandardHost.java:718) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442) at org.apache.catalina.core.StandardService.start(StandardService.java:450) at org.apache.catalina.core.StandardServer.start(StandardServer.java:700) at org.apache.catalina.startup.Catalina.start(Catalina.java:551) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:275) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

    Spring JIRA | 1 decade ago | Mike Youngstrom
    java.lang.NoSuchMethodException: java.util.Collections$UnmodifiableMap.<init>()
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Spring Security Java NoSuchMethodException: SecurityConfig.()

    Stack Overflow | 3 years ago | TiarĂª Balbi
    java.lang.NoSuchMethodException: org.springframework.security.access.SecurityConfig.&lt;init&gt;()
  6. 0

    Exception while starting up the server : java.lang.NoSuchMethodException: org.springframework.security.authentication.ProviderManager.<init>()

    Stack Overflow | 1 year ago | Pallav Jha
    java.lang.NoSuchMethodException: org.springframework.security.authentication.ProviderManager.<init>()

  1. empt-ak 1 times, last 1 month ago
  2. Luka 12 times, last 2 months ago
  3. andyglick 28 times, last 2 months ago
  4. ruifung 1 times, last 3 months ago
  5. Shadd518 1 times, last 3 months ago
8 more registered users
47 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.NoSuchMethodException

    java.util.Collections$UnmodifiableMap.<init>()

    at java.lang.Class.getConstructor0()
  2. Java RT
    Class.getDeclaredConstructor
    1. java.lang.Class.getConstructor0(Unknown Source)
    2. java.lang.Class.getDeclaredConstructor(Unknown Source)
    2 frames
  3. Spring Beans
    DefaultListableBeanFactory.preInstantiateSingletons
    1. org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:149)
    2. org.springframework.beans.PropertyTypeConverter.convertToTypedMap(PropertyTypeConverter.java:316)
    3. org.springframework.beans.PropertyTypeConverter.convertIfNecessary(PropertyTypeConverter.java:188)
    4. org.springframework.beans.PropertyTypeConverter.convertIfNecessary(PropertyTypeConverter.java:124)
    5. org.springframework.beans.BeanWrapperImpl.doTypeConversionIfNecessary(BeanWrapperImpl.java:792)
    6. org.springframework.beans.factory.support.AbstractBeanFactory.doTypeConversionIfNecessary(AbstractBeanFactory.java:673)
    7. org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:371)
    8. org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:235)
    9. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:520)
    10. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:373)
    11. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:241)
    12. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:152)
    13. org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:253)
    13 frames
  4. Spring Context
    AbstractApplicationContext.refresh
    1. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:331)
    1 frame
  5. Spring
    ContextLoaderListener.contextInitialized
    1. org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:155)
    2. org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
    3. org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
    4. org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
    4 frames
  6. Glassfish Core
    Catalina.start
    1. org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3727)
    2. org.apache.catalina.core.StandardContext.start(StandardContext.java:4162)
    3. org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
    4. org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
    5. org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
    6. org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
    7. org.apache.catalina.core.StandardService.start(StandardService.java:450)
    8. org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
    9. org.apache.catalina.startup.Catalina.start(Catalina.java:551)
    9 frames
  7. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    4. java.lang.reflect.Method.invoke(Unknown Source)
    4 frames
  8. Glassfish Core
    Bootstrap.main
    1. org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:275)
    2. org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    2 frames