Topic
  • 6 replies
  • Latest Post - ‏2014-11-17T11:59:08Z by wcy
dacheung
dacheung
3 Posts

Pinned topic Configuring servlet between JSR289 and JSR116

‏2011-05-06T14:46:47Z |
Hi,

How do I know that my servlet will be deployed against JSR289 as opposed to JSR116? I understand that the JSR289 has new behaviors but the container can maintain backwards compatibility to support JSR116.
Updated on 2011-05-08T08:55:07Z at 2011-05-08T08:55:07Z by SystemAdmin
  • bpulito
    bpulito
    23 Posts

    Re: Configuring servlet between JSR289 and JSR116

    ‏2011-05-06T17:10:00Z  
    The way the container identifies an application as a JSR 289 is through the <app-name> tag in the sip.xml deployment descriptor:

    <app-name>xxxxxxx</app-name>

    If this is removed or not included, the SIP container will assume its working with a JSR 116 app. From my experience, the one thing you have to be careful of when converting a JSR 116 app to a JSR 289 application is the new Invalidate When Ready feature that is enabled with JSR 289. This can cause issues with converged applications if a SIP app session is invalidated by the SIP container before the HTTP side of the converged application has finished using it. Just something to watch out for.
  • cheungda
    cheungda
    20 Posts

    Re: Configuring servlet between JSR289 and JSR116

    ‏2011-05-06T17:58:00Z  
    • bpulito
    • ‏2011-05-06T17:10:00Z
    The way the container identifies an application as a JSR 289 is through the <app-name> tag in the sip.xml deployment descriptor:

    <app-name>xxxxxxx</app-name>

    If this is removed or not included, the SIP container will assume its working with a JSR 116 app. From my experience, the one thing you have to be careful of when converting a JSR 116 app to a JSR 289 application is the new Invalidate When Ready feature that is enabled with JSR 289. This can cause issues with converged applications if a SIP app session is invalidated by the SIP container before the HTTP side of the converged application has finished using it. Just something to watch out for.
    Hi Brian,

    This brings up a follow-up question. We have actually deployed our servlet with and without the app-name and observed two different behaviours when receiving 302 MOVED.

    When not using the app-name tag, i.e. JSR116, when we send INVITE and receive 302 MOVED in response, we create a new INVITE but re-using the same session. No issues sending the second INVITE.

    When using the app-name tag, i.e. JSR289, when we receive 302 MOVED and try to create a new INVITE on the session, we get an error that the session is already invalidated.

    Any ideas why the difference?

    Darryl
  • bpulito
    bpulito
    23 Posts

    Re: Configuring servlet between JSR289 and JSR116

    ‏2011-05-06T19:23:35Z  
    My guess is that you are getting bit by the automatic invalidation of the session. This is the invalidate when ready feature of JSR 289 that I mentioned previously. You can test this theory be disabling invalidate when ready. You can do this in the source of your application each time a SIP Application Session is created by calling the setInvalidateWhenReady(false) on the SipApplicationSession. This should prevent the container from automatically invalidating the session.
  • cheungda
    cheungda
    20 Posts

    Re: Configuring servlet between JSR289 and JSR116

    ‏2011-05-06T20:32:36Z  
    • bpulito
    • ‏2011-05-06T19:23:35Z
    My guess is that you are getting bit by the automatic invalidation of the session. This is the invalidate when ready feature of JSR 289 that I mentioned previously. You can test this theory be disabling invalidate when ready. You can do this in the source of your application each time a SIP Application Session is created by calling the setInvalidateWhenReady(false) on the SipApplicationSession. This should prevent the container from automatically invalidating the session.
    Thanks Brian, we'll try the setReadyToInvalidate(false)

    Back to the JSR289 vs JSR116, our sip.xml has the app-name tag, but we're seeing this exception when trying to deploy the servlet.

    com.ibm.ws.scripting.ScriptingException: org.apache.tools.ant.BuildException: /opt/IBM/WebSphere/AppServer/feature_packs/cea/sar2war_tool/build1.xml:236: /tmp/build/mysipservlet.sar/WEB-INF/sip.xml is not a valid XML document.

    We looked in this build1.xml line 236 and the target name of this XML blcok is validateSipDotXml116. Does this mean the container thinks it is a JSR116 servlet?

    Here's our sip.xml

    <?xml version="1.0"?>
    <sip-app>
    <app-name>com.test.MySipServlet</app-name>
    <display-name>My Sip Servlet</display-name>
    <servlet>
    <servlet-name>MySipServlet</servlet-name>
    <display-name>MySipServlet</display-name>
    <servlet-class>com.test.MySipServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>MySipServlet</servlet-name>
    <pattern>
    <or>
    <equal ignore-case="true">
    <var>request.method</var>
    <value>INVITE</value>
    </equal>
    <equal ignore-case="true">
    <var>request.method</var>
    <value>NOTIFY</value>
    </equal>
    <equal ignore-case="true">
    <var>request.method</var>
    <value>OPTIONS</value>
    </equal>
    </or>
    </pattern>
    </servlet-mapping>
    <!--Declare class that implements TimerListener interface-->
    <listener>
    <listener-class>com.test.MySipServlet</listener-class>
    </listener>
    </sip-app>
  • SystemAdmin
    SystemAdmin
    45 Posts

    Re: Configuring servlet between JSR289 and JSR116

    ‏2011-05-08T08:55:07Z  
    During deployment there is a schema validation against your sip.xml deployment descriptor to verify that this is JSR289 application, it looks like the schema validation failed.

    My guess is that the problem is that the root element tag does not include the correct namespace declarations.

    Here is an example of a correct JSR289 sip.xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <sip-app xmlns="http://www.jcp.org/xml/ns/sipservlet" xmlns:javaee="http://java.sun.com/xml/ns/javaee">
    <app-name>jsr289.app</app-name>
    </sip-app>
    Try to add the namespaces to the root element to see if this solves the problem.

    One other thing that you can do is to enable the sip container traces, using com.ibm.ws.sip.*=all traces string, deploy the application, and look for this string: "Failed to parse Sip.xml with jsr1.1 schema validation" this will help you to understand what is wrong with your sip.xml file.
  • wcy
    wcy
    1 Post

    Re: Configuring servlet between JSR289 and JSR116

    ‏2014-11-17T11:59:08Z  
    • cheungda
    • ‏2011-05-06T20:32:36Z
    Thanks Brian, we'll try the setReadyToInvalidate(false)

    Back to the JSR289 vs JSR116, our sip.xml has the app-name tag, but we're seeing this exception when trying to deploy the servlet.

    com.ibm.ws.scripting.ScriptingException: org.apache.tools.ant.BuildException: /opt/IBM/WebSphere/AppServer/feature_packs/cea/sar2war_tool/build1.xml:236: /tmp/build/mysipservlet.sar/WEB-INF/sip.xml is not a valid XML document.

    We looked in this build1.xml line 236 and the target name of this XML blcok is validateSipDotXml116. Does this mean the container thinks it is a JSR116 servlet?

    Here's our sip.xml

    <?xml version="1.0"?>
    <sip-app>
    <app-name>com.test.MySipServlet</app-name>
    <display-name>My Sip Servlet</display-name>
    <servlet>
    <servlet-name>MySipServlet</servlet-name>
    <display-name>MySipServlet</display-name>
    <servlet-class>com.test.MySipServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>MySipServlet</servlet-name>
    <pattern>
    <or>
    <equal ignore-case="true">
    <var>request.method</var>
    <value>INVITE</value>
    </equal>
    <equal ignore-case="true">
    <var>request.method</var>
    <value>NOTIFY</value>
    </equal>
    <equal ignore-case="true">
    <var>request.method</var>
    <value>OPTIONS</value>
    </equal>
    </or>
    </pattern>
    </servlet-mapping>
    <!--Declare class that implements TimerListener interface-->
    <listener>
    <listener-class>com.test.MySipServlet</listener-class>
    </listener>
    </sip-app>

    Hello,I am a java developer,I meet the same problem(sip.xml is not a valid XML document). If anyone can solve it,please tell me what can i do ,Thanks!

    Updated on 2014-11-17T12:00:08Z at 2014-11-17T12:00:08Z by wcy