Spring boot:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personService' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'personDao' while setting bean property 'dao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personDao' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required
Solución: definir en el xml el bean "sessionFactory" para que se cablee a los beans que lo necesitan
viernes, 31 de agosto de 2007
Generic Dao Constructor needed
BeanCreationException: Error creating bean with name 'personService' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'personDao' while setting bean property 'dao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personDao' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com....PersonDaoHibernate]: No default constructor found; nested exception is java.lang.NoSuchMethodException: com....PersonDaoHibernate.()
martes, 21 de agosto de 2007
Exceptions
Como capturar exceptions de JPA?
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
disparada.
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
disparada.
martes, 7 de agosto de 2007
JPA init
DEBUG - Creating shared instance of singleton bean 'transactionManager'
DEBUG - Creating instance of bean 'transactionManager' with merged definition [Root bean: class [org.springframework.orm.jpa.JpaTransactionManager]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyException in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor': Cannot create inner bean '(inner bean)' of type [org.springframework.transaction.interceptor.TransactionInterceptor] while setting bean property 'transactionInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in file [D:\work\loader\applicationContext.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in file [D:\work\loader\applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'dataSource' of bean class [org.springframework.orm.jpa.LocalEntityManagerFactoryBean]: Bean property 'dataSource' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
Alternativa
Cambio de clases en el xml: sale LocalEntityManagerFactoryBean y entra LocalContainerEntityManagerFactoryBean
DEBUG - Creating instance of bean 'transactionManager' with merged definition [Root bean: class [org.springframework.orm.jpa.JpaTransactionManager]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyException in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor': Cannot create inner bean '(inner bean)' of type [org.springframework.transaction.interceptor.TransactionInterceptor] while setting bean property 'transactionInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in file [D:\work\loader\applicationContext.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in file [D:\work\loader\applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'dataSource' of bean class [org.springframework.orm.jpa.LocalEntityManagerFactoryBean]: Bean property 'dataSource' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
Alternativa
Cambio de clases en el xml: sale LocalEntityManagerFactoryBean y entra LocalContainerEntityManagerFactoryBean
Wiring
Sin wiring JPA usando
BeanFactory factory = new XmlBeanFactory(new FileSystemResource(
"applicationContext.xml"));
cambiado a
ApplicationContext factory= new FileSystemXmlApplicationContext(
"applicationContext.xml");
BeanFactory factory = new XmlBeanFactory(new FileSystemResource(
"applicationContext.xml"));
cambiado a
ApplicationContext factory= new FileSystemXmlApplicationContext(
"applicationContext.xml");
Suscribirse a:
Entradas (Atom)