spring,hibernate wyjątek

0

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>
0

Dość jasno powiedziane co jest nie tak. Masz dwa błędy.
Pierwszy to te nieszczęsne dwie linijki na górze, które oznaczają niepoprawne skonfigurowanie log4j. Jak to zrobić poszukaj w tutorialu springa.
Drugi to próba ustawienia pola które nie istnieje lub ma inną nazwę (wielkości liter mają znaczenie) lub, co jest w tym przypadku, nieprawidłowo nadajesz wartość spróbuj przez value tak jak w API:
http://static.springframework.org/spring/docs/1.1.5/api/org/springframework/transaction/interceptor/TransactionProxyFactoryBean.html#setTransactionAttributes(java.util.Properties)

0

<prop key="*">PROPAGATION_MANDATORY></prop>

Czyżby wredna literówka?

Inna sprawa, że masz nizainicjowanego log4j i to pewnie powoduje, że nic więcej nie widzisz w logach.
Na stronach log4j jest opis jak to zrobić, więc nie będę tu powtarzał.

// @Koziołek - do postu na dole i na górze - pisaliśmy równocześnie

0
Krolik napisał(a)

<prop key="*">PROPAGATION_MANDATORY></prop>

Czyżby wredna literówka?

A to swoją drogą...

0

o boże nienawidzę literówek.... :)
dzięki chłopaki. Królik - to twoje nazwisko ? bo moje jest króliczek :D

bleee juz systko dziala :D

1 użytkowników online, w tym zalogowanych: 0, gości: 1