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 :
@WebService
public class GAREE {
private GareeDAO gareeDAO;
public void setGareeDAO(GareeDAO gareeDAO) {
this.gareeDAO = gareeDAO;
}
public GareeDAO getGareeDAO() {
return this.gareeDAO;
}
...
@WebMethod
public void waiveStrike(String incidentTicketNum) {
getGareeDAO().waiveStrikeForIncidentTicketNumber(incidentTicketNum);
} // End waiveStrike()
The web.xml contains the entries :
<context-param>
<param-name>contextConfigLocation</param-name>
<!--
<param-value>WEB-INF/dataAccessContext.xml, WEB-INF/applicationContext.xml</param-value>
-->
<param-value>WEB-INF/dataAccessContext.xml, WEB-INF/applicationContext.xml</param-value>
</context-param>
<servlet>
<servlet-name>contextLoaderServlet</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>10</load-on-startup>
</servlet> The applicationContext.xml contains :
<bean id="garee" class="com.company.project.webservice.GAREE">
<property name="gareeDAO">
<ref bean="gareeDAO"/>
</property>
</bean> 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>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
</bean>
...
<bean id="gareeDAO" class="com.company.project.dao.GareeDAOImpl">
<property name="jdbcTemplate">
<ref bean="jdbcTemplate"/>
</property>
</bean> 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 ]