hibernate + spring + mysql problem, trouble master settlement, engage in a few days did not engage in out

Category: Web Develop
 
a233479456
2008-11-07 07:55:35

Sponsored Links
2011-03-09 00:22:18,343 ERROR [org.springframework.web.context.ContextLoader] - <Context initialization failed>
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 [F: \ workspace \. metadata \. plugins \ org.eclipse.wst . server.core \ tmp0 \ wtpwebapps \ eshops \ WEB-INF \ classes \ config \ spring \ dataAccessContext-hibernate.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean ; property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [F : \ workspace \. metadata \. plugins \ org.eclipse.wst.server.core \ tmp0 \ wtpwebapps \ eshops \ WEB-INF \ classes \ config \ spring \ dataAccessContext-hibernate.xml]: Invocation of init ; method failed; nested exception is java.lang.NullPointerException
Caused by:
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 [F: \ workspace \. metadata \. plugins \ org.eclipse. wst.server.core \ tmp0 \ wtpwebapps \ eshops \ WEB-INF \ classes \ config \ spring \ dataAccessContext-hibernate.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [ F: \ workspace \. metadata \. plugins \ org.eclipse.wst.server.core \ tmp0 \ wtpwebapps \ eshops \ WEB-INF \ classes \ config \ spring \ dataAccessContext-hibernate.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
Caused by:
org.springframework.beans.factory.BeanCreationException: Error creating ; bean with name 'transactionManager' defined in file [F: \ workspace \. metadata \. plugins \ org.eclipse.wst.server.core \ tmp0 \ wtpwebapps \ eshops \ WEB-INF \ classes \ config \ spring \ dataAccessContext-hibernate.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [F: \ workspace \. metadata \. plugins \ org.eclipse.wst . server.core \ tmp0 \ wtpwebapps \ eshops \ WEB-INF \ classes \ config \ spring \ dataAccessContext-hibernate.xml]: Invocation of init method failed; nested exception is java. lang.NullPointerException
Caused by:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [F: \ workspace \. metadata \. plugins \ org.eclipse.wst.server.core \ tmp0 \ wtpwebapps \ eshops \ WEB-INF \ classes \ config \ spring \ dataAccessContext-hibernate.xml]: Invocation ; of init method failed; nested exception is java.lang.NullPointerException
Caused by:
java.lang.NullPointerException
at org . hibernate.util.ReflectHelper.getConstructor (ReflectHelper.java: 172)
at org.hibernate.hql.ast.tree.ConstructorNode.resolveConstructor (ConstructorNode.java: 114)
at org.hibernate . hql.ast.tree.ConstructorNode.prepare (ConstructorNode.java: 88)
at org.hibernate.hql.ast.HqlSqlWalker.processConstructor (HqlSqlWalker.java: 840)
at org.hibernate . hql.antlr.HqlSqlBaseWalker.selectExpr (HqlSqlBaseWalker.java: 1956)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExprList (HqlSqlBaseWalker.java: 1825)
at org.hibernate.hql . antlr.HqlSqlBaseWalker.selectClause (HqlSqlBaseWalker.java: 1394)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query (HqlSqlBaseWalker.java: 553)
at org.hibernate.hql.antlr . HqlSqlBaseWalker.selectStatement (HqlSqlBaseWalker.java: 281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement (HqlSqlBaseWalker.java: 229)
at org.hibernate.hql.ast.QueryTranslatorImpl . analyze (QueryTranslatorImpl.java: 228)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile (QueryTranslatorImpl.java: 160)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile (QueryTranslatorImpl.java: 111)
at org.hibernate.engine.query.HQLQueryPlan. <init> (HQLQueryPlan.java: 77)
at org.hibernate.engine.query.HQLQueryPlan. <init> (HQLQueryPlan.java: 56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan (QueryPlanCache.java: 72)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries (SessionFactoryImpl.java: 402)

Sponsored Links

liyanhappy2009
2008-11-07 08:06:15
at org.hibernate.impl.SessionFactoryImpl. <init> (SessionFactoryImpl.java: 352)
at org.hibernate.cfg . Configuration.buildSessionFactory (Configuration.java: 1300)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory (LocalSessionFactoryBean.java: 805)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean . buildSessionFactory (LocalSessionFactoryBean.java: 745)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet (AbstractSessionFactoryBean.java: 134)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory . invokeInitMethods (AbstractAutowireCapableBeanFactory.java: 1203)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean (AbstractAutowireCapableBeanFactory.java: 1172)
at org.springframework.beans.factory.support . AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java: 427)
at org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject (AbstractBeanFactory.java: 249)
at org.springframework.beans. factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java: 155)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java: 246)
at org.springframework. beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java: 160)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference (BeanDefinitionValueResolver.java: 267)
at org. springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary (BeanDefinitionValueResolver.java: 110)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues ​​(AbstractAutowireCapableBeanFactory.java: 1100)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean (AbstractAutowireCapableBeanFactory.java: 862)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java: 423)
at org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject (AbstractBeanFactory.java: 249)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java: 155)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java: 246)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java: 160 )
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference (BeanDefinitionValueResolver.java: 267)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary (BeanDefinitionValueResolver.java : 110)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues ​​(AbstractAutowireCapableBeanFactory.java: 1100)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean (AbstractAutowireCapableBeanFactory . java: 862)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java: 423)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean (BeanDefinitionValueResolver.java: 216)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary (BeanDefinitionValueResolver.java: 128)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory . applyPropertyValues ​​(AbstractAutowireCapableBeanFactory.java: 1100)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean (AbstractAutowireCapableBeanFactory.java: 862)
at org.springframework.beans.factory.support . AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java: 423)
at org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject (AbstractBeanFactory.java: 249)
at org.springframework.beans. factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java: 155)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java: 246)
at org.springframework. beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java: 160)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons (DefaultListableBeanFactory.java: 291)
at org. springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java: 352)
at org.springframework.web.context.ContextLoader.createWebApplicationContext (ContextLoader.java: 246)
at org.springframework. web.context.ContextLoader.initWebApplicationContext (ContextLoader.java: 189)
at org.springframework.web.context.ContextLoaderListener.contextInitialized (ContextLoaderListener.java: 49)
at org.apache.catalina. core.StandardContext.listenerStart (StandardContext.java: 3843)
at org.apache.catalina.core.StandardContext.start (StandardContext.java: 4342)
at org.apache.catalina.core. ContainerBase.start (ContainerBase.java: 1045)
at org.apache.catalina.core.StandardHost.start (StandardHost.java: 719)
at org.apache.catalina.core.ContainerBase. start (ContainerBase.java: 1045)
at org.apache.catalina.core.StandardEngine.start (StandardEngine.java: 443)
at org.apache.catalina.core.StandardService.start ( StandardService.java: 516)
at org.apache.catalina.core.StandardServer.start (StandardServer.java: 710)
at org.apache.catalina.startup.Catalina.start (Catalina. java: 578)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java: 39)
at sun. reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java: 25)
at java.lang.reflect.Method.invoke (Method.java: 597)
at org.apache.catalina.startup.Bootstrap. start (Bootstrap.java: 288)
at org.apache.catalina.startup.Bootstrap.main (Bootstrap.java: 413)
2011-3-9 0:22:18 org. apache.catalina.core.StandardContext listenerStart
serious: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener

