Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when embedding CloudSlang in a SpringBoot application #537

Closed
levice14 opened this issue Jan 11, 2016 · 2 comments
Closed

Exception when embedding CloudSlang in a SpringBoot application #537

levice14 opened this issue Jan 11, 2016 · 2 comments
Assignees

Comments

@levice14
Copy link
Collaborator

using SpringBoot 1.3.0, cloudslang-all 9.2.0 and score-all 0.3.3

exception:

        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
        ... 175 common frames omitted
Caused by: java.lang.IllegalArgumentException: Not an managed type: class io.cloudslang.score.facade.entities.RunningExecutionPlan
        at org.hibernate.jpa.internal.metamodel.MetamodelImpl.managedType(MetamodelImpl.java:219) ~[hibernate-entitymanager-4.3.10.Final.jar:4.3.10.Final]
        at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:68) ~[spring-data-jpa-1.9.0.RELEASE.jar:na]
        at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getEntityInformation(JpaEntityInformationSupport.java:67) ~[spring-data-jpa-1.9.0.RELEASE.jar:na]
        at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:142) ~[spring-data-jpa-1.9.0.RELEASE.jar:na]


@levice14 levice14 added this to the 1.0 - sprint 2 milestone Jan 11, 2016
@levice14 levice14 self-assigned this Jan 11, 2016
@levice14
Copy link
Collaborator Author

The problem was with the use of @EnableAutoConfiguration(). When you use this annotation, Spring registers its location and will later use it for the JPA package scanning. The packages supplied in @EntityScan will be ignored.

The @EnableAutoConfiguration() annotation should be in the package we want to use for scanning. An empty configuration class was added under the package “io.cloudslang” with this annotation. It registered this location as well and now the JPA entities are found.

example configuration class in SpringBoot application:

package io.cloudslang;

import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableAutoConfiguration
public class AutoConfig {

}

@levice14
Copy link
Collaborator Author

adding @SamMarkowitz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants