• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem regarding Struts+Spring+hibernate

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>

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

<!-- <servlet>
<servlet-name>SpringContextServlet</servlet-name>
<servlet- class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet> -->

<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>

<!-- Tag Library Descriptors -->
<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/WEB-INF/struts-nested.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/WEB-INF/struts-template.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-template.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>

</web-app>

2)struts-config.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://struts.apache.org/dtds/struts-config_1_2.dtd">

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


<action-mappings>
<action
path="/login"
type="org.springframework.web.struts.DelegatingActionProxy"
scope="session"
name="LoginForm"
input="/login.jsp"
validate="true">
<forward name="success" path="/success.jsp"/>
<forward name="failure" path="/login.jsp" redirect="true"/>
</action>
</action-mappings>

<!-- M E S S A G E R E S O U R C E S -->
<message-resources
parameter="com.she.demo.resources.ApplicationResources"/>

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


</struts-config>

3)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">

<beans>

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName"><value>COM.ibm.db2.jdbc.app.DB2Driverr</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>
</bean>

<!-- Hibernate SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
<property name="dataSource"><ref local="dataSource"/></property>
<property name="mappingResources">
<list>
<value>com/she/demo/businessobjects/LoginBO.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.DB2Dialect</prop>
<prop key="hibernate.hbm2ddl.auto">create</prop>
</props>
</property>
</bean>

<!-- 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>

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

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

<bean id="userManager"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager"><ref local="transactionManager"/></property>
<property name="target"><ref local="userManagerTarget"/></property>
<property name="transactionAttributes">
<props>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="remove*">PROPAGATION_REQUIRED</prop>
<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>

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


</beans>


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

Regards
Ved
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...

regards
ved
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:
 
reply
    Bookmark Topic Watch Topic
  • New Topic