org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean#1': FactoryBean threw exception on object creation; nested exception is java.lang.LinkageError: loader constraint violation: loader (instance of sun/misc/Launcher$AppClassLoader) previously initiated loading for a different type with name "javax/servlet/Servlet"

Spring JIRA | Oliver Lietz | 8 years ago
  1. 0

    [OSGI-596] java.lang.LinkageError/loader constraint violation: javax/servlet/Servlet - Spring JIRA

    spring.io | 11 months ago
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean#1': FactoryBean threw exception on object creation; nested exception is java.lang.LinkageError: loader constraint violation: loader (instance of sun/misc/Launcher$AppClassLoader) previously initiated loading for a different type with name "javax/servlet/Servlet"
  2. 0

    The error happens when using javax.servlet-servlet-api (2.4/2.5 or the Servlet-API from Spring's OSGified Artifacts Repository) as provided dependency and having javax.servlet and javax.servlet.http set as Import-Package for Bundle-Plugin. It's a plain bundle (no war) and no Spring OSGi Web stuff is used. javax.servlet is set as system package. No error before or after this exception. 05.08.2008 16:28:06 *ERROR* o.s.o.c.s.OsgiBundleXmlApplicationContext: Post refresh error org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean#1': FactoryBean threw exception on object creation; nested exception is java.lang.LinkageError: loader constraint violation: loader (instance of sun/misc/Launcher$AppClassLoader) previously initiated loading for a different type with name "javax/servlet/Servlet" at org.springframework.beans.factory.support.FactoryBeanRegistrySupport$1.run(FactoryBeanRegistrySupport.java:127) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:116) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:91) at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1285) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:217) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:425) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729) at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:276) at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:145) at java.lang.Thread.run(Thread.java:637) Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of sun/misc/Launcher$AppClassLoader) previously initiated loading for a different type with name "javax/servlet/Servlet" at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:675) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:316) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:288) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374) at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2427) at java.lang.Class.getDeclaredMethods(Class.java:1791) at org.springframework.aop.framework.JdkDynamicAopProxy.findDefinedEqualsAndHashCodeMethods(JdkDynamicAopProxy.java:128) at org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:116) at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110) at org.springframework.osgi.service.util.internal.aop.ProxyUtils.createProxy(ProxyUtils.java:60) at org.springframework.osgi.service.util.internal.aop.ProxyUtils.createProxy(ProxyUtils.java:37) at org.springframework.osgi.service.importer.support.AbstractServiceProxyCreator.createServiceProxy(AbstractServiceProxyCreator.java:107) at org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean.createProxy(OsgiServiceProxyFactoryBean.java:181) at org.springframework.osgi.service.importer.support.AbstractServiceImporterProxyFactoryBean.getObject(AbstractServiceImporterProxyFactoryBean.java:75) at org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean.getObject(OsgiServiceProxyFactoryBean.java:140) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport$1.run(FactoryBeanRegistrySupport.java:121) ... 12 common frames omitted

    Spring JIRA | 8 years ago | Oliver Lietz
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean#1': FactoryBean threw exception on object creation; nested exception is java.lang.LinkageError: loader constraint violation: loader (instance of sun/misc/Launcher$AppClassLoader) previously initiated loading for a different type with name "javax/servlet/Servlet"
  3. 0

    The error happens when using javax.servlet-servlet-api (2.4/2.5 or the Servlet-API from Spring's OSGified Artifacts Repository) as provided dependency and having javax.servlet and javax.servlet.http set as Import-Package for Bundle-Plugin. It's a plain bundle (no war) and no Spring OSGi Web stuff is used. javax.servlet is set as system package. No error before or after this exception. 05.08.2008 16:28:06 *ERROR* o.s.o.c.s.OsgiBundleXmlApplicationContext: Post refresh error org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean#1': FactoryBean threw exception on object creation; nested exception is java.lang.LinkageError: loader constraint violation: loader (instance of sun/misc/Launcher$AppClassLoader) previously initiated loading for a different type with name "javax/servlet/Servlet" at org.springframework.beans.factory.support.FactoryBeanRegistrySupport$1.run(FactoryBeanRegistrySupport.java:127) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:116) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:91) at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1285) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:217) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:425) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729) at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:276) at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:145) at java.lang.Thread.run(Thread.java:637) Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of sun/misc/Launcher$AppClassLoader) previously initiated loading for a different type with name "javax/servlet/Servlet" at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:675) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:316) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:288) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374) at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2427) at java.lang.Class.getDeclaredMethods(Class.java:1791) at org.springframework.aop.framework.JdkDynamicAopProxy.findDefinedEqualsAndHashCodeMethods(JdkDynamicAopProxy.java:128) at org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:116) at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110) at org.springframework.osgi.service.util.internal.aop.ProxyUtils.createProxy(ProxyUtils.java:60) at org.springframework.osgi.service.util.internal.aop.ProxyUtils.createProxy(ProxyUtils.java:37) at org.springframework.osgi.service.importer.support.AbstractServiceProxyCreator.createServiceProxy(AbstractServiceProxyCreator.java:107) at org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean.createProxy(OsgiServiceProxyFactoryBean.java:181) at org.springframework.osgi.service.importer.support.AbstractServiceImporterProxyFactoryBean.getObject(AbstractServiceImporterProxyFactoryBean.java:75) at org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean.getObject(OsgiServiceProxyFactoryBean.java:140) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport$1.run(FactoryBeanRegistrySupport.java:121) ... 12 common frames omitted

    Spring JIRA | 8 years ago | Oliver Lietz
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean#1': FactoryBean threw exception on object creation; nested exception is java.lang.LinkageError: loader constraint violation: loader (instance of sun/misc/Launcher$AppClassLoader) previously initiated loading for a different type with name "javax/servlet/Servlet"
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    MVP Entry point Error

    GitHub | 4 years ago | branflake2267
    java.lang.RuntimeException: Deferred binding failed for 'com.gwtplatform.mvp.client.ClientGinjector' (did you forget to inherit a required module?)
  6. 0

    Maven, tomcat7, Simple Web App. java.lang.LinkageError: loader constraint violation

    Stack Overflow | 2 years ago | MauricioTL
    java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/jasper/servlet/JasperLoader) previously initiated loading for a different type with name "javax/servlet/http/HttpServletRequest"

    2 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.LinkageError

      loader constraint violation: loader (instance of sun/misc/Launcher$AppClassLoader) previously initiated loading for a different type with name "javax/servlet/Servlet"

      at java.lang.ClassLoader.defineClass1()
    2. Java RT
      Class.getDeclaredMethods
      1. java.lang.ClassLoader.defineClass1(Native Method)
      2. java.lang.ClassLoader.defineClass(ClassLoader.java:675)
      3. java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
      4. java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
      5. java.net.URLClassLoader.access$000(URLClassLoader.java:56)
      6. java.net.URLClassLoader$1.run(URLClassLoader.java:195)
      7. java.security.AccessController.doPrivileged(Native Method)
      8. java.net.URLClassLoader.findClass(URLClassLoader.java:188)
      9. java.lang.ClassLoader.loadClass(ClassLoader.java:316)
      10. sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:288)
      11. java.lang.ClassLoader.loadClass(ClassLoader.java:251)
      12. java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
      13. java.lang.Class.getDeclaredMethods0(Native Method)
      14. java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
      15. java.lang.Class.getDeclaredMethods(Class.java:1791)
      15 frames
    3. Spring AOP
      ProxyFactory.getProxy
      1. org.springframework.aop.framework.JdkDynamicAopProxy.findDefinedEqualsAndHashCodeMethods(JdkDynamicAopProxy.java:128)
      2. org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:116)
      3. org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110)
      3 frames
    4. Spring OSGi Core
      OsgiServiceProxyFactoryBean.getObject
      1. org.springframework.osgi.service.util.internal.aop.ProxyUtils.createProxy(ProxyUtils.java:60)
      2. org.springframework.osgi.service.util.internal.aop.ProxyUtils.createProxy(ProxyUtils.java:37)
      3. org.springframework.osgi.service.importer.support.AbstractServiceProxyCreator.createServiceProxy(AbstractServiceProxyCreator.java:107)
      4. org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean.createProxy(OsgiServiceProxyFactoryBean.java:181)
      5. org.springframework.osgi.service.importer.support.AbstractServiceImporterProxyFactoryBean.getObject(AbstractServiceImporterProxyFactoryBean.java:75)
      6. org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean.getObject(OsgiServiceProxyFactoryBean.java:140)
      6 frames
    5. Spring Beans
      FactoryBeanRegistrySupport$1.run
      1. org.springframework.beans.factory.support.FactoryBeanRegistrySupport$1.run(FactoryBeanRegistrySupport.java:121)
      1 frame
    6. Java RT
      AccessController.doPrivileged
      1. java.security.AccessController.doPrivileged(Native Method)
      1 frame
    7. Spring Beans
      DefaultListableBeanFactory.preInstantiateSingletons
      1. org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:116)
      2. org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:91)
      3. org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1285)
      4. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:217)
      5. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
      6. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
      7. org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:425)
      7 frames
    8. Spring Context
      AbstractApplicationContext.finishBeanFactoryInitialization
      1. org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
      1 frame
    9. Spring OSGi Core
      AbstractDelegatedExecutionApplicationContext.completeRefresh
      1. org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:276)
      1 frame
    10. org.springframework.osgi
      DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run
      1. org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:145)
      1 frame
    11. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:637)
      1 frame