<? xml version = "1.0" encoding = "UTF-8"?>
<beans xmlns = "
xmlns : xsi = "
xmlns: aop ="
xmlns: tx = "
xsi: schemaLocation =" :/ / www.springframework.org/schema/beans/spring- beans-2.0.xsd
:/ / www.springframework.org/schema/aop/spring-aop-2.0.xsd
:/ / www.springframework.org/ schema/tx/spring-tx-2.0.xsd "
default-autowire =" byName "default-lazy-init =" true ">

<! - - the data source definition, using Apache DBCP connection pool ->
<bean id = "dataSource"
class = "org.apache.commons.dbcp. BasicDataSource "
destroy-method =" close ">
<property name =" driverClassName "
value =" $ {jdbc.driverClassName} "/> ;
<property name="url" value="${jdbc.url}" />
<property name = "username" value = "$ {jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<property name="initialSize" value="${dataSource.initialSize}" />
<property name = "maxIdle" value = "$ {dataSource.maxIdle}" />
<property name="minIdle" value="${dataSource.minIdle}" />
<property name="maxActive" value="${dataSource.maxActive}" />
<property name = "maxWait" value = "$ {dataSource.maxWait}" />
<property name = "defaultAutoCommit"
value = "$ {dataSource.defaultAutoCommit}" />
</bean>

