GUJ
Notícias, artigos e o maior fórum brasileiro sobre Java
home
fórum
notícias
tópicos recentes
empregos
artigos
Bem-vindo ao GUJ.
Crie seu login
, ou digite-o para logar no site.
Usuário:
Senha:
[RESOLVIDO] Problema pra configurar aplicação Spring + Hibernate
Índice dos Fóruns
»
Desenvolvimento Web
Autor
Mensagem
21/06/2007 19:45:39
Assunto:
[RESOLVIDO] Problema pra configurar aplicação Spring + Hibernate
robpadawan
What is classpath?
Membro desde: 07/05/2007 18:57:57
Mensagens: 8
Offline
Estou começando uma aplicação com spring + hibernate e me deparei com um erro que não estou conseguindo corrigir de modo algum, caso possam me ajudar, segue os dados que penso ser relevante:
Erro:
SEVERE: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'statusService' defined in ServletContext resource [/WEB-INF/easycontent-service.xml]: Cannot resolve reference to bean 'statusServiceTarget' while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'statusServiceTarget' defined in ServletContext resource [/WEB-INF/easycontent-service.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'statusDAO' of bean class [br.com.easycontent.service.StatusServiceImpl]: Bean property 'statusDAO' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'statusServiceTarget' defined in ServletContext resource [/WEB-INF/easycontent-service.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'statusDAO' of bean class [br.com.easycontent.service.StatusServiceImpl]: Bean property 'statusDAO' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'statusDAO' of bean class [br.com.easycontent.service.StatusServiceImpl]: Bean property 'statusDAO' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:793) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:645) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1126) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:861) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:421) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:270) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:261) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:109) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1099) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:861) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:421) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:284) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:244) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) at org.apache.catalina.core.StandardHost.start(StandardHost.java:736) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:448) at org.apache.catalina.core.StandardServer.start(StandardServer.java:700) at org.apache.catalina.startup.Catalina.start(Catalina.java:552) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
easycontent-service.xml
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <!-- =================================================================== --> <!-- Spring Application Context for TechConf Application Service Tier --> <!-- By Brian Sam-Bodden --> <!-- =================================================================== --> <beans> <!-- =================================================================== --> <!-- DynaDTO BuilderFactory --> <!-- =================================================================== --> <bean id="builderFactory" class="org.dynadto.spring.LocalBuilderFactoryBean"> <property name="mappingDirectoryLocations"> <list> <value>/WEB-INF/dto</value> </list> </property> </bean> <!-- =================================================================== --> <!-- JavaMail Sender --> <!-- =================================================================== --> <!-- =================================================================== --> <!-- Services --> <!-- =================================================================== --> <!-- =================================================================== --> <!-- Service Targets --> <!-- =================================================================== --> <bean id="statusServiceTarget" class="br.com.easycontent.service.StatusServiceImpl" singleton="false" init-method="initialization"> <property name="statusDAO"><ref bean="statusDAO" /></property> <property name="builderFactory"><ref bean="builderFactory"/></property> </bean> <!-- =================================================================== --> <!-- Transaction-wrapped Services --> <!-- =================================================================== --> <bean id="statusService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref bean="transactionManager"/></property> <property name="target"><ref bean="statusServiceTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED, readOnly</prop> <prop key="submit*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> </beans>
easycontent-data.xml:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <!-- =================================================================== --> <!-- Spring Application Context for TechConf Application Data Tier --> <!-- By Brian Sam-Bodden --> <!-- =================================================================== --> <beans> <!-- =================================================================== --> <!-- Resolve placeholder properties ${...} in beans from values in --> <!-- properties file --> <!-- =================================================================== --> <bean id="configurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location"> <value>/WEB-INF/jdbc.properties</value> </property> </bean> <!-- =================================================================== --> <!-- Data Source --> <!-- =================================================================== --> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName"> <value>${jdbc.driverClassName}</value> </property> <property name="url"> <value>${jdbc.url}</value> </property> <property name="username"> <value>${jdbc.username}</value> </property> <property name="password"> <value>${jdbc.password}</value> </property> </bean> <!-- =================================================================== --> <!-- Hibernate SessionFactory TODO ref local ou rel bean --> <!-- =================================================================== --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref local="dataSource"/> </property> <property name="mappingResources"> <list> <value>br/com/easycontent/model/Status.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> <prop key="hibernate.cglib.use_reflection_optimizer">true</prop> </props> </property> </bean> <!-- =================================================================== --> <!-- Spring's HibernateTemplate --> <!-- =================================================================== --> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> <property name="sessionFactory"><ref bean="sessionFactory"/></property> </bean> <!-- =================================================================== --> <!-- Spring-Hibernate DAOs --> <!-- =================================================================== --> <bean id="statusDAO" class="br.com.easycontent.dao.StatusDAOImpl"> <property name="hibernateTemplate"><ref bean="hibernateTemplate"/></property> </bean> <!-- =================================================================== --> <!-- Hibernate Transaction Manager --> <!-- =================================================================== --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory"><ref local="sessionFactory"/></property> </bean> </beans>
web.xml:
<?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name> easycontent </display-name> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/easycontent-data.xml,/WEB-INF/easycontent-service.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <servlet> <servlet-name>easycontent</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>easycontent</servlet-name> <url-pattern>*.htm</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> </web-app>
Se precisarem de mais algum dado é só falar...
Desde já agradeço a todos
always learning...
21/06/2007 20:06:45
Assunto:
Problema pra configurar aplicação Spring + Hibernate
robpadawan
What is classpath?
Membro desde: 07/05/2007 18:57:57
Mensagens: 8
Offline
Resolvido.
Desculpem, tinha esquecido de colocar os sets e gets dos parametros passados pelo xml na classe de serviço.
always learning...
Índice dos Fóruns
»
Desenvolvimento Web
Ir para:
Selecione um Fórum
Notícias
Assuntos gerais (Off-topic)
MundoJ - Artigos, Notícias e Debates
Artigos e Tutoriais
Java Básico
Java Avançado
Ferramentas, Frameworks e Utilitários
Desenvolvimento Web
Interface Gráfica
Google Android e Java Micro Edition (ME)
Certificação Java
Persistência: Hibernate, JPA, JDBC e outros
Java Enterprise Edition (Java EE)
Frameworks e Bibliotecas brasileiros
RIA - Flex, JavaFX e outros
Arquitetura de Sistemas
Metodologias de Desenvolvimento e Testes de Software
JavaScript
Ruby & Ruby on Rails
Outras Linguagens
Powered by
JForum 2.1.8
©
JForum Team