8 Replies Latest reply on Apr 5, 2011 10:40 AM by futuredan

    run "cxf-osgi" but could not display wsdl

    y yz Newbie

      when i try cxf-osgi example(fuse esb version is apache-servicemix-4.2.0-fuse-01-00), i can call client successful. but when i call http://localhost:8181/cxf/HelloWorld?wsdl in browser, i could not see wsdl document, there is "HTTP ERROR 500" waring. the detail stack here, please tell me what's the matter and how can i do ? thanks very much.

       

       

       

      Problem accessing /cxf/HelloWorld. Reason:

       

          Provider org.apache.xalan.processor.TransformerFactoryImpl not found

       

      Caused by:

      javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found

           at javax.xml.transform.TransformerFactory.newInstance(TransformerFactory.java:109)

           at org.apache.cxf.helpers.XMLUtils.newTransformer(XMLUtils.java:119)

           at org.apache.cxf.wsdl11.SchemaSerializer.writeXml(SchemaSerializer.java:56)

           at org.apache.cxf.wsdl11.SchemaSerializer.marshall(SchemaSerializer.java:49)

           at com.ibm.wsdl.xml.WSDLWriterImpl.printExtensibilityElements(Unknown Source)

           at com.ibm.wsdl.xml.WSDLWriterImpl.printTypes(Unknown Source)

           at com.ibm.wsdl.xml.WSDLWriterImpl.printDefinition(Unknown Source)

           at com.ibm.wsdl.xml.WSDLWriterImpl.writeWSDL(Unknown Source)

           at com.ibm.wsdl.xml.WSDLWriterImpl.getDocument(Unknown Source)

           at org.apache.cxf.transport.http.WSDLQueryHandler.writeResponse(WSDLQueryHandler.java:180)

           at org.apache.cxf.transport.http_osgi.OsgiServletController.invoke(OsgiServletController.java:137)

           at org.apache.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:53)

           at org.apache.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)

           at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)

           at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)

           at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)

           at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)

           at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)

           at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)

           at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)

           at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)

           at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)

           at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)

           at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)

           at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

           at org.mortbay.jetty.Server.handle(Server.java:326)

           at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)

           at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)

           at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)

           at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)

           at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)

           at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)

           at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

        • 1. Re: run "cxf-osgi" but could not display wsdl
          futuredan Newbie

          I am having this same issue.

          Did you ever solve it?

          • 2. Re: run "cxf-osgi" but could not display wsdl
            Freeman(Yue) Fang Master

            Hi,

             

            You mean you can run the java code client correctly, but send client request from browser doesn't work, right?

             

            What's exact your FUSE ESB version?

            What's your browser? Is it chrome?

            If it's chrome then it's a known issue that chrome by default will add CORS headers to the out going request which isn't supported by cxf, could you try with another browser?

             

            Freeman

            • 3. Re: run "cxf-osgi" but could not display wsdl
              futuredan Newbie

              I assume a java code client would work, but I test it by using SoapUI (which I guess is probably a java code client).

              Accessing the web service itself works just fine.

               

              However, the client request from the browser for the WSDL fails.

              We also had an outside group that failed becuase the request for the WSDL failed.

               

              I believe I was able to work around the issue by placing the servicemix xalan-2.7.1_2.jar in the lib\endorsed folder, but this seems "wrong".

              Is there another way to get, I assume CXF, to find xalan?

              I tried adding an import to the camel context in which I define the jaxws:endpoint that creates the service for xalan and xalan.processor, but this didn't seem to help.

               

              I am using version 4.3.0-fuse-03-00 of FUSE.

               

              I typically use Firefox, but on one instance when I had it working using the above workaround I did use Chrome and noticed, as you did, that Chrome does not display the WSDL.

               

              Thank you for your prompt reply.

              • 4. Re: run "cxf-osgi" but could not display wsdl
                Freeman(Yue) Fang Master

                Hi,

                 

                What's your JDK version?

                 

                Could you use JDK 1.6 to see if it helps?

                 

                Freeman

                • 5. Re: run "cxf-osgi" but could not display wsdl
                  futuredan Newbie

                   

                  I am using jdk1.6.0_22

                   

                  The problem seems to occur when there is a conflict with another bundle.

                  That bundle has the following code:

                   

                    System.setProperty( "javax.xml.transform.TransformerFactory", "org.apache.xalan.processor.TransformerFactoryImpl" );

                    LOG.info( "Default XSLT processor " + System.getProperty( "javax.xml.transform.TransformerFactory" ) );

                    try

                    {

                     Class.forName( "org.apache.xalan.processor.TransformerFactoryImpl" );

                    }

                    catch( Throwable t )

                    {

                     LOG.error( "Error loading Xalan", t );

                     throw new Exception( t );

                    }

                   

                   

                  That code exists to prevent another cause of the same Transformer Exception.

                  I'm going to remove that code and see what happens.

                   

                   

                  • 6. Re: run "cxf-osgi" but could not display wsdl
                    futuredan Newbie

                    Setting the "javax.xml.transform.TransformerFactory" property is what's messing things up.

                    If the value returned for System.getProperty for this is null when the browser tries to access the WSDL, the WSDL is generated correctly and no Exception is thrown.

                    If the value is explicitly set to Xalan, an Exception is thrown that it can't find Xalan.

                    This seems a little odd because I'm pretty sure that Xalan is the default TransformerFactory.

                     

                    I was able to work around another piece of code that was accessing some 3rd party code that required the value to be explictly set to Xalan.

                    I only set it during the call to the 3rd party code and cleared the value after the call completed so further calls would return null.

                     

                    In my brief test, it appears that things are working.

                     

                    • 7. Re: run "cxf-osgi" but could not display wsdl
                      Freeman(Yue) Fang Master

                      Hi,

                       

                      No, the default TransformerFactory isn't from xalan, it's com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl from jdk.

                      More exactly, it's from the FUSE_ESB/lib/endorsed/jaxp-ri-1.4.4.jar

                      This can explain why you

                      System.setProperty( "javax.xml.transform.TransformerFactory", "org.apache.xalan.processor.TransformerFactoryImpl" );

                      doesn't work for cxf-osgi example, cxf-osgi example bundle doesn't import org.apache.xalan.processor package at all, if you adapt cxf-osgi example bundle to also import org.apache.xalan.processor package, then it should work.

                       

                      Btw, you should always be careful to set such Factory property in your customer bundle, as OSGi container is in one JVM thing, so any system property you set in your customer bundles will affect other bundles in same OSGi container.

                       

                      Freeman

                      • 8. Re: run "cxf-osgi" but could not display wsdl
                        futuredan Newbie

                        Thank you very much for this information.

                        I'm not sure why I thought Xalan was the default.

                        I was going to create a little example so I could see what the default Transformer was, but you have saved me the trouble.  Thanks very much.

                         

                        I will definitely be more careful with System.setProperty in the future.

                        Fool me once, shame on you.  Fool me twice, shame on me.

                         

                        Edited by: futuredan on Apr 5, 2011 10:40 AM