gs-accessing-data-jpa icon indicating copy to clipboard operation
gs-accessing-data-jpa copied to clipboard

Getting error entityManagerFactory not found

Open IOgraph opened this issue 6 years ago • 5 comments


APPLICATION FAILED TO START


Description:

Parameter 0 of method demo in hello.Application required a bean named 'entityManagerFactory' that could not be found.

Action:

Consider defining a bean named 'entityManagerFactory' in your configuration.

IOgraph avatar Mar 27 '18 09:03 IOgraph

Try cleaning your ~/.m2 directory and running it again.

gregturn avatar Apr 04 '18 15:04 gregturn

@gregturn saved my life!

dmarquezbh avatar Sep 02 '18 21:09 dmarquezbh

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.5.RELEASE:run (default-cli) on project gs-accessing-data-jpa: An exception occurred while running. null: Invoca tionTargetException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocatio n of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException: javax.xml.bind.JAXBException

i ran these, but it didn't help: mvn clean install mvn dependency:purge-local-repository clean install

i found out i had to add some dependency tags in pom.xml:

<!-- Java 8 = JAX-B Version 2.2.8 -->
<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.2.11</version>
</dependency>
<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-core</artifactId>
    <version>2.2.11</version>
</dependency>
<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-impl</artifactId>
    <version>2.2.11</version>
</dependency>
<dependency>
    <groupId>javax.activation</groupId>
    <artifactId>activation</artifactId>
    <version>1.1.1</version>
</dependency>

now it works.

nickleus avatar Sep 24 '18 11:09 nickleus

the referenced maven pom.xml needs to be updated:

https://raw.githubusercontent.com/spring-guides/gs-accessing-data-jpa/master/initial/pom.xml

I added the following:

        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.1</version>
        </dependency>

mhuisman avatar Jan 17 '19 01:01 mhuisman

Fixed in #36

mhuisman avatar Jan 17 '19 02:01 mhuisman