#Autowired
private Configuration freemarkerConfig;
Getting the following exception,
Unsatisfied dependency expressed through field 'freemarkerConfig';
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'freeMarkerConfiguration' defined in class path resource [org/springframework/boot/autoconfigure/freemarker/FreeMarkerServletWebConfiguration.class]: Unsatisfied dependency expressed through method 'freeMarkerConfiguration' parameter 0;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'freeMarkerConfigurer' defined in class path resource [org/springframework/boot/autoconfigure/freemarker/FreeMarkerServletWebConfiguration.class]: Invocation of init method failed;
nested exception is freemarker.core.Configurable$UnknownSettingException: Unknown FreeMarker configuration setting: "recognize_standard_file_extensions"
I had the same issue, make sure you are autowiring correct FreeMarker Configuration, or use
#Autowired
private freemarker.template.Configuration freeMarker;
Related
I can't find by my life what to do to resolve this xD
The error goes as fowllowing:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'itemHandler': Unsatisfied dependency expressed through field 'repo'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'itemRepository' defined in com.example.demo.service.itemRepository defined in #EnableMongoRepositories declared on MongoRepositoriesRegistrar.EnableMongoRepositoriesConfiguration: Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property findbyidItem found for type ItemObject!
If you wanna look at the code, the app is pretty small : https://bitbucket.org/ZeroD0Z/zerod0z-api/src/master/demo/src/main/java/com/example/demo/
You should rename your repository method, the right name should be with the capitalized property name,(and keyword By also).
So the right name would be (notice IdItem):
ItemObject findByIdItem (String idItem);
Otherwise, JPA can not resolve the property name.
I have a java application in which one of the classes has ContextRefresher autowired:
public abstract class AbstractConfigurationPersister implements IConfigurationPersister {
#Autowired
private ContextRefresher contextRefresher;
#Override
public void forceRefresh() {
contextRefresher.refresh();
}
}
This autowired bean is giving me problems as from the logs, it says that paramater 1 has an unsatisfied dependency.
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration$DataSourceTransactionManagerConfiguration':
Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'application':
Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name
'ktc.tanalytics.prediction.PredictionBeanConfiguration':
Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'configurationService' defined in ktc.tanalytics.commons.CommonsBeanConfiguration:
Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'zookeeperConfigurationPersister' defined in ktc.tanalytics.commons.CommonsBeanConfiguration:
Initialization of bean failed; nested exception is
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'contextRefresher' defined in class path resource [org/springframework/cloud/autoconfigure/RefreshAutoConfiguration.class]:
Unsatisfied dependency expressed through method 'contextRefresher' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'refreshScope':
Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'org.springframework.transaction.config.internalTransactionAdvisor'
defined in class path resource [org/springframework/transaction/annotation/ProxyTransactionManagementConfiguration.class]:
Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor]:
Factory method 'transactionAdvisor' threw exception; nested exception is java.lang.NullPointerException
Now, I have checked the code of ContextRefresher in spring (https://github.com/spring-cloud/spring-cloud-commons/blob/master/spring-cloud-context/src/main/java/org/springframework/cloud/context/refresh/ContextRefresher.java) and it receives two arguments.
I suppose that Spring is responsible of creating this ContextRefresher object since it is basically #Autowired. However I do not know why parameter 1 is missing as the log says
Factory method 'transactionAdvisor' threw exception; nested exception is java.lang.NullPointerException
As I focus on the above nested exception, probably transactionAdvisor
is a factory method which tries to create something and while
creating, it is performing some operation on null object.
Just inspect or debug the method: transactionAdvisor , in your code.
I'm using spring hibernate in my application. I used all the required jar files but still getting bean creation exception saying the following:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'voteController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.mindtree.service.VoteService com.mindtree.controller.VoteController.voteService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'voteServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.mindtree.dao.VoteDao com.mindtree.serviceImpl.VoteServiceImpl.voteDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'voteDaoImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.springframework.orm.hibernate3.HibernateTemplate com.mindtree.daoImpl.VoteDaoImpl.hibernateTemplate; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateTemplate' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
In Java, read the stacktrace from the last line, which will be the root cause of the problem. If you fix the java.lang.NoClassDefFoundError, by adding the respective jar file in your classpath, then it will work fine.
As you can see in the stacktrace:
nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
The class GenericObjectPool is missing in your classpath.
So you have to add the commons-pool.jar to your project which contains this class.
Hi I get the following error when i try to execute my JUNIT test case.
If somebody can help me with this, it would be of great help.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'commonValuesBackingBean' defined in class path resource [resources/ffms-storevisit-spring.xml]: Cannot resolve reference to bean 'cycleBackingBean' while setting bean property 'cycleBackingBean'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cycleBackingBean' defined in class path resource [resources/ffms-storevisit-spring.xml]: Cannot resolve reference to bean 'cycleManager' while setting bean property 'cycleManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cycleManager' defined in class path resource [resources/ffms-storevisit-spring.xml]: Cannot resolve reference to bean 'cycleBO' while setting bean property 'cycleBO'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cycleBO' defined in class path resource [resources/ffms-storevisit-spring.xml]: Cannot resolve reference to bean 'cycleDAO' while setting bean property 'cycleDAO'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cycleDAO' defined in class path resource [resources/ffms-storevisit-spring.xml]: Cannot resolve reference to bean 'sqlMapClient' while setting bean property 'sqlMapClient'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClient' defined in class path resource [resources/ffms-common-spring.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(Ljava/io/InputStream;Ljava/util/Properties;)Lcom/ibatis/sqlmap/client/SqlMapClient;
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
Eagerly waiting for the reply. Thanks in advance.
As you said, you have ibatis-sqlmap jar in your CLASSPATH. Then try open it (it's zip file) and check that there is com/ibatis/sqlmap/engine/builder/xml/SqlMapConfigParser.class file.
If it's not there then this means your jar is corrupted or was modified. If it's there then your CLASSPATH is wrong.
I'm trying to implement validation in a springmvc app, I followed the example described at
http://maestric.com/doc/java/spring/form_validation
When I run the app, I get the following error :
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name
'beanNameUrlHandlerMapping' defined in
ServletContext resource
[/WEB-INF/dispatcher-servlet.xml]:
Initialization of bean failed; nested
exception is
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name
'/update.html' defined in
ServletContext resource
[/WEB-INF/dispatcher-servlet.xml]:
Initialization of bean failed; nested
exception is
org.springframework.beans.InvalidPropertyException:
Invalid property 'commandClass' of
bean class
[training.springmvc.crud.controller.UpdatePersonController]:
No property 'commandClass' found
Anyone has an idea?
It looks like the bean declaration for /update.html is trying to set the value of a non-existent property called commandClass on an instance of your UpdatePersonController class.
(If you showed us the relevant code and XML wiring files we could confirm this.)