Announcement Announcement Module
Collapse
No announcement yet.
ServletEndpointSupport no container callbacks Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ServletEndpointSupport no container callbacks

    I am implementing an axis ws implementation in tomcat 6. I am attempting to gain access to the spring context using ServletEndpointSupport. This is something i have done successfully in several other containers, but as i step through the service interface the container callbacks to init are not happening. As a result, I am never able to inject the neccessarry business interfaces and always throw a null pointer exception when attempting to use them. Is there something i am missing about deployment in this container?
    Below are my context config files as well as the webapp deployment descriptor.

    cheers,

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

    <!--
    - JCDC application context. Please follow patterns for injection patterns.
    -->
    <beans>

    <!-- JNDI reference -->
    <bean id="jcdcDataSource"
    class="org.springframework.jndi.JndiObjectFactoryB ean">
    <property name="jndiName" value="java:comp/env/jdbc/SaasDB" />
    </bean>
    <!-- Session Factory -->
    <bean id="jcdcSessionFactory"
    class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
    <property name="dataSource" ref="jcdcDataSource" />
    <property name="mappingResources">
    <list>
    <!-- I dont like this but spring isn't playing fair -->
    <!-- <value>hibernate.cfg.xml</value>-->
    <value>org\dol\jobcorps\axis\dao\beans\W2Address.h bm.xml</value>
    <value>org\dol\jobcorps\axis\dao\beans\Student.hbm .xml</value>
    </list>
    </property>
    <property name="hibernateProperties">
    <value>
    hibernate.dialect=org.hibernate.dialect.XXXXXX
    </value>
    </property>
    </bean>
    <!-- Transaction Manager -->
    <bean id="txManager"
    class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
    <property name="sessionFactory" ref="jcdcSessionFactory" />
    </bean>
    <!-- Transaction Proxy -->
    <!-- base transaction proxy for which medrec spring beans inherit-->
    <bean id="baseTransactionProxy"
    class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean"
    abstract="true">
    <property name="transactionManager" ref="txManager" />
    <property name="transactionAttributes">
    <props>
    <prop key="save*">PROPAGATION_REQUIRED</prop>
    <prop key="update*">PROPAGATION_REQUIRED</prop>
    <prop key="*">PROPAGATION_REQUIRED</prop>
    </props>
    </property>
    </bean>

    <!-- DAO and BO implementations -->

    <!-- Student DAO -->
    <bean id="XXDao"
    class="org.dol.jobcorps.axis.dao.StudentDao">
    <property name="sessionFactory" ref="jcdcSessionFactory" />
    </bean>
    <!-- XXAddress Dao -->
    <bean id="XXAddressDao"
    class="org.dol.jobcorps.axis.dao.XXAddressDao">
    <property name="sessionFactory" ref="jcdcSessionFactory" />
    </bean>
    <!-- XX BO -->
    <bean id="XXBusiness" parent="baseTransactionProxy"
    autowire="byName">
    <property name="target">
    <bean class="org.dol.jobcorps.axis.business.XXBo">
    <property name="XXDao" ref="studentDao" />
    </bean>
    </property>
    </bean>

    <!-- MailSender implementation for JavaMail -->
    <!-- <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailS enderImpl">
    <property name="host" value="${mail.host}"/>
    </bean>-->

    </beans>
    /**********************web.xml********************* ************/
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>TestSaas</display-name>
    <!-- JNDI reference for this project -->
    <resource-ref>
    <description>SAASDatabase</description>
    <res-ref-name>jdbc/SaasDB</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
    /WEB-INF/jcdc-app.xml /WEB-INF/jcdc-app-servlet.xml
    </param-value>
    <!--
    <param-value>
    /WEB-INF/applicationContext.xml /WEB-INF/schedulingContext-timer.xml
    </param-value>
    -->
    </context-param>
    <!-- Spring and Axis context loader -->
    <listener>
    <listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>
    </listener>
    <!-- <listener>
    <listener-class>org.apache.axis.transport.http.AxisHTTPSessi onListener</listener-class>
    </listener>-->
    <listener>
    <listener-class>org.springframework.web.util.Log4jConfigList ener</listener-class>
    </listener>

    <!-- Some but not all of the below will be required -->

    <servlet>
    <display-name>
    Apache-Axis Servlet</display-name>
    <servlet-name>AxisServlet</servlet-name>
    <servlet-class>
    org.apache.axis.transport.http.AxisServlet</servlet-class>
    <load-on-startup>100</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>AxisServlet</servlet-name>
    <url-pattern>/servlet/AxisServlet</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>AxisServlet</servlet-name>
    <url-pattern>*.jws</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>AxisServlet</servlet-name>
    <url-pattern>/services/*</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    </web-app>

  • #2
    Please use [ code][/code ] tags when posting code, that way we can decipher what you posted...

    Comment


    • #3
      touche

      Originally posted by mdeinum View Post
      Please use [ code][/code ] tags when posting code, that way we can decipher what you posted...
      sorry about that...its my first time posting in this forum...as i have been able to solve all of my previous problems myself. will do in the future.

      cheers,

      mike

      Comment


      • #4
        Problem Solved

        All in the spring community. While I am sure you will be laughing at me, oddly enough nothing new to me in software. I thought I would post the solution to the/my issue.

        The cruxt of the issue is whether or not the implementation class listed in the wsdd is a skeleton or implementation class. While obfuscating the implementation with a skeleton interface, and allowing that to make a call to the implementation (which works quite nicely in axis 1.x), this never allows the spring context loader to be aware that the jax-rpc implementation is extending ServletEndpointSupport. As a result, the container callbacks never occurr, and the implementation class never gets reference to the spring context.

        So, always deploy your service with the concrete implementation if you hope to get reference back to the spring context. For alot of us, probably not the first thing that came to mind.

        Anyway, thought this might help some struggling idiot like myself (what just drove me nuts about this as I have deployed this stack in 4 other containers without a hitch).

        Cheers ---> Mike

        Comment

        Working...
        X