struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ted Husted" <hus...@apache.org>
Subject Re: [HELP][S2] spring configuration of hibernate
Date Thu, 07 Sep 2006 20:01:34 GMT
With Struts 2, something to keep in mind is that it already uses
Spring under the covers. There should already be a Spring 1.2.8
listener included the default web.xml.  Generally, you can just put
applicationContext.xml in the WEB-INF and have at it.

Using Hibernate with Struts 2 shouldn't be a problem. It's popular in
the WebWork community and used in the sample application in WebWork in
Action.

Though, since I haven't tried using Hibernate with Struts 2 myself, I
should point you to the WebWork user list for some battle-tested
advice.

* http://forums.opensymphony.com/search.jspa?objID=f1&q=hibernate

Anything that works with WebWork 2.2 should work with the Struts 2.0.0 snapshot.

-- HTH, Ted.
* http://www.husted.com/struts/


On 9/6/06, Garner Shawn <shawndgarner@gmail.com> wrote:
> I'm getting the following:
> SEVERE: Error listenerStart
>
> I know it's the spring file because if I comment everything out it works fine.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
> "http://www.springframework.org/dtd/spring-beans.dtd">
>
> <beans default-autowire="no">
>     <!-- add your spring beans here -->
>     <bean id="myDataSource"
> class="org.apache.commons.dbcp.BasicDataSource"
> destroy-method="close">
>                 <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
>                 <property name="url" value="jdbc:mysql://localhost:3306/agejsoft"/>
>                 <property name="username" value="username"/>
>                 <property name="password" value="password"/>
>         </bean>
>
>     <bean id="sessionFactory"
> class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
>         <property name="dataSource" ref="myDataSource"/>
>
>         <property name="hibernateProperties">
>                 <props>
>                         <!-- <prop
> key="hibernate.connection.driver_class">com.mysql.jdbc.Driver</prop>
>                         <prop key="hibernate.connection.url">jdbc:mysql://localhost:3306/agejsoft</prop>
>                         <prop key="hibernate.connection.username">username</prop>
>                         <prop key="hibernate.connection.password">password</prop>
-->
>                         <prop key="hibernate.connection.pool_size">1</prop>
>                         <prop key="hibernate.dialect">org.hibernate.dialect.MySQLMyISAMDialect</prop>
>                         <prop key="hibernate.current_session_context_class">thread</prop>
>                         <prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop>
>                         <prop key="hibernate.show_sql">true</prop>
>                         <prop key="hibernate.hbm2ddl.auto">create</prop>
>                 </props>
>         </property>
>         <property name="mappingDirectoryLocations">
>                 <list>
>                         <value>classpath:/com/age/j/soft/hibernate</value>
>                 </list>
>         </property>
>     </bean>
>
>     <bean id="hibernateTemplate"
> class="org.springframework.orm.hibernate3.HibernateTemplate">
>         <property name="sessionFactory">
>                 <ref bean="sessionFactory"/>
>         </property>
>     </bean>
>
>     <bean id="productDAO" class="com.age.j.soft.dao.ProductDAO">
>         <property name="hibernateTemplate">
>                 <ref bean="hibernateTemplate"/>
>         </property>
>     </bean>
>
>
> </beans>
>
> I'm using Tomcat 5.5.17 and all the logging I can find from the spring
> file loading is in the catalina log.  How can I diagnose the problem
> better?
> What am I doing wrong?
>
> Shawn
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message