Announcement Announcement Module
Collapse
No announcement yet.
Spring Web Services 1.5.1 requires Java 5 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Web Services 1.5.1 requires Java 5

    Hi Spring Forum
    I currently am working in a project where we are trying to use Spring Web Services 1.5.1. Our production environment is running Java 1.4.2 on an Oracle OC4J application server 10.1.2. (we cannot yet upgrade to newer Java and Oracle versions due to company polices etc).

    I managed to deploy my webservice application but as soon as it received a webservice call I got the following error.

    java.lang.NoSuchMethodError: java.util.Collections.emptyList()Ljava/util/List;
    at com.sun.xml.messaging.saaj.soap.MessageImpl.<clini t>(MessageImpl.java:755)
    at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessage Factory1_1Impl.createMessage(SOAPMessageFactory1_1 Impl.java:62)
    at org.springframework.ws.soap.saaj.SaajSoapMessageFa ctory.createWebServiceMessage(SaajSoapMessageFacto ry.java:164)
    at org.springframework.ws.transport.AbstractWebServic eConnection.receive(AbstractWebServiceConnection.j ava:86)
    at org.springframework.ws.transport.support.WebServic eMessageReceiverObjectSupport.handleConnection(Web ServiceMessageReceiverObjectSupport.java:86)


    I tracked down the error to the following jar-file: saaj-impl-1.3.jar. Using a Java decompiler I found the following lines of code.

    }
    catch (SecurityException ex)
    {
    }

    nullIter = Collections.emptyList().iterator();
    }

    The Collections.emptyList() is a Java 5 specific call. I downloaded this jar-file with the Spring Web services 1.5.1 with dependencies.

    In the Spring Web Services documentation it states "Spring Web Services runs within a standard Java 1.3 Runtime Environment".

    I tried to replace this jar file with an earlier version. In the end I had to replace a number of jar files. However eventually I got a Java null pointer exception and I gave up.

    It doesn't seem that Spring Webservices 1.5.1 only requires Java 1.3 as specified in the documentation.

  • #2
    SAAJ 1.3 should be compatible with Java 1.4 according to their website https://saaj.dev.java.net/

    Probably try to download their saaj-impl.jar.

    Spring works with saaj 1.1, 1.2 and 1.3.
    Probably your application server already ships with an implementation.

    If this does not work, you can try to use the AxiomSoapMessageFactory instead of the SaajSoapMessageFactory.
    See Spring WS Reference Documentation.

    Comment


    • #3
      You sholdn't use saaj 1.3, look here static.springframework.org/spring-ws/sites/1.5/faq.html#java-1.4

      I have the exactly same problem, and I was trying to find saaj 1.2 - it was very difficult.. Eventually, I found axis-saaj-1.2.jar (findjar.com), (with some additional dependent libs), removed saaj 1.3 library, - and it working now.

      Im hoping, my decision will help somebody
      Last edited by polina; Oct 23rd, 2008, 06:05 AM.

      Comment


      • #4
        Hi Polina
        Thank you for your reply. I replaced my saaj-impl-1.3.jar with saaj 1.2. Once I restarted my application I got the following error.

        java.lang.NoClassDefFoundError: com/sun/org/apache/xerces/internal/dom/DocumentImpl
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java :539)
        at java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:123)


        I resolved this issue by including the following jar file: xercesImpl-1.5.jar

        Restarting my application gave me another class not found exception.

        java.lang.NoClassDefFoundError: com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl
        at com.sun.xml.messaging.saaj.soap.EnvelopeFactory.cr eateEnvelope(EnvelopeFactory.java:133)
        at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1 Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java :102)


        I resolved this issue by including the following jar file: jaxb-xalan-1.5.jar

        This time I managed to restart my application successfully. In our development environment we are using Tomcat (Pluto) and the application works perfectly. However when I deploy my application to the OC4J server we use in production my application throws a null pointer exception as soon it receives it first webservice call.

        2008-11-04 11:11:29,951 DEBUG [org.springframework.ws.soap.server.SoapMessageDisp atcher] - <Endpoint invocation resulted in exception - responding with Fault>
        java.lang.NullPointerException
        at za.co.telkom.portal.eai.simulator.ws.endpoint.TSAM essageEndpoint.invokeInternal(TSAMessageEndpoint.j ava:35)
        at org.springframework.ws.server.endpoint.AbstractDom PayloadEndpoint.invoke(AbstractDomPayloadEndpoint. java:75)
        at org.springframework.ws.server.endpoint.adapter.Pay loadEndpointAdapter.invoke(PayloadEndpointAdapter. java:48)
        at org.springframework.ws.server.MessageDispatcher.di spatch(MessageDispatcher.java:221)
        at org.springframework.ws.server.MessageDispatcher.re ceive(MessageDispatcher.java:168)
        at org.springframework.ws.transport.support.WebServic eMessageReceiverObjectSupport.handleConnection(Web ServiceMessageReceiverObjectSupport.java:88)
        at org.springframework.ws.transport.http.WebServiceMe ssageReceiverHandlerAdapter.handle(WebServiceMessa geReceiverHandlerAdapter.java:57)
        at org.springframework.ws.transport.http.MessageDispa tcherServlet.doService(MessageDispatcherServlet.ja va:197)
        at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:476)
        at org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:441)
        at javax.servlet.http.HttpServlet.service(HttpServlet .java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
        at com.evermind.server.http.ServletRequestDispatcher. invoke(ServletRequestDispatcher.java:824)
        at com.evermind.server.http.ServletRequestDispatcher. forwardInternal(ServletRequestDispatcher.java:330)
        at com.evermind.server.http.HttpRequestHandler.proces sRequest(HttpRequestHandler.java:830)
        at com.evermind.server.http.HttpRequestHandler.run(Ht tpRequestHandler.java:285)
        at com.evermind.server.http.HttpRequestHandler.run(Ht tpRequestHandler.java:126)
        at com.evermind.util.ReleasableResourcePooledExecutor $MyWorker.run(ReleasableResourcePooledExecutor.jav a:186)
        at java.lang.Thread.run(Thread.java:534)
        2008-11-04 11:11:29,966 DEBUG [org.springframework.ws.server.MessageTracing.sent] - <Sent response [SaajSoapMessage {}Fault] for request [SaajSoapMessage {}clientRequest]>



        Note the line for request [SaajSoapMessage {}clientRequest] in the logs above. It almost looks like that the application fails to parse the incoming message believing it received an empty message. The strange thing is that the application works perfectly on Tomcat but not on OC4J. It behaves differently on different application servers.

        I think I will log this as a separate thread as I believe we are talking about two different problems here. The Java 5 - saaj 1.3 issue originally discussed in this thread has been resolved. This is an issue regarding Spring WS not working properly on the OC4J application server.

        Comment


        • #5
          well, I dont know anything about it.. but, maybe... when I was searching for saaj1.2, and all dependant libs (findjar.com) - there are always variants (implementations) of these libs specially are made by oracle.. or something so. Maybe you should try to use them.

          By the way, these libs are successfully deployed under not only tomcat, but also websphere

          didnt find your new thread,so im replying here, sorry

          Comment


          • #6
            I was finally able to make it work. There is an issue regarding using Spring Webservices on an OC4J application server.

            This has already been addressed in the thread "Java 1.4 and Spring-ws on OC4J 9."

            For the JRE used by the OC4J container I created the following directory
            jre/lib/endorsed. I placed the following jar-files in this directory

            dom4j-1.5.jar
            jaxen-1.1.1.jar
            xalan-2.7.0.jar
            xercesImpl-2.8.1.jar
            xml-apis-1.3.03.jar

            I then bounced the OC4J instance. After that the application was able to parse the incoming webservice messages correctly!

            Comment

            Working...
            X