Hello,

Has anyone encountered any difficulties moving from spring 2 to 2.5? I've been refactoring our code base to use all of the nice annotation stuff in 2.5 but I am experiencing some hair pulling problems with transaction management. I'm using the latest version of appfuse with spring mvc and I've annotated all the service and repository classes. Transaction management works fine in our utility code and when running tests (with the spring-test package using @Transactional), however I get the dreaded:

"HibernateSystemException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here"

error when attempting to access my hibernate dao classes (specifically when logging into the application, I'm using ACEGI). The weird thing is that the startup servlet has no problem accessing the hibernate dao's.

My web.xml looks like:
[code]
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee";
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>

 <display-name>Pizza 73 Online Store</display-name>

 <!-- Context Configuration locations for Spring XML files -->
 <context-param>
   <param-name>contextConfigLocation</param-name>
   <param-value>
classpath*:META-INF/applicationContext*.xml,/WEB-INF/applicationContext-resources.xml,/WEB-INF/security.xml
   </param-value>
 </context-param>

 <!-- Define the basename for a resource bundle for I18N -->
 <context-param>
   <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
   <param-value>ApplicationResources</param-value>
 </context-param>

   <listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
   </listener>

 <listener>
   <listener-class>
     org.springframework.web.util.IntrospectorCleanupListener
   </listener-class>
 </listener>

 <listener>
<listener-class>com.pizza73.webapp.cscAdmin.listener.CSCAdminStartupListener</listener-class>
 </listener>

 <listener>
   <listener-class>
     org.springframework.web.context.request.RequestContextListener
   </listener-class>
 </listener>

 <servlet>
   <servlet-name>cscAdmin</servlet-name>
   <servlet-class>
     org.springframework.web.servlet.DispatcherServlet
   </servlet-class>
   <load-on-startup>2</load-on-startup>
 </servlet>

 <servlet-mapping>
   <servlet-name>cscAdmin</servlet-name>
   <url-pattern>*.html</url-pattern>
 </servlet-mapping>

 <servlet-mapping>
   <servlet-name>cscAdmin</servlet-name>
   <url-pattern>/dwr/*</url-pattern>
 </servlet-mapping>
...
[/code]

and my servlet config looks like:

[code]
<?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:dwr="http://www.directwebremoting.org/schema/spring-dwr";
   xmlns:p="http://www.springframework.org/schema/p";
   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-2.5.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context-2.5.xsd
       http://www.directwebremoting.org/schema/spring-dwr
       http://www.directwebremoting.org/schema/spring-dwr-2.0.xsd
       http://www.springframework.org/schema/tx
       http://www.springframework.org/schema/tx/spring-tx-2.5.xsd";>

  <context:annotation-config/>
  <context:component-scan base-package="com.pizza73.webapp" />
  <context:spring-configured />
   ...
[/code]

Thanks,

Chris.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to