-1

I got this error when I run the application. I tried to solve this problem by reading several posts but it makes no sense.

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

and

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is java.lang.RuntimeException: javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath. - with linked exception: [java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]

halfer
  • 19,824
  • 17
  • 99
  • 186
tharinda
  • 9
  • 7

2 Answers2

1

In the exception stack trace it seems not able to find the JAXB-API . Do you have this dependency to your project - jaxb-api.

Gopi
  • 620
  • 8
  • 16
1

Java 11 removed the Java EE modules: java.xml.bind (JAXB) - REMOVED

You can fix the issue by using alternate versions of the Java EE technologies. Simply add Maven dependencies that contain the classes you need:

        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.1</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-core</artifactId>
            <version>2.3.0.1</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.3.2</version>
        </dependency>

For Details Read This StackOverflow Answer