I have the following classes that I took from the Greenhouse project. When I startup TC Server Dev Ed v2.6, I get the configuration errors below. I have copied the classes one-one to my project. I also have greenhouse running locally in STS and it starts with no error messages. Can anyone see something I have not been able to?
JdbcAccountRepository:
AccountMapperCode:@Repository public class JdbcAccountRepository implements AccountRepository { private final JdbcTemplate jdbcTemplate; private final PasswordEncoder passwordEncoder; private final AccountMapper accountMapper; @Autowired public JdbcAccountRepository(JdbcTemplate jdbcTemplate, PasswordEncoder passwordEncoder, AccountMapper accountMapper) { this.jdbcTemplate = jdbcTemplate; this.passwordEncoder = passwordEncoder; this.accountMapper = accountMapper; }
LocalFileStorage:Code:@Component public class AccountMapper implements RowMapper<Account> { private final PictureUrlMapper pictureUrlMapper; private final UriTemplate profileUrlTemplate; @Inject public AccountMapper(FileStorage pictureStorage, @Value("#{environment['application.url']}/members/{profileKey}") String profileUrlTemplate) { this(new PictureUrlMapper(new PictureUrlFactory(pictureStorage), PictureSize.SMALL), profileUrlTemplate); }
ComponentConfigCode:public class LocalFileStorage implements FileStorage { private final String storageUrl; private final File storageDirectory; private boolean deleteOnExit; public LocalFileStorage(String storageUrl, Resource storageDirectory) { this.storageUrl = storageUrl; try { this.storageDirectory = storageDirectory.getFile(); this.storageDirectory.deleteOnExit(); this.storageDirectory.createNewFile(); } catch (IOException e) { throw new RuntimeException(e); } }
Here are the condensed errors from STS console during startup of TC Server Dev Ed 2.6:Code:@Configuration @ComponentScan(basePackages = "com.studentsocialhealth.youarefine", excludeFilters = { @Filter(Configuration.class) }) public class ComponentConfig { @Configuration @Profile("embedded") @PropertySource("classpath:com/studentsocialhealth/youarefine/config/embedded.properties") static class Embedded { } @Configuration @Profile("standard") @PropertySource("classpath:application.properties") static class Standard { } }
I also have the following errors in the same output:Code:ERROR: org.springframework.web.context.ContextLoader - Context initialization failed org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jdbcAccountRepository' defined in file [/Users/jpgaber/Applications/springsource/vfabric-tc-server-developer-2.6.1.RELEASE/spring-insight-instance/wtpwebapps/StudentSocialHealth/WEB-INF/classes/com/studentsocialhealth/youarefine/dal/repositories/jdbc/JdbcAccountRepository.class]: Unsatisfied dependency expressed through constructor argument with index 2 of type [com.studentsocialhealth.youarefine.dal.rowmappers.AccountMapper]: : Error creating bean with name 'accountMapper' defined in file [/Users/jpgaber/Applications/springsource/vfabric-tc-server-developer-2.6.1.RELEASE/spring-insight-instance/wtpwebapps/StudentSocialHealth/WEB-INF/classes/com/studentsocialhealth/youarefine/dal/rowmappers/AccountMapper.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [com.studentsocialhealth.youarefine.dal.datastore.FileStorage]: : No matching bean of type [com.studentsocialhealth.youarefine.dal.datastore.FileStorage] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.studentsocialhealth.youarefine.dal.datastore.FileStorage] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'accountMapper' defined in file [/Users/jpgaber/Applications/springsource/vfabric-tc-server-developer-2.6.1.RELEASE/spring-insight-instance/wtpwebapps/StudentSocialHealth/WEB-INF/classes/com/studentsocialhealth/youarefine/dal/rowmappers/AccountMapper.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [com.studentsocialhealth.youarefine.dal.datastore.FileStorage]: : No matching bean of type [com.studentsocialhealth.youarefine.dal.datastore.FileStorage] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.studentsocialhealth.youarefine.dal.datastore.FileStorage] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
Code:Dec 19, 2011 7:14:46 PM org.apache.catalina.core.StandardContext startInternal SEVERE: Error listenerStart Dec 19, 2011 7:14:46 PM org.apache.catalina.core.StandardContext startInternal SEVERE: Context [/StudentSocialHealth] startup failed due to previous errors Dec 19, 2011 7:14:46 PM org.apache.catalina.core.ApplicationContext log INFO: Closing Spring root WebApplicationContext Dec 19, 2011 7:14:46 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc SEVERE: The web application [/StudentSocialHealth] registered the JDBC driver [org.h2.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. Dec 19, 2011 7:14:46 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: The web application [/StudentSocialHealth] appears to have started a thread named [traceCreatingExecutor-1] but has failed to stop it. This is very likely to create a memory leak.


Reply With Quote
