- This topic has 1 reply, 2 voices, and was last updated 12 years, 1 month ago by
support-swapna.
-
AuthorPosts
-
dmalfondetMemberlog4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread “main” org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘transactionManager’ defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.service.UnknownUnwrapTypeException: Cannot unwrap to requested type [javax.sql.DataSource]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at test.DcInsert.main(DcInsert.java:14)
Caused by: org.hibernate.service.UnknownUnwrapTypeException: Cannot unwrap to requested type [javax.sql.DataSource]
at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.unwrap(DriverManagerConnectionProviderImpl.java:91)
at org.springframework.orm.hibernate4.SessionFactoryUtils.getDataSource(SessionFactoryUtils.java:101)
at org.springframework.orm.hibernate4.HibernateTransactionManager.afterPropertiesSet(HibernateTransactionManager.java:264)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
… 12 moreApplicationContext.xml
<?xml version=”1.0″ encoding=”UTF-8″?>
<beans
xmlns=”http://www.springframework.org/schema/beans”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xmlns:p=”http://www.springframework.org/schema/p”
xsi:schemaLocation=”http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd”><bean id=”sessionFactory”
class=”org.springframework.orm.hibernate4.LocalSessionFactoryBean”>
<property name=”configLocation” value=”classpath:hibernate.cfg.xml”>
</property>
</bean><bean id=”transactionManager”
class=”org.springframework.orm.hibernate4.HibernateTransactionManager”>
<property name=”sessionFactory”>
<ref local=”sessionFactory” />
</property>
</bean><!– DAO’s –>
<bean id=”DemandecomDAO” class=”db.DemandecomDAO”>
<property name=”sessionFactory”>
<ref bean=”sessionFactory” />
</property>
</bean><!– Services definition –>
<bean id=”dcManagerServiceTarget” class=”server.service.impl.DcManagerServiceImpl”>
<property name=”demandecomDAO”>
<ref local=”DemandecomDAO” />
</property>
</bean><!– Transactional proxy for the TRW Service –>
<bean id=”dcManagerService” class=”org.springframework.transaction.interceptor.TransactionProxyFactoryBean”>
<property name=”transactionManager”>
<ref local=”transactionManager” />
</property>
<property name=”target”>
<ref local=”dcManagerServiceTarget” />
</property>
<property name=”transactionAttributes”>
<props>
<prop key=”create*”>PROPAGATION_REQUIRED</prop>
<prop key=”update*”>PROPAGATION_REQUIRED</prop>
<prop key=”delete*”>PROPAGATION_REQUIRED</prop>
<prop key=”*”>PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean></beans>
hibernate.cfg.xml
<?xml version=’1.0′ encoding=’UTF-8′?>
<!DOCTYPE hibernate-configuration PUBLIC
“-//Hibernate/Hibernate Configuration DTD 3.0//EN”
“http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd”>
<!– Generated by MyEclipse Hibernate Tools. –>
<hibernate-configuration><session-factory>
<property name=”dialect”>org.hibernate.dialect.MySQLInnoDBDialect</property>
<property name=”connection.url”>
jdbc:mysql://localhost/trw
</property>
<property name=”connection.username”>root</property>
<property name=”connection.password”>elec</property>
<property name=”connection.driver_class”>
com.mysql.jdbc.Driver
</property>
<property name=”myeclipse.connection.profile”>mysql</property>
<mapping resource=”db/Demandecom.hbm.xml” /></session-factory>
</hibernate-configuration>
Attachments:
You must be logged in to view attached files.
support-swapnaModeratordmalfondet,
Sorry that you are seeing this issue. This looks more like Spring development issue.
Please take a look at these links which discuss similar issue :
http://stackoverflow.com/questions/10691486/spring-source-suite-spring3-hibernate4-maven-3-mysql-5
http://stackoverflow.com/questions/13670840/error-creating-bean-with-name-when-creating-a-transaction-managerI suggest you cross post to related development forums like stackoverflow.com as this is a development issue.
Hope it helps.
-
AuthorPosts