<! - Hibernate SessionFatory ->
<bean id = "sessionFactory"
class = "org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="lobHandler" ref="lobHandler"/>
<property name="mappingDirectoryLocations">
<list>
<value> classpath: sail / business / model / </value>
< ;/ list>
</property>
<property name="hibernateProperties">
<props>
<prop key = "hibernate . dialect ">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql"> false </prop>
<prop key="hibernate.cache.provider_class">
org.hibernate.cache.EhCacheProvider
</prop>
<prop key = " hibernate.cache.use_query_cache "> true </prop>
<prop key="hibernate.jdbc.fetch_size"> 80 </prop>
<prop key = "hibernate.jdbc.batch_size"> 35 </prop>

</props>
</property>
</bean>

<! - Hibernate TransactionManager ->
<bean id = "transactionManager"
class = "org.springframework.orm.hibernate3.HibernateTransactionManager" >
<property name="sessionFactory" ref="sessionFactory" />
</bean>
</beans>

shuimu71002
2008-11-07 08:16:53
I started hibernate + spring + oracle now into hibernate + spring + mysql
when I use mysql mysql-connector-java-3.1.8 -bin.jar added to the project inside, then put
<prop key="hibernate.dialect">
org.hibernate.dialect.Oracle9Dialect
</prop>
into
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop> ask this question after a the.

web.xml
<? xml version = "1.0" encoding = "UTF-8"?>
<web-app xmlns = "
xmlns: xsi ="
xsi: schemaLocation = ":/ / java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version = "2.4">
<context-param>
<param-name> contextConfigLocation </ param-name>
<param-value> classpath * :/ config / spring / *. xml </ param-value>
</ context-param>

<filter>
<filter-name> NoCache </ filter- name>
<filter-class>
sail.business.support.ResponseHeaderFilter
</ filter-class>
<init-param>
< param-name> Cache-Control </ param-name>
<param-value> no-cache, must-revalidate </ param-value>
</ init-param>
</filter>
<filter>
<filter-name> CacheForWeek </ filter-name>
<filter-class>
sail.business . support.ResponseHeaderFilter
</ filter-class>
<init-param>
<param-name> Cache-Control </ param-name>
< param-value> max-age = 28800, public </ param-value>
</ init-param>
</filter>
dynasty_guo
2008-11-07 08:26:41
<! - Hibernate Open Session in View Filter ->

<filter>
<filter-name> hibernateFilter </ filter-name>
<filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
</ filter-class>
</filter>
< filter-mapping>
<filter-name> hibernateFilter </ filter-name>
<url-pattern> / * </ url-pattern>
</ filter-mapping> ;

<! - Spring ApplicationContext Loading ->
<listener>
<listener-class>
org. springframework.web.context.ContextLoaderListener
</ listener-class>

</listener>

<! - Spring refresh Introspector ->
<listener>
<listener-class>
org.springframework.web.util.IntrospectorCleanupListener
</ listener-class>
Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.