witam serdecznie. próbuję połączyć springa, hibernat i odpalic tylko aplikację z linijką
ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
i koniec :) mam mniej więcej zarys tego wszystkiego, pisalem o tym tutaj http://4programmers.net/Forum/411104?h=#id411104
Niestety coś mi nie gra,dostaję w pewnym momencie coś takiego:
log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'facadeBean' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'transactionAttributes' threw exception; nested exception is org.springframework.core.ConstantException: Field 'PROPAGATION_MANDATORY>' not found in class [org.springframework.transaction.TransactionDefinition]
Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessException details (1) are:
PropertyAccessException 1:
org.springframework.beans.MethodInvocationException: Property 'transactionAttributes' threw exception; nested exception is org.springframework.core.ConstantException: Field 'PROPAGATION_MANDATORY>' not found in class [org.springframework.transaction.TransactionDefinition]
Caused by: org.springframework.core.ConstantException: Field 'PROPAGATION_MANDATORY>' not found in class [org.springframework.transaction.TransactionDefinition]
at org.springframework.core.Constants.asObject(Constants.java:146)
at org.springframework.core.Constants.asNumber(Constants.java:114)
wywaliłem z ciekawości linijkę <prop key="*">PROPAGATION_MANDATORY></prop>
i na wyjsciu dostalem tylko 2 pierwsze linijki powyższego listingu(nie powinno sie logowac cos wiecej?)
miał ktoś kiedyś taki problem? może to coś z importami ... help me [glowa]
moj applicationContext:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="transactionManagerBean" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactoryBean" />
</property>
</bean>
<bean id="daoBean" class="pl.ePlay.Dao.DaoImpl">
<property name="sessionFactory">
<ref local="sessionFactoryBean" />
</property>
</bean>
<bean id="sessionFactoryBean" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="mappingResources">
<list>
<value>pl/ePlay/Data/Player.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
</props>
</property>
<property name="dataSource">
<ref bean="dataSourceBean" />
</property>
</bean>
<bean id="facadeBean" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManagerBean"/>
</property>
<property name="target">
<bean class="pl.ePlay.Service.Facade">
</bean>
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_MANDATORY></prop>
</props>
</property>
</bean>
<bean id="dataSourceBean" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://localhost/eplay</value>
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value>blaaaa</value>
</property>
</bean>
</beans>