question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error creating bean with name 'org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration when starting spring boot on Wildfly 11,12,13. [SPR-16990]

See original GitHub issue

Giuseppe M Pereira opened SPR-16990 and commented

Bug report

//  "WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host.\"/dynamo-application-0.0.1-SNAPSHOT\"" => "java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.aop.framework.AopConfigException: Unexpected AOP exception; nested exception is org.springframework.aop.framework.AopConfigException: Unable to instantiate proxy using Objenesis, and regular proxy instantiation via default constructor fails as well; nested exception is java.lang.InstantiationException: org.springframework.boot.autoconfigure.web.HttpMessageConverters$$EnhancerBySpringCGLIB$$3ba87c15
    Caused by: java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.aop.framework.AopConfigException: Unexpected AOP exception; nested exception is org.springframework.aop.framework.AopConfigException: Unable to instantiate proxy using Objenesis, and regular proxy instantiation via default constructor fails as well; nested exception is java.lang.InstantiationException: org.springframework.boot.autoconfigure.web.HttpMessageConverters$$EnhancerBySpringCGLIB$$3ba87c15
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.aop.framework.AopConfigException: Unexpected AOP exception; nested exception is org.springframework.aop.framework.AopConfigException: Unable to instantiate proxy using Objenesis, and regular proxy instantiation via default constructor fails as well; nested exception is java.lang.InstantiationException: org.springframework.boot.autoconfigure.web.HttpMessageConverters$$EnhancerBySpringCGLIB$$3ba87c15
    Caused by: org.springframework.aop.framework.AopConfigException: Unexpected AOP exception; nested exception is org.springframework.aop.framework.AopConfigException: Unable to instantiate proxy using Objenesis, and regular proxy instantiation via default constructor fails as well; nested exception is java.lang.InstantiationException: org.springframework.boot.autoconfigure.web.HttpMessageConverters$$EnhancerBySpringCGLIB$$3ba87c15
    Caused by: org.springframework.aop.framework.AopConfigException: Unable to instantiate proxy using Objenesis, and regular proxy instantiation via default constructor fails as well; nested exception is java.lang.InstantiationException: org.springframework.boot.autoconfigure.web.HttpMessageConverters$$EnhancerBySpringCGLIB$$3ba87c15
    Caused by: java.lang.InstantiationException: org.springframework.boot.autoconfigure.web.HttpMessageConverters$$EnhancerBySpringCGLIB$$3ba87c15
    Caused by: java.lang.NoSuchMethodException: org.springframework.boot.autoconfigure.web.HttpMessageConverters$$EnhancerBySpringCGLIB$$3ba87c15.<init>()"},

Getting following exception when loading spring boot war on wildfly 13. However, it works if I start my project with maven from the console with mvn spring-boot:run as jar build.


Affects: 5.0.7

Referenced from: commits https://github.com/spring-projects/spring-boot/commit/58e886fddf8a1077efedcb99c8038b6e7aaf55b8

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
spring-projects-issuescommented, Jan 11, 2019

Brian Clozel commented

Juergen Hoeller and I have been looking at this - it seems WildFly (actually, JBoss Modules) is not exposing sun.reflect nor jdk.internal packages with JDK9+.

Launching a Spring Boot application with Spring MVC support fails because of the following:

Unable to instantiate proxy using Objenesis, falling back to regular proxy construction: org.springframework.objenesis.ObjenesisException: java.lang.ClassNotFoundException: sun.reflect.ReflectionFactory 

I’ve opened MODULES-373 to find out more about this - the JBoss Modules team answered that developers need to declare the jdk.unsupported module as a Dependency (see reference documentation).

I managed to run a Spring Boot application by updating my project build:

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-war-plugin</artifactId>
	<configuration>
		<archive>
			<manifestEntries>
				<Dependencies>jdk.unsupported</Dependencies>
			</manifestEntries>
		</archive>
	</configuration>
</plugin>

In addition to that, the Spring Boot team is working on relaxing the reflection arrangement to avoid this advanced use case triggered by the Spring Boot infrastructure - but this does not guarantee that this case cannot be triggered by the application itself, so declaring that dependency is still advised.

I’m closing this issue, as this a configuration issue that WildFly users need to take into account.

0reactions
spring-projects-issuescommented, Jan 11, 2019

Stefano Paganucci commented

Thank you so much Juergen Hoeller for the explanation!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error creating bean with name 'org.springframework.boot ...
This following code upgraded my springboot from 2.7.5 to springboot 3.0.0-M4. After recompiling with maven, i'm successfully able to access ...
Read more >
Spring Boot Error - Error creating a bean with name ...
Spring Boot Error - Error creating a bean with name 'dataSource' defined in class path resource ... DataSource org.springframework.boot.autoconfigure.jdbc.
Read more >
Resolving Failed to Configure a DataSource Error - Baeldung
In this short tutorial, we'll discuss what causes and what resolves the “Failed to configure a DataSource” error on a Spring Boot project....
Read more >
How to install a Spring module in JBoss EAP
Download the desired version of Spring. For this example we are using Spring 3.1.1. Create the directory $JBOSS_HOME/modules/org/springframework ...
Read more >
Spring Boot 2.6.3 is now available
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurationPropertiesBeans' defined in class path ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found