Monday 25 July 2011

java.io.InvalidObjectException: Could not find a SessionFactory named: null org.hibernate.impl.SessionFactoryImpl.readResolve(SessionFactoryImpl.java:642)

Problem
=======
org.springframework.webflow.execution.repository.snapshot.SnapshotUnmarshalException: IOException thrown deserializing the flow execution stored in this snapshot -- this should not happen!
org.springframework.webflow.execution.repository.snapshot.SerializedFlowExecutionSnapshot.unmarshal(SerializedFlowExecutionSnapshot.java:100)
org.springframework.webflow.execution.repository.snapshot.SerializedFlowExecutionSnapshotFactory.restoreExecution(SerializedFlowExecutionSnapshotFactory.java:80)

java.io.InvalidObjectException: Could not find a SessionFactory named: null
org.hibernate.impl.SessionFactoryImpl.readResolve(SessionFactoryImpl.java:642)


Solution
========
???

Alternative
===========
[webflow:listener ref="hibernateFlowExecutionListener"/]

[bean id="hibernateFlowExecutionListener"
class="org.springframework.webflow.persistence.HibernateFlowExecutionListener"]
[constructor-arg ref="sessionFactory"/]
[constructor-arg ref="transactionManager"/]
[/bean]


[beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"]

[bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource"]
[property name="driverClassName"
value="org.apache.derby.jdbc.ClientDriver"/]
[property name="url"
value="jdbc:derby://localhost:1527/library"/]
[property name="username" value="app"/]
[property name="password" value="app"/]
[/bean]

[bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"]
[property name="dataSource" ref="dataSource"/]
[property name="annotatedClasses"]
[list]
[value]com.apress.springrecipes.library.domain.BorrowingRecord[/value]
[/list]
[/property]
[property name="hibernateProperties"]
[props]
[prop key="hibernate.session_factory_name"]mySessionFactory[/prop]
[prop key="hibernate.dialect"]org.hibernate.dialect.DerbyDialect[/prop]
[prop key="hibernate.show_sql"]true[/prop]
[prop key="hibernate.hbm2ddl.auto"]update[/prop]
[/props]
[/property]
[/bean]

[bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager"]
[property name="sessionFactory" ref="sessionFactory"/]
[/bean]

No comments:

Post a Comment