This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Other Application Frameworks and the fly likes Problem regarding Struts+Spring+hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Problem regarding Struts+Spring+hibernate" Watch "Problem regarding Struts+Spring+hibernate" New topic

Problem regarding Struts+Spring+hibernate

ved gunjan
Ranch Hand

Joined: May 17, 2003
Posts: 86
Hi All,
Im trying to acheive the following framwork.
For the presentation layer i'm use Struts; for our business layer i'm using Spring; and for the persistence layer i'm using Hibernate.

I'm presently trying on
# Tomcat 5.0.28.
# DB2
# struts-1.2.7

The problem is when im starting my tomcat server,the struts-sonfig.xml and applicationContext.xml are not been able to read by the server,during server startup.
I've manually introduced errors on in the struts-config.xml,but still the server does not give any parser error during starup.
The only obvious reason is that the server is not able to read the struts-config.xml file

Below are my three xml file 1)web.xml 2)struts-config.xml 3)applicationContext.xml
1) Web.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"


<!-- <servlet>
<servlet- class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
</servlet> -->




<!-- Tag Library Descriptors -->







<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"

<struts-config sdsads>
<form-bean name="LoginForm" type="com.she.demo.form.LoginForm"/>

<forward name="success" path="/success.jsp"/>
<forward name="failure" path="/login.jsp" redirect="true"/>

<!-- M E S S A G E R E S O U R C E S -->

<!-- The "contextConfigLocation" property is the location of the Spring beans configuration file -->
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"


<?xml version="1.0" encoding="UTF-8"?>


<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName"><value></value></property>
<property name="url"><value>jdbc b2:AIS520</value></property>
<property name="username"><value>db2srv</value></property>
<!-- Make sure <value> tags are on same line - if they're not,
authentication will fail -->
<property name="password"><value>db2f0rM@n</value></property>

<!-- Hibernate SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
<property name="dataSource"><ref local="dataSource"/></property>
<property name="mappingResources">
<property name="hibernateProperties">
<prop key="hibernate.dialect">org.hibernate.dialect.DB2Dialect</prop>
<prop key="">create</prop>

<!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
<bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager">
<property name="sessionFactory"><ref local="sessionFactory"/></property>

<bean id="userDAO" class="com.she.demo.service.ServiceDAO">
<property name="sessionFactory"><ref local="sessionFactory"/></property>

<bean id="userManager" class="com.she.demo.service.impl.ServiceManagerImpl">
<property name="userDAO"><ref local="userDAO"/></property>

<bean id="userManager"
<property name="transactionManager"><ref local="transactionManager"/></property>
<property name="target"><ref local="userManagerTarget"/></property>
<property name="transactionAttributes">
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="remove*">PROPAGATION_REQUIRED</prop>
<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>

<!-- Tell the TrasactionProxyFacyoryBean the object on which to act i.e the target-->
<bean id="userManagerTarget"
<property name="userDAO"><ref local="userDAO"/></property>


Please all the wizard out there...provide me with the reason for this concern.

David O'Meara

Joined: Mar 06, 2001
Posts: 13459

You haven't specified where you're putting these files. Also, are you seeing any indication that the context is being loaded? This is the first step before recognising any of the files.
ved gunjan
Ranch Hand

Joined: May 17, 2003
Posts: 86
Thanks David for replying...

I'm putting these 3 files under WEB-INF folder of the project.
The context of the project is been loaded by the server.

Is this problem because of the version of different tools that im using.
Tomcat - 5.0.28
Sturts -1.2
Spring -1.2.4
hibernate 2

please suggest...

David O'Meara

Joined: Mar 06, 2001
Posts: 13459

All problems are likely to be in your web.xml then, since you're not seeing any errors. I'd still lokk at the various log files to make sure though. Comparing to a working set I have, mine looks like this:
subject: Problem regarding Struts+Spring+hibernate
It's not a secret anymore!