I have one UserRepository which is a CRUD repository as shown:
#Repository
public interface UserRepository extends CrudRepository<User, Long> {
}
one UserController like this:
#RestController
#RequestMapping("/api")
public class UserController {
#Autowired
private UserRepository repository;
#Autowired
private UserResourceAssembler assembler;
and one WebMvcTest class to test my UserController:
#RunWith(SpringRunner.class)
#WebMvcTest(UserController.class)
public class UserControllerTest {
#Autowired
private MockMvc mvc;
#Test
public void getAllEmployeesAPI() throws Exception
{
mvc.perform( MockMvcRequestBuilders
.get("/api/users")
.accept(MediaType.APPLICATION_JSON))
.andDo(print())
.andExpect(status().isOk());
}
}
When I run the server everything is fine. However I get this error when I run maven-test:
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by:
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'userController': Unsatisfied dependency
expressed through field 'repository'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'userRepository': Cannot create inner bean
'(inner bean)#7ba1cdbe' of type
[org.springframework.orm.jpa.SharedEntityManagerCreator] while setting
bean property 'entityManager'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name '(inner bean)#7ba1cdbe': Cannot resolve
reference to bean 'entityManagerFactory' while setting constructor
argument; nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
bean named 'entityManagerFactory' available Caused by:
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'userRepository': Cannot create inner bean
'(inner bean)#7ba1cdbe' of type
[org.springframework.orm.jpa.SharedEntityManagerCreator] while setting
bean property 'entityManager'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name '(inner bean)#7ba1cdbe': Cannot resolve
reference to bean 'entityManagerFactory' while setting constructor
argument; nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
bean named 'entityManagerFactory' available Caused by:
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name '(inner bean)#7ba1cdbe': Cannot resolve
reference to bean 'entityManagerFactory' while setting constructor
argument; nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
bean named 'entityManagerFactory' available Caused by:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
bean named 'entityManagerFactory' available
If you have the same structure now, i recommend #SpringBootTest.
#WebMvcTest does not load database-related beans into the application context.
#WebMvcTest loads just the Web layer. If it contains some dependencies, you need to load your application context as well. You could narrow the dependencies used only in your controller with the #ContextConfiguration(classes = {YouTestConfiguration.class})
Related
I am currently using Quartz to store scheduled jobs. While trying to use jobstore of type jdbc to persist scheduled jobs in secondary quartz database I am getting bunch of errors regarding injections, beans.
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jwtFilter': Unsatisfied dependency expressed through field 'userRepo'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepo' defined in pl.certificatemanager.CertificateManagerApp.repository.UserRepo defined in #EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Cannot create inner bean '(inner bean)#29fa6b65' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#29fa6b65': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzDataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/quartz/QuartzAutoConfiguration$JdbcStoreTypeConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.quartz.QuartzDataSourceScriptDatabaseInitializer]: Factory method 'quartzDataSourceScriptDatabaseInitializer' threw exception; nested exception is java.lang.IllegalStateException: Unable to detect database type
Error regarding my repository and #EnableJpaRepositories
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepo' defined in pl.certificatemanager.CertificateManagerApp.repository.UserRepo defined in #EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Cannot create inner bean '(inner bean)#29fa6b65' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#29fa6b65': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzDataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/quartz/QuartzAutoConfiguration$JdbcStoreTypeConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.quartz.QuartzDataSourceScriptDatabaseInitializer]: Factory method 'quartzDataSourceScriptDatabaseInitializer' threw exception; nested exception is java.lang.IllegalStateException: Unable to detect database type
Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#29fa6b65': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzDataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/quartz/QuartzAutoConfiguration$JdbcStoreTypeConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.quartz.QuartzDataSourceScriptDatabaseInitializer]: Factory method 'quartzDataSourceScriptDatabaseInitializer' threw exception; nested exception is java.lang.IllegalStateException: Unable to detect database type
And last one concerning Quartz DataSource directly. However I think resolving problems with primary DataSource first is priority for now.
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzDataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/quartz/QuartzAutoConfiguration$JdbcStoreTypeConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.quartz.QuartzDataSourceScriptDatabaseInitializer]: Factory method 'quartzDataSourceScriptDatabaseInitializer' threw exception; nested exception is java.lang.IllegalStateException: Unable to detect database type
application.properties
## Primary DataSource properties
database1.datasource.url=jdbc:mysql://localhost:3306/certificatemanagerdb
database1.datasource.username=root
database1.datasource.password=root
database1.datasource.configuration.maximum-pool-size=30
database1.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
## Quartz properties
spring.quartz.job-store-type=jdbc
spring.quartz.properties.org.quartz.threadPool.threadCount=5
spring.quartz.jdbc.initialize-schema=always
database2.datasource.url=jdbc:mysql://localhost:3306/quartz_schema
database2.datasource.username=root
database2.datasource.password=root
database2.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
DataSourcesConfiguration
#Configuration
#EnableAutoConfiguration
public class DataSourcesConfiguration {
#Bean
#Primary
#ConfigurationProperties("database1.datasource")
public DataSourceProperties firstDataSourceProperties() {
return new DataSourceProperties();
}
#Bean
#Primary
#ConfigurationProperties("database1.datasource.first.configuration")
public HikariDataSource firstDataSource(DataSourceProperties firstDataSourceProperties) {
return firstDataSourceProperties.initializeDataSourceBuilder().type(HikariDataSource.class).build();
}
#Bean
#QuartzDataSource
#ConfigurationProperties(prefix = "database2.datasource")
public DataSource quartzDataSource() {
return DataSourceBuilder.create().build();
}
}
SecurityConfig it injects jwtFilter mentioned in error
#EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
#Autowired
private UserDetailsService userDetailsService;
#Autowired
private CustomPasswordEncoder customPasswordEncoder;
#Autowired
private JwtFilter jwtFilter;
#Override
#Bean
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
#Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(customPasswordEncoder.getPasswordEncoder());
}
#Override
protected void configure(HttpSecurity http) throws Exception {
http = http.csrf().disable().cors().disable();
http = http.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and();
http = http.exceptionHandling()
.authenticationEntryPoint((request, response, exception) -> {
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, exception.getMessage());
}).and();
http.authorizeRequests()
.antMatchers("/api/auth/**").permitAll()
.anyRequest().authenticated();
http.addFilterBefore(jwtFilter, UsernamePasswordAuthenticationFilter.class);
}
}
userRepo
#Repository
public interface UserRepo extends JpaRepository<User, Long> {
User findUserById(Long id);
User findByUsername(String username);
Boolean existsByUsername(String username);
}
When commenting out method quartzDataSource() in DataSourcesConfiguration everything works fine (ignoring persisting data of Quartz Scheduler), so I suspect something with configuring Quartz DataSource intervene with my whole app.
Injected class JwtUtil in SecurityConfig is annotated with #Component.
Found the solution. Replaced spring.datasource.url= with spring.datasource.jdbcUrl= and everything works fine.
I already set up some hybris projects and used jrebel in them, but this project is kind of different.
When I run my server with ./hybrisserver.sh debug and tomcat.debugjavaoptions=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n, it starts correctly and I can debug the server.
When I run my server with ./hybrisserver.sh debug and tomcat.debugjavaoptions=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n -agentpath:%JREBEL_HOME%/lib/libjrebel64.dylib, it doesn't start and I get the following error.
When I run my server with ./hybrisserver.sh and tomcat.javaoptions=-agentpath:%JREBEL_HOME%/lib/libjrebel64.dylib (not the debug options!), it starts normally and jrebel is present in the log.
ERROR [localhost-startStop-4] [HybrisContextFactory] Error initializing global application context!
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'defaultInterceptorRegistry' defined in class path resource [interceptor-spring.xml]: Unsatisfied dependency expressed through bean property 'interceptorMappings'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'classAttributeAssignmentUniqueClassificationItemValidatorMapping' defined in class path resource [catalog-spring.xml]: Cannot resolve reference to bean 'uniqueClassificationItemValidator' while setting bean property 'interceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uniqueClassificationItemValidator' defined in class path resource [catalog-spring.xml]: Cannot resolve reference to bean 'categoryService' while setting bean property 'categoryService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lerbsCategoryService' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'lerbsB2BUnitService' while setting bean property 'lerbsB2BUnitService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultLerbsB2BUnitService' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'b2bCommerceUnitService' while setting bean property 'b2BCommerceUnitService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultLerbsB2BCommerceUnitService' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'emailService' while setting bean property 'emailService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultLerbsEmailService' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'b2bCommerceUserService' while setting bean property 'lerbsB2BCommerceUserService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultLerbsB2BCommerceUserService' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'productService' while setting bean property 'productService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lerbsProductService' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'priceService' while setting bean property 'priceService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'erpPricingCatalogService' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'netGrossStrategy' while setting bean property 'netGrossStrategy'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'commerceNetGrossStrategy' defined in class path resource [commerceservices-spring.xml]: Cannot resolve reference to bean 'cartService' while setting bean property 'cartService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultCartServiceForAccelerator' defined in class path resource [acceleratorservices-spring.xml]: Cannot resolve reference to bean 'orderCalculation' while setting bean property 'orderCalculation'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultOrderCalculation' defined in class path resource [order-spring.xml]: Cannot resolve reference to bean 'calculationService' while setting bean property 'calculationService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'erpCartCalculationService' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'erpPricingCartService' while setting bean property 'erpPricingCartService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'erpPricingCartService' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'erpPricing' while setting bean property 'erpPricing'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'erpPricing' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'configurableErpPricingBackend' while setting bean property 'erpPricingBackend'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurableErpPricingBackend' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'legacyErpPricingBackendMongo' while setting bean property 'erpPricingBackendMap' with key [TypedStringValue: value [legacy], target type [null]]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'legacyErpPricingBackendMongo' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'storeSessionFacade' while setting bean property 'storeSessionFacade'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultStoreSessionFacade' defined in class path resource [commercefacades-spring.xml]: Cannot resolve reference to bean 'commerceCartService' while setting bean property 'commerceCartService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lerbsCommerceCartService' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'commerceCartCalculationStrategy' while setting bean property 'commerceCartCalculationStrategy'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lerbsCommerceCartCalculationStrategy' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'promotionsService' while setting bean property 'promotionsService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultPromotionEngineService' defined in class path resource [promotionengineservices-spring.xml]: Cannot resolve reference to bean 'commerceRuleEngineService' while setting bean property 'commerceRuleEngineService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultCommerceRuleEngineService' defined in class path resource [droolsruleengineservices-spring.xml]: Cannot resolve reference to bean 'platformRuleEngineService' while setting bean property 'platformRuleEngineService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultPlatformRuleEngineService' defined in class path resource [ruleengine-spring.xml]: Cannot resolve reference to bean 'kieSessionHelper' while setting bean property 'kieSessionHelper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultKieSessionHelper' defined in class path resource [ruleengine-spring.xml]: Cannot resolve reference to bean 'ruleEngineKieModuleSwapper' while setting bean property 'ruleEngineKieModuleSwapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultRuleEngineKieModuleSwapper' defined in class path resource [ruleengine-spring.xml]: Cannot resolve reference to bean 'ruleEngineCacheService' while setting bean property 'ruleEngineCacheService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultCommerceRuleEngineCacheService' defined in class path resource [ruleengineservices-spring.xml]: Cannot resolve reference to bean 'ruleEngineCache' while setting bean property 'ruleEngineCache'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultCommerceRuleEngineCache' defined in class path resource [ruleengineservices-spring.xml]: Cannot resolve reference to bean 'commerceRuleEngineRaoCacheCreators' while setting bean property 'raoCacheCreators'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'commerceRuleEngineRaoCacheCreators': Cannot resolve reference to bean 'ruleGroupExecutionRRDProvider' while setting bean property 'sourceList' with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultRuleGroupExecutionRRDProvider' defined in class path resource [ruleengineservices-spring.xml]: Cannot resolve reference to bean 'ruleGroupExecutionRrdConverter' while setting bean property 'ruleGroupExecutionRrdConverter'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultRuleGroupExecutionRrdConverter' defined in class path resource [ruleengineservices-spring.xml]: Cannot resolve reference to bean 'ruleGroupExecutionRrdPopulator' while setting bean property 'ruleGroupExecutionRrdPopulator'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultRuleGroupExecutionRrdPopulator' defined in class path resource [ruleengineservices-spring.xml]: Cannot resolve reference to bean 'ruleGroupDao' while setting bean property 'ruleGroupDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultRuleGroupDao' defined in class path resource [ruleengineservices-spring-rule.xml]: Initialization of bean failed; nested exception is java.lang.StackOverflowError
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1362) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1254) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:551) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.__refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.jrLockAndRefresh(AbstractApplicationContext.java:40002) ~[spring-context-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:41008) ~[spring-context-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at de.hybris.platform.core.HybrisContextFactory.refreshContext(HybrisContextFactory.java:95) ~[coreserver.jar:?]
at de.hybris.platform.core.HybrisContextFactory$ApplicationContextFactory.build(HybrisContextFactory.java:263) ~[coreserver.jar:?]
at de.hybris.platform.core.HybrisContextHolder.getApplicationInstance(HybrisContextHolder.java:87) ~[coreserver.jar:?]
at de.hybris.platform.core.AbstractTenant.createCoreApplicationContext(AbstractTenant.java:713) ~[coreserver.jar:?]
at de.hybris.platform.core.AbstractTenant.doStartupSafe(AbstractTenant.java:752) ~[coreserver.jar:?]
at de.hybris.platform.core.AbstractTenant.doStartUp(AbstractTenant.java:685) ~[coreserver.jar:?]
at de.hybris.platform.core.Registry.assureTenantStarted(Registry.java:658) ~[coreserver.jar:?]
at de.hybris.platform.core.Registry.activateTenant(Registry.java:719) ~[coreserver.jar:?]
at de.hybris.platform.core.Registry.setCurrentTenant(Registry.java:566) ~[coreserver.jar:?]
at de.hybris.platform.core.Registry.activateMasterTenant(Registry.java:626) ~[coreserver.jar:?]
at de.hybris.platform.core.Registry.startup(Registry.java:444) ~[coreserver.jar:?]
at de.hybris.platform.core.ClassLoaderUtils.executeWithWebClassLoaderParentIfNeeded(ClassLoaderUtils.java:42) [coreserver.jar:?]
at de.hybris.platform.spring.HybrisContextLoaderListener.startRegistry(HybrisContextLoaderListener.java:325) [coreserver.jar:?]
at de.hybris.platform.spring.HybrisContextLoaderListener.doInitWebApplicationContext(HybrisContextLoaderListener.java:211) [coreserver.jar:?]
at de.hybris.platform.spring.HybrisContextLoaderListener.initWebApplicationContext(HybrisContextLoaderListener.java:199) [coreserver.jar:?]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) [spring-web-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at de.hybris.platform.spring.HybrisContextLoaderListener.contextInitialized(HybrisContextLoaderListener.java:95) [coreserver.jar:?]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4699) [catalina.jar:8.5.51]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5165) [catalina.jar:8.5.51]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:8.5.51]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1412) [catalina.jar:8.5.51]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1402) [catalina.jar:8.5.51]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_252]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_252]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_252]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'classAttributeAssignmentUniqueClassificationItemValidatorMapping' defined in class path resource [catalog-spring.xml]: Cannot resolve reference to bean 'uniqueClassificationItemValidator' while setting bean property 'interceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uniqueClassificationItemValidator' defined in class path resource [catalog-spring.xml]: Cannot resolve reference to bean 'categoryService' while setting bean property 'categoryService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lerbsCategoryService' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'lerbsB2BUnitService' while setting bean property 'lerbsB2BUnitService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultLerbsB2BUnitService' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'b2bCommerceUnitService' while setting bean property 'b2BCommerceUnitService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultLerbsB2BCommerceUnitService' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'emailService' while setting bean property 'emailService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultLerbsEmailService' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'b2bCommerceUserService' while setting bean property 'lerbsB2BCommerceUserService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultLerbsB2BCommerceUserService' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'productService' while setting bean property 'productService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lerbsProductService' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'priceService' while setting bean property 'priceService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'erpPricingCatalogService' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'netGrossStrategy' while setting bean property 'netGrossStrategy'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'commerceNetGrossStrategy' defined in class path resource [commerceservices-spring.xml]: Cannot resolve reference to bean 'cartService' while setting bean property 'cartService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultCartServiceForAccelerator' defined in class path resource [acceleratorservices-spring.xml]: Cannot resolve reference to bean 'orderCalculation' while setting bean property 'orderCalculation'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultOrderCalculation' defined in class path resource [order-spring.xml]: Cannot resolve reference to bean 'calculationService' while setting bean property 'calculationService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'erpCartCalculationService' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'erpPricingCartService' while setting bean property 'erpPricingCartService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'erpPricingCartService' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'erpPricing' while setting bean property 'erpPricing'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'erpPricing' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'configurableErpPricingBackend' while setting bean property 'erpPricingBackend'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurableErpPricingBackend' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'legacyErpPricingBackendMongo' while setting bean property 'erpPricingBackendMap' with key [TypedStringValue: value [legacy], target type [null]]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'legacyErpPricingBackendMongo' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'storeSessionFacade' while setting bean property 'storeSessionFacade'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultStoreSessionFacade' defined in class path resource [commercefacades-spring.xml]: Cannot resolve reference to bean 'commerceCartService' while setting bean property 'commerceCartService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lerbsCommerceCartService' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'commerceCartCalculationStrategy' while setting bean property 'commerceCartCalculationStrategy'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lerbsCommerceCartCalculationStrategy' defined in class path resource [lerbscore-spring.xml]: Cannot resolve reference to bean 'promotionsService' while setting bean property 'promotionsService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultPromotionEngineService' defined in class path resource [promotionengineservices-spring.xml]: Cannot resolve reference to bean 'commerceRuleEngineService' while setting bean property 'commerceRuleEngineService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultCommerceRuleEngineService' defined in class path resource [droolsruleengineservices-spring.xml]: Cannot resolve reference to bean 'platformRuleEngineService' while setting bean property 'platformRuleEngineService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultPlatformRuleEngineService' defined in class path resource [ruleengine-spring.xml]: Cannot resolve reference to bean 'kieSessionHelper' while setting bean property 'kieSessionHelper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultKieSessionHelper' defined in class path resource [ruleengine-spring.xml]: Cannot resolve reference to bean 'ruleEngineKieModuleSwapper' while setting bean property 'ruleEngineKieModuleSwapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultRuleEngineKieModuleSwapper' defined in class path resource [ruleengine-spring.xml]: Cannot resolve reference to bean 'ruleEngineCacheService' while setting bean property 'ruleEngineCacheService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultCommerceRuleEngineCacheService' defined in class path resource [ruleengineservices-spring.xml]: Cannot resolve reference to bean 'ruleEngineCache' while setting bean property 'ruleEngineCache'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultCommerceRuleEngineCache' defined in class path resource [ruleengineservices-spring.xml]: Cannot resolve reference to bean 'commerceRuleEngineRaoCacheCreators' while setting bean property 'raoCacheCreators'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'commerceRuleEngineRaoCacheCreators': Cannot resolve reference to bean 'ruleGroupExecutionRRDProvider' while setting bean property 'sourceList' with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultRuleGroupExecutionRRDProvider' defined in class path resource [ruleengineservices-spring.xml]: Cannot resolve reference to bean 'ruleGroupExecutionRrdConverter' while setting bean property 'ruleGroupExecutionRrdConverter'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultRuleGroupExecutionRrdConverter' defined in class path resource [ruleengineservices-spring.xml]: Cannot resolve reference to bean 'ruleGroupExecutionRrdPopulator' while setting bean property 'ruleGroupExecutionRrdPopulator'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultRuleGroupExecutionRrdPopulator' defined in class path resource [ruleengineservices-spring.xml]: Cannot resolve reference to bean 'ruleGroupDao' while setting bean property 'ruleGroupDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultRuleGroupDao' defined in class path resource [ruleengineservices-spring-rule.xml]: Initialization of bean failed; nested exception is java.lang.StackOverflowError
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1534) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1281) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:551) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1314) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1280) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1178) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1094) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1064) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1347) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
... 38 more
Now I'm kind of stuck.
below configuration to correct dev debug.
tomcat.javaoptions=-agentpath:"C:/jrebel/lib/jrebel64.dll"
tomcat.debugjavaoptions=-agentpath:"C:/jrebel/lib/jrebel64.dll" -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n -Dfile.encoding=UTF8
Change the path accordingly.
to work with JRebel rebel.xml is necessary, create this file:rebel.xml
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com"
xsi:schemaLocation="http://www.zeroturnaround.com http://www.zeroturnaround.com/alderaan/rebel-2_0.xsd">
<classpath>
<dirset dir="${HYBRIS_BIN_DIR}/custom/test">
<include name="**/classes"/>
<!--Uncomment next line in case of exception '..java.lang.ClassNotFoundException: com.hybris.cockpitng.util.DefaultWidgetController...'
when trying to access backoffice-->
<!--<exclude name="**backoffice**"/>-->
</dirset>
</classpath>
</application>
Modify hybris
to start JRebel with hybris, one of the ways is to modify tomcat wrapper.conf
go to hybris/bin/platform/tomcat/conf
create wrapper-jrebel.conf: make copy of wrapper.conf and rename it to wrapper-jrebel.conf
insert there three lines
wrapper-jrebel.conf::::::::::::
wrapper.java.additional.20=-Drebel.base=C:\Users\test\.jrebel
wrapper.java.additional.21=-javaagent:C:\Users\test\.IdeaIC2018.1\config\plugins\jr-ide-idea\lib\jrebel6\jrebel.jar
wrapper.java.additional.22=-agentpath:C:\Users\test\.IdeaIC2018.1\config\plugins\jr-ide-idea\lib\jrebel6\lib\jrebel64.dll
create wrapper-jrebel-debug.conf: make copy of wrapper-debug.conf and rename it to wrapper-jrebel-debug.conf
insert there three lines
wrapper-jrebel-debug.conf
wrapper.java.additional.23=-Drebel.base=C:\Users\test\.jrebel
wrapper.java.additional.24=-javaagent:C:\Users\test\.IntelliJIdea2016.2\config\plugins\jr-ide-idea\lib\jrebel\jrebel.jar
wrapper.java.additional.25=-agentpath:C:\Users\test\.IntelliJIdea2016.2\config\plugins\jr-ide-idea\lib\jrebel6\lib\jrebel64.dll
modify hybrisserver.bat
to load JRebel separately insert there two blocks
hybrisserver.bat
IF "%MODE%"=="jrebel" (
SET _YWRAPPER_CONF=%~dp0tomcat/conf/wrapper-jrebel.conf
SET MODE=run
)
IF "%1"=="jrebel_debug" (
SET _YWRAPPER_CONF=%~dp0tomcat/conf/wrapper-jrebel-debug.conf
SET MODE=run
)
to load JRebel as usual in debug mode insert there one block
hybrisserver.bat
IF "%1"=="debug" (
SET _YWRAPPER_CONF=%~dp0tomcat/conf/wrapper-jrebel-debug.conf
SET MODE=run
)
now run
jrebel
hybrisserver.bat jrebel
or
jrebel debug
hybrisserver.bat jrebel_debug
or if you choose usual debug mode
I have a big problem.
I have an application with Spring-Boot and Spring-Data.
It goes well before that i moved some classes and refactory the directory.
I have two database and before i moved classes, i had this config class for a second database:
#Configuration
#EnableTransactionManagement
#EnableJpaRepositories(
basePackages="it.phoops.rt.grigliaprocessi.util",
entityManagerFactoryRef = "organoEntityManager",
transactionManagerRef = "organoTransactionManager")
public class OrganoConfig {
#Bean(name = "organoDataSource")
#ConfigurationProperties(prefix="organo.datasource")
public DataSource organoDataSource(){
return DataSourceBuilder.create().build();
}
#Bean(name="organoEntityManager")
public LocalContainerEntityManagerFactoryBean
organoEntityManagerFactory(EntityManagerFactoryBuilder builder,
#Qualifier("organoDataSource") DataSource dataSource){
return
builder.
dataSource(organoDataSource()).
packages("it.phoops.rt.grigliaprocessi.util.entity").
persistenceUnit("organo").build();
}
#Bean("organoTransactionManager")
public PlatformTransactionManager
organoTransactionManager()
{
return new
DataSourceTransactionManager(organoDataSource());
}
}
Now, i moved in "it.phoops.rt.grigliaprocessi.organo" and i change the value of "basePackages" from "it.phoops.rt.grigliaprocessi.util" to "it.phoops.rt.grigliaprocessi.organo" and
the string "it.phoops.rt.grigliaprocessi.util.entity" to it.phoops.rt.grigliaprocessi.organo.entity".
I moved Entity, Service and Repository classes from:
it.phoops.rt.grigliaprocessi.util.controller
it.phoops.rt.grigliaprocessi.util.entity
it.phoops.rt.grigliaprocessi.util.repository
to
it.phoops.rt.grigliaprocessi.organo.controller
it.phoops.rt.grigliaprocessi.organo.entity
it.phoops.rt.grigliaprocessi.organo.repository
But now, i have this error, caused of nested exception:
Caused by: java.lang.IllegalArgumentException: Not a managed type:
class it.phoops.rt.grigliaprocessi.organo.entity.Albero
......
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'alberoRepository': Invocation of init
method failed; nested exception is
java.lang.IllegalArgumentException:
Not a managed type: class
it.phoops.rt.grigliaprocessi.organo.entity.Albero
....
Caused by:
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error
creating bean with name 'alberoService': Unsatisfied dependency
expressed through field 'repo'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating
bean with name 'alberoRepository': Invocation of init method failed;
nested exception is java.lang.IllegalArgumentException: Not a managed
type: class it.phoops.rt.grigliaprocessi.organo.entity.Albero
....
Caused by:
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error
creating bean with name 'alberoController': Unsatisfied dependency
expressed through field 'alberoService'; nested exception is
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error
creating bean with name 'alberoService': Unsatisfied dependency
expressed through field 'repo'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating
bean with name 'alberoRepository': Invocation of init method failed;
nested exception is java.lang.IllegalArgumentException: Not a managed
type: class it.phoops.rt.grigliaprocessi.organo.entity.Albero
Can you help me ?
Thanks
Change you basepackages declaration from it.phoops.rt.grigliaprocessi.util to it.phoops.rt.grigliaprocessi.organo. Also please check the basepackages in componentScan in your Spring boot main class.
I created new maven project using eclipse IDE. I did nothing after creating the project, just try to run the project using run.bat command as said in the tutorial. (https://ecmarchitect.com/alfresco-developer-series-tutorials/maven-sdk/tutorial/tutorial.html) But now i am getting errors like 'Error creating bean with name 'actionService' defined in class path resource [alfresco/action-services-context.xml]'. I don't how to solve this. Please help me.
My error log is given below.
2019-05-05 00:08:54,285 WARN [context.support.XmlWebApplicationContext] [localhost-startStop-1] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authorityBridgeTableCache' defined in class path resource [alfresco/cache-context.xml]: Cannot resolve reference to bean 'tenantAdminService' while setting bean property 'tenantAdminService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tenantAdminService' defined in URL [jar:file:/D:/$PUCSL_SNAIL/workflow-tutorial-test/target/tomcat/webapps/workflow-tutorial-test-platform/WEB-INF/lib/alfresco-repository-5.2.f.jar!/alfresco/mt/mt-admin-context.xml]: Cannot resolve reference to bean 'dbNodeServiceImpl' while setting bean property 'nodeService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dbNodeService' defined in class path resource [alfresco/node-services-context.xml]: Cannot resolve reference to bean 'permissionServiceImpl' while setting bean property 'permissionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'permissionServiceImpl' defined in class path resource [alfresco/public-services-security-context.xml]: Cannot resolve reference to bean 'authorityService' while setting bean property 'authorityService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authorityService' defined in class path resource [alfresco/authority-services-context.xml]: Cannot resolve reference to bean 'personService' while setting bean property 'personService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personService' defined in class path resource [alfresco/authentication-services-context.xml]: Cannot resolve reference to bean 'personServicePermissionsManager' while setting bean property 'permissionsManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personServicePermissionsManager' defined in class path resource [alfresco/authentication-services-context.xml]: Cannot resolve reference to bean 'ownableService' while setting bean property 'ownableService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ownableService' defined in class path resource [alfresco/ownable-services-context.xml]: Cannot resolve reference to bean 'renditionService' while setting bean property 'renditionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'renditionService' defined in class path resource [alfresco/rendition-services-context.xml]: Cannot resolve reference to bean 'ActionService' while setting bean property 'actionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ActionService' defined in class path resource [alfresco/public-services-context.xml]: Cannot resolve reference to bean 'actionService' while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'actionService' defined in class path resource [alfresco/action-services-context.xml]: Cannot resolve reference to bean 'NodeService' while setting bean property 'nodeService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'NodeService': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AuditMethodInterceptor' defined in class path resource [alfresco/public-services-context.xml]: Cannot resolve reference to bean 'auditComponent' while setting bean property 'auditComponent'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'auditComponent' defined in class path resource [alfresco/audit-services-context.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
2019-05-05 00:08:54,323 ERROR [web.context.ContextLoader] [localhost-startStop-1] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authorityBridgeTableCache' defined in class path resource [alfresco/cache-context.xml]: Cannot resolve reference to bean 'tenantAdminService' while setting bean property 'tenantAdminService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tenantAdminService' defined in URL [jar:file:/D:/$PUCSL_SNAIL/workflow-tutorial-test/target/tomcat/webapps/workflow-tutorial-test-platform/WEB-INF/lib/alfresco-repository-5.2.f.jar!/alfresco/mt/mt-admin-context.xml]: Cannot resolve reference to bean 'dbNodeServiceImpl' while setting bean property 'nodeService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dbNodeService' defined in class path resource [alfresco/node-services-context.xml]: Cannot resolve reference to bean 'permissionServiceImpl' while setting bean property 'permissionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'permissionServiceImpl' defined in class path resource [alfresco/public-services-security-context.xml]: Cannot resolve reference to bean 'authorityService' while setting bean property 'authorityService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authorityService' defined in class path resource [alfresco/authority-services-context.xml]: Cannot resolve reference to bean 'personService' while setting bean property 'personService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personService' defined in class path resource [alfresco/authentication-services-context.xml]: Cannot resolve reference to bean 'personServicePermissionsManager' while setting bean property 'permissionsManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personServicePermissionsManager' defined in class path resource [alfresco/authentication-services-context.xml]: Cannot resolve reference to bean 'ownableService' while setting bean property 'ownableService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ownableService' defined in class path resource [alfresco/ownable-services-context.xml]: Cannot resolve reference to bean 'renditionService' while setting bean property 'renditionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'renditionService' defined in class path resource [alfresco/rendition-services-context.xml]: Cannot resolve reference to bean 'ActionService' while setting bean property 'actionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ActionService' defined in class path resource [alfresco/public-services-context.xml]: Cannot resolve reference to bean 'actionService' while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'actionService' defined in class path resource [alfresco/action-services-context.xml]: Cannot resolve reference to bean 'NodeService' while setting bean property 'nodeService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'NodeService': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AuditMethodInterceptor' defined in class path resource [alfresco/public-services-context.xml]: Cannot resolve reference to bean 'auditComponent' while setting bean property 'auditComponent'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'auditComponent' defined in class path resource [alfresco/audit-services-context.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:334)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1419)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:636)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:938)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:70)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tenantAdminService' defined in URL [jar:file:/D:/$PUCSL_SNAIL/workflow-tutorial-test/target/tomcat/webapps/workflow-tutorial-test-platform/WEB-INF/lib/alfresco-repository-5.2.f.jar!/alfresco/mt/mt-admin-context.xml]: Cannot resolve reference to bean 'dbNodeServiceImpl' while setting bean property 'nodeService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dbNodeService' defined in class path resource [alfresco/node-services-context.xml]: Cannot resolve reference to bean 'permissionServiceImpl' while setting bean property 'permissionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'permissionServiceImpl' defined in class path resource [alfresco/public-services-security-context.xml]: Cannot resolve reference to bean 'authorityService' while setting bean property 'authorityService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authorityService' defined in class path resource [alfresco/authority-services-context.xml]: Cannot resolve reference to bean 'personService' while setting bean property 'personService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personService' defined in class path resource [alfresco/authentication-services-context.xml]: Cannot resolve reference to bean 'personServicePermissionsManager' while setting bean property 'permissionsManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personServicePermissionsManager' defined in class path resource [alfresco/authentication-services-context.xml]: Cannot resolve reference to bean 'ownableService' while setting bean property 'ownableService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ownableService' defined in class path resource [alfresco/ownable-services-context.xml]: Cannot resolve reference to bean 'renditionService' while setting bean property 'renditionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'renditionService' defined in class path resource [alfresco/rendition-services-context.xml]: Cannot resolve reference to bean 'ActionService' while setting bean property 'actionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ActionService' defined in class path resource [alfresco/public-services-context.xml]: Cannot resolve reference to bean 'actionService' while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'actionService' defined in class path resource [alfresco/action-services-context.xml]: Cannot resolve reference to bean 'NodeService' while setting bean property 'nodeService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'NodeService': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AuditMethodInterceptor' defined in class path resource [alfresco/public-services-context.xml]: Cannot resolve reference to bean 'auditComponent' while setting bean property 'auditComponent'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'auditComponent' defined in class path resource [alfresco/audit-services-context.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:334)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1419)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
... 25 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dbNodeService' defined in class path resource [alfresco/node-services-context.xml]: Cannot resolve reference to bean 'permissionServiceImpl' while setting bean property 'permissionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'permissionServiceImpl' defined in class path resource [alfresco/public-services-security-context.xml]: Cannot resolve reference to bean 'authorityService' while setting bean property 'authorityService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authorityService' defined in class path resource [alfresco/authority-services-context.xml]: Cannot resolve reference to bean 'personService' while setting bean property 'personService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personService' defined in class path resource [alfresco/authentication-services-context.xml]: Cannot resolve reference to bean 'personServicePermissionsManager' while setting bean property 'permissionsManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personServicePermissionsManager' defined in class path resource [alfresco/authentication-services-context.xml]: Cannot resolve reference to bean 'ownableService' while setting bean property 'ownableService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ownableService' defined in class path resource [alfresco/ownable-services-context.xml]: Cannot resolve reference to bean 'renditionService' while setting bean property 'renditionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'renditionService' defined in class path resource [alfresco/rendition-services-context.xml]: Cannot resolve reference to bean 'ActionService' while setting bean property 'actionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ActionService' defined in class path resource [alfresco/public-services-context.xml]: Cannot resolve reference to bean 'actionService' while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'actionService' defined in class path resource [alfresco/action-services-context.xml]: Cannot resolve reference to bean 'NodeService' while setting bean property 'nodeService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'NodeService': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AuditMethodInterceptor' defined in class path resource [alfresco/public-services-context.xml]: Cannot resolve reference to bean 'auditComponent' while setting bean property 'auditComponent'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'auditComponent' defined in class path resource [alfresco/audit-services-context.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:334)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1419)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
... 35 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'permissionServiceImpl' defined in class path resource [alfresco/public-services-security-context.xml]: Cannot resolve reference to bean 'authorityService' while setting bean property 'authorityService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authorityService' defined in class path resource [alfresco/authority-services-context.xml]: Cannot resolve reference to bean 'personService' while setting bean property 'personService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personService' defined in class path resource [alfresco/authentication-services-context.xml]: Cannot resolve reference to bean 'personServicePermissionsManager' while setting bean property 'permissionsManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personServicePermissionsManager' defined in class path resource [alfresco/authentication-services-context.xml]: Cannot resolve reference to bean 'ownableService' while setting bean property 'ownableService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ownableService' defined in class path resource [alfresco/ownable-services-context.xml]: Cannot resolve reference to bean 'renditionService' while setting bean property 'renditionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'renditionService' defined in class path resource [alfresco/rendition-services-context.xml]: Cannot resolve reference to bean 'ActionService' while setting bean property 'actionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ActionService' defined in class path resource [alfresco/public-services-context.xml]: Cannot resolve reference to bean 'actionService' while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'actionService' defined in class path resource [alfresco/action-services-context.xml]: Cannot resolve reference to bean 'NodeService' while setting bean property 'nodeService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'NodeService': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AuditMethodInterceptor' defined in class path resource [alfresco/public-services-context.xml]: Cannot resolve reference to bean 'auditComponent' while setting bean property 'auditComponent'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'auditComponent' defined in class path resource [alfresco/audit-services-context.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:334)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1419)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
... 45 more
add jaxb-api dependency in your pom.xml file
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
If you still face the same error even after adding the above dependency then try this StackOverflowQuestion answers
I have a working Spring Boot Web application. We want to persist the session to the DB so I followed the spring tutorial, found here and I am getting this error at startup:
Caused by: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'sessionRepositoryFilterRegistration' defined in class path resource [org/springframework/boot/autoconfigure/session/SessionRepositoryFilterConfiguration.class]: Unsatisfied dependency expressed through method 'sessionRepositoryFilterRegistration' parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'org.springframework.boot.autoconfigure.session.JdbcSessionConfiguration$SpringBootJdbcHttpSessionConfiguration': Unsatisfied dependency expressed through method 'setTransactionManager' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'transactionManager' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'connectionsConfiguration': Unsatisfied dependency expressed through field 'emFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException:
Error creating bean with name 'sessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
Here is my connectionsConfiguration class:
#Configuration
public class ConnectionsConfiguration implements ApplicationListener<ApplicationReadyEvent> {
#Autowired
DataSource dataSource;
#Autowired
private EntityManagerFactory emFactory;
#Bean
public EntityManager getEntityManager() {
return emFactory.createEntityManager();
}
#Bean
#Scope("prototype")
public LocalSessionFactoryBean sessionFactory() throws ClassNotFoundException {
LocalSessionFactoryBean fact = new LocalSessionFactoryBean();
fact.setAnnotatedPackages("com.xxx.persistence.model");
fact.setPackagesToScan("com.xxx.persistence.model");
fact.setDataSource(dataSource);
return fact;
}
}
How do I get this to work? Do I need to explicitly define the sessionFactory? I was under the impression that spring would handle this behind the scenes.