Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-198

SaajUtils wrong way to detect SAAJ version

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.0
    • Fix Version/s: 1.0.2
    • Component/s: Core
    • Labels:
      None
    • Environment:
      Weblogic 9

      Description

      WL9 only supports J2EE1.4 (SAAJ1.2) but somehow has a SAAJ1.3 class javax.xml.soap.SAAJMetaFactory. we checked the application WEB-INF/lib does not have any saaj-api.jar, we checked other jars free of a similarly named class.
      Now SaajUtils.java in spring-ws uses Class.forName to load that class to decide that the SAAJ version is 1.3 but at runtime you get the NoSuchMethod trying to instantiate the MessageFactory with the new 1.3 newInstance() which takes a string url instead of the 1.2 newInstance() which does not take any arguments.
      I logged a bug because this is a bad way to detect the version and WL9 proves this point. maybe you can add a property to tell SaajUtils which version of SAAJ or fall back on the NoSuchMethod Exception instead of ClassNotFound if that is the only difference from spring perspective. several people are hitting this issue and are forced to hack around it but the real resolution should be in code. Hope this makes since.

        Activity

        Hide
        ielian Iyad Elian added a comment -

        you are right. I was wrong.
        we must've had a saaj-api-1.3.jar somewhere (I am not sure where) but I can't reproduce the problem after I cleaned the pom like this

        <dependency>
        <groupId>javax.xml.soap</groupId>
        <artifactId>saaj-api</artifactId>
        <version>1.3</version>
        <scope>provided</scope>
        </dependency>
        <dependency>
        <groupId>com.sun.xml.messaging.saaj</groupId>
        <artifactId>saaj-impl</artifactId>
        <version>1.3</version>
        </dependency>

        I need sun's saaj-impl for the client.

        Show
        ielian Iyad Elian added a comment - you are right. I was wrong. we must've had a saaj-api-1.3.jar somewhere (I am not sure where) but I can't reproduce the problem after I cleaned the pom like this <dependency> <groupId>javax.xml.soap</groupId> <artifactId>saaj-api</artifactId> <version>1.3</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.sun.xml.messaging.saaj</groupId> <artifactId>saaj-impl</artifactId> <version>1.3</version> </dependency> I need sun's saaj-impl for the client.
        Hide
        ielian Iyad Elian added a comment -

        This is what I see with WL1001 and WL922
        WL1001
        2007-10-30 15:45:29,420 INFO [org.springframework.ws.soap.saaj.SaajSoapMessageFa
        ctory] - Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol

        WL922
        2007-10-30 15:51:25,815 INFO [org.springframework.ws.soap.saaj.SaajSoapMessageFa
        ctory] - Creating SAAJ 1.1 MessageFactory

        Client (I am using sun's saaj-impl-1.3 for both WL1001 and WL922)
        2007-10-30 15:51:25,237 INFO [org.springframework.ws.soap.saaj.SaajSoapMessageFactory] - Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol

        is this correct? shouldn't I see SAAJ1.2 on WL922

        Show
        ielian Iyad Elian added a comment - This is what I see with WL1001 and WL922 WL1001 2007-10-30 15:45:29,420 INFO [org.springframework.ws.soap.saaj.SaajSoapMessageFa ctory] - Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol WL922 2007-10-30 15:51:25,815 INFO [org.springframework.ws.soap.saaj.SaajSoapMessageFa ctory] - Creating SAAJ 1.1 MessageFactory Client (I am using sun's saaj-impl-1.3 for both WL1001 and WL922) 2007-10-30 15:51:25,237 INFO [org.springframework.ws.soap.saaj.SaajSoapMessageFactory] - Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol is this correct? shouldn't I see SAAJ1.2 on WL922
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        Well, WebLogic 9.2 does say they implement SAAJ 1.2, because it's part of J2EE 1.4. But when you call a SAAJ 1.2 method, you actually end up with an UnsuportedOperationException.

        That's why there is this method in the SaajUtils, detecting if we are dealing with the (broken) WL 92 implementation: http://static.springframework.org/spring-ws/site/xref/org/springframework/ws/soap/saaj/support/SaajUtils.html#94

        Show
        arjen.poutsma Arjen Poutsma added a comment - Well, WebLogic 9.2 does say they implement SAAJ 1.2, because it's part of J2EE 1.4. But when you call a SAAJ 1.2 method, you actually end up with an UnsuportedOperationException. That's why there is this method in the SaajUtils, detecting if we are dealing with the (broken) WL 92 implementation: http://static.springframework.org/spring-ws/site/xref/org/springframework/ws/soap/saaj/support/SaajUtils.html#94
        Hide
        ielian Iyad Elian added a comment -

        I see. I tested by providing my own SaajUtils that forces saaj version to 1.2
        2007-10-31 10:17:03,400 INFO [org.springframework.ws.soap.saaj.SaajSoapMessageFa
        ctory] - Creating SAAJ 1.2 MessageFactory
        but as you noted, I get the UnsupportedOperationException
        java.lang.UnsupportedOperationException: This class does not support SAAJ 1.1
        at weblogic.webservice.core.soap.SOAPElementImpl.getNodeType(SOAPElement
        Impl.java:414)
        at org.springframework.ws.server.endpoint.support.PayloadRootUtils.getPa
        yloadRootQName(PayloadRootUtils.java:59)
        at org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpoi

        Thanks.

        Show
        ielian Iyad Elian added a comment - I see. I tested by providing my own SaajUtils that forces saaj version to 1.2 2007-10-31 10:17:03,400 INFO [org.springframework.ws.soap.saaj.SaajSoapMessageFa ctory] - Creating SAAJ 1.2 MessageFactory but as you noted, I get the UnsupportedOperationException java.lang.UnsupportedOperationException: This class does not support SAAJ 1.1 at weblogic.webservice.core.soap.SOAPElementImpl.getNodeType(SOAPElement Impl.java:414) at org.springframework.ws.server.endpoint.support.PayloadRootUtils.getPa yloadRootQName(PayloadRootUtils.java:59) at org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpoi Thanks.
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        Closing 1.0.2 issues.

        Show
        arjen.poutsma Arjen Poutsma added a comment - Closing 1.0.2 issues.

          People

          • Assignee:
            arjen.poutsma Arjen Poutsma
            Reporter:
            ielian Iyad Elian
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: