• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Unique issue with Spring-WebServices-JDBC

Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Friends,

I have been working with Spring for couple of years now, but this is the first time I am trying to incorporate WS with Spring (on Win-XP, BEA Weblogic 10.0-Workshop, MySQL environment). I am encountering an unique issue with Spring. Here are the details of the issue -

I have have a WebService class defined as :
public class GAREE {
private GareeDAO gareeDAO;

public void setGareeDAO(GareeDAO gareeDAO) {
this.gareeDAO = gareeDAO;

public GareeDAO getGareeDAO() {
return this.gareeDAO;
public void waiveStrike(String incidentTicketNum) {

} // End waiveStrike()

The web.xml contains the entries :

<param-value>WEB-INF/dataAccessContext.xml, WEB-INF/applicationContext.xml</param-value>
<param-value>WEB-INF/dataAccessContext.xml, WEB-INF/applicationContext.xml</param-value>

The applicationContext.xml contains :
<bean id="garee" class="com.company.project.webservice.GAREE">
<property name="gareeDAO">
<ref bean="gareeDAO"/>

and the dataAccessContext.xml contains :
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${database.garee.jdbc.class}"/>
<property name="url" value="${database.garee.url}"/>
<property name="username" value="${database.garee.username}"/>
<property name="password" value="${database.garee.password}"/>

<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource">
<ref bean="dataSource"/>
<bean id="gareeDAO" class="com.company.project.dao.GareeDAOImpl">
<property name="jdbcTemplate">
<ref bean="jdbcTemplate"/>

The problem statement of the issue is that -

When i am running the WebService client and hitting the GAREE webservice, the waiveStrike method always gets the gareeDAO instance as NULL. If I try to call the same method, from the setter, it of course gets the gareeDAO instance and a successful database hit is made at time of app initialization by Spring. So, JDBCTemplate and the DAO are working properly. Only the WebServices class' methods for some reason do NOT seem to get the DAO instance object !!!
I understand that I can use Spring-WS for this, but we have go ahead with BEA Workshop based WebServices only. The Spring is another requirement with a stand-alone application that we are having along with the WS module (the above one which has issues).

Any ideas why this might be happening? Do let me know if you need more information. Thanks in advance.
[ November 04, 2008: Message edited by: Shailesh Welankar ]
Shailesh Welankar
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

This issue is resolved!! I made the DAO instance variable to be static in the WebServices class declaration and accordingly removed the "this." call and set and retrieved it as a static variable rather than an instance variable. Should not have been an issue, may be the way Weblogic instantiates the WebService class, made the object to lose value once it was running on the server (mine is of course a web application). Making it static made it to retain the value throughout (build time as well as run time) on the Server.
    Bookmark Topic Watch Topic
  • New Topic