1, error message: Java.lang.IllegalStateException:BeanFactory not initialized or already closed-call ' refresh ' before accessing is Ans via the ApplicationContext
Probably look at the error message: Beanfactory is not instantiated or has been closed for a simple reason: applicationcontext ctx = new Classpathxmlapplicationcontext (); Spring instantiates beanfactory by default to Classpath to look for files named Applicationcontext.xml . But that is the reason for this error: ApplicationContext CTX = new Classpathxmlapplicationcontext ("Applicationcontext.xml"); If so, there will be no such mistake. 2, Java.lang.noclassdeffounderror:javax/transaction/transactionmanager Import a Jta.jar 3, Org.springframework.beans.factory.BeanCreationException:Error creating Bean with Name ' sessionfactory ' defined in ServletContext resource [/web-inf/hibernatesessionfactory.xml]: Initialization of Bean failed; Nested exception is Java.lang.noclassdeffounderror:org/hibernate/cache/cacheprovider
Original: <bean id= "Sessionfactory"
Class= "Org.springframework.orm. hibernate3. Annotation. Annotationsessionfactorybean ">
Change to: <bean id= "Sessionfactory"
Class= "Org.springframework.orm. hibernate4. Localsessionfactorybean ">
Problem solved, found that can be used normally 4, Java.lang.noclassdeffounderror:org/jboss/logging/basiclogger missing a jar package Jboss-logging.jar/HTTP/ MVNREPOSITORY.COM/ARTIFACT/ORG.JBOSS.LOGGING/JBOSS-LOGGING/3.1.0.CR1 5, java.lang.noclassdeffounderror:javax/ Persistence/entity Java.lang.noclassdeffounderror:javax/persistence/attributeconverter 1) When using the Hibernate3, The Discovery program compiles and always throws a Java.lang.noclassdeffounderror:javax/persistence/entitylisteners exception at run time. The lookup is due to a missing Ejb3-persistence.jar package.
Simply add Ejb3-persistence.jar to the class library and the exception will not occur.
What is not understood here is Hibernate3, why not put Ejb3-persistence.jar directly into the class library of their own needs, rather than let the user find, to add.
Attachment is Ejb3-persistence.jar
If you need the full Hibernate3 of the relevant jar package, please go to http://javapub.iteye.com/blog/867943 download 2) hibernate requires JPA support, Import the JPA jar package (Hibernate-jpa-2.0-api-1.0.1.final.jar).