You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by adupre <an...@gmail.com> on 2007/09/26 22:44:01 UTC

CXF and grails...

Here's the error I get while loading Spring... anyone have any idea what I am
doing wrong? Thx

2007-09-26 11:42:22.440::WARN:  Failed startup of context
org.mortbay.jetty.webapp.WebAppContext@3525a2{/pegasus,c:\projects\pegasus/web-app}
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'org.apache.cxf.wsdl.WSDLManager' defined in class path resource
[META-INF/cxf/cxf.xml]: Inst
antiation of bean failed; nested exception is
org.springframework.beans.BeanInstantiationException: Could not instantiate
bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constr
uctor threw exception; nested exception is java.lang.ClassCastException:
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to
javax.xml.parsers.DocumentBuilderFactor
y       at
groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:531)N(ScriptBytecodeAdapter.java:159)
Caused by: org.springframework.beans.BeanInstantiationException: Could not
instantiate bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor
threw exception; nested excep
tion is java.lang.ClassCastException:
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to
javax.xml.parsers.DocumentBuilderFactory
Caused by: java.lang.ClassCastException:
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to
javax.xml.parsers.DocumentBuilderFactory
        at
javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:123)deAdapter.java:67)
        at
java.util.XMLUtils.getLoadingDoc(XMLUtils.java:75)odInvoke(MetaClassHelper.java:678)
        at java.util.XMLUtils.load(XMLUtils.java:57)ke0(Native
Method)89)oke(ReflectionMetaMethod.java:58)
-- 
View this message in context: http://www.nabble.com/CXF-and-grails...-tf4524774.html#a12909451
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF and grails...

Posted by adupre <an...@gmail.com>.
This problem has to do with mismatched classloaders. As you can see in the
traces, all required classes were loaded.


Willem2 wrote:
> 
> Hi
> 
> It looks like
> 
> org.apache.xerces.jaxp.DocumentBuilderFactoryImpl is not match with
> javax.xml.parsers.DocumentBuilderFactory in when WSDLManager is creating.
> 
> CXF uses xercesImpl-2.8.1.jar ,you may check it against your Web
> container's runtime's class path. Maybe drop this jar in your war's
> WEB-INF\lib directory will help you out :)
> 
> Willem.
> 
> adupre wrote:
>> Here's the error I get while loading Spring... anyone have any idea what
>> I am
>> doing wrong? Thx
>>
>> 2007-09-26 11:42:22.440::WARN:  Failed startup of context
>> org.mortbay.jetty.webapp.WebAppContext@3525a2{/pegasus,c:\projects\pegasus/web-app}
>> org.springframework.beans.factory.BeanCreationException: Error creating
>> bean
>> with name 'org.apache.cxf.wsdl.WSDLManager' defined in class path
>> resource
>> [META-INF/cxf/cxf.xml]: Inst
>> antiation of bean failed; nested exception is
>> org.springframework.beans.BeanInstantiationException: Could not
>> instantiate
>> bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constr
>> uctor threw exception; nested exception is java.lang.ClassCastException:
>> org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to
>> javax.xml.parsers.DocumentBuilderFactor
>> y       at
>> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:531)N(ScriptBytecodeAdapter.java:159)
>> Caused by: org.springframework.beans.BeanInstantiationException: Could
>> not
>> instantiate bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]:
>> Constructor
>> threw exception; nested excep
>> tion is java.lang.ClassCastException:
>> org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to
>> javax.xml.parsers.DocumentBuilderFactory
>> Caused by: java.lang.ClassCastException:
>> org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to
>> javax.xml.parsers.DocumentBuilderFactory
>>         at
>> javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:123)deAdapter.java:67)
>>         at
>> java.util.XMLUtils.getLoadingDoc(XMLUtils.java:75)odInvoke(MetaClassHelper.java:678)
>>         at java.util.XMLUtils.load(XMLUtils.java:57)ke0(Native
>> Method)89)oke(ReflectionMetaMethod.java:58)
>>   
> 
> 

-- 
View this message in context: http://www.nabble.com/CXF-and-grails...-tf4524774.html#a12988526
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF and grails...

Posted by Willem Jiang <ni...@iona.com>.
Hi

It looks like

org.apache.xerces.jaxp.DocumentBuilderFactoryImpl is not match with javax.xml.parsers.DocumentBuilderFactory in when WSDLManager is creating.

CXF uses xercesImpl-2.8.1.jar ,you may check it against your Web container's runtime's class path. Maybe drop this jar in your war's WEB-INF\lib directory will help you out :)

Willem.

adupre wrote:
> Here's the error I get while loading Spring... anyone have any idea what I am
> doing wrong? Thx
>
> 2007-09-26 11:42:22.440::WARN:  Failed startup of context
> org.mortbay.jetty.webapp.WebAppContext@3525a2{/pegasus,c:\projects\pegasus/web-app}
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'org.apache.cxf.wsdl.WSDLManager' defined in class path resource
> [META-INF/cxf/cxf.xml]: Inst
> antiation of bean failed; nested exception is
> org.springframework.beans.BeanInstantiationException: Could not instantiate
> bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constr
> uctor threw exception; nested exception is java.lang.ClassCastException:
> org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to
> javax.xml.parsers.DocumentBuilderFactor
> y       at
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:531)N(ScriptBytecodeAdapter.java:159)
> Caused by: org.springframework.beans.BeanInstantiationException: Could not
> instantiate bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor
> threw exception; nested excep
> tion is java.lang.ClassCastException:
> org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to
> javax.xml.parsers.DocumentBuilderFactory
> Caused by: java.lang.ClassCastException:
> org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to
> javax.xml.parsers.DocumentBuilderFactory
>         at
> javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:123)deAdapter.java:67)
>         at
> java.util.XMLUtils.getLoadingDoc(XMLUtils.java:75)odInvoke(MetaClassHelper.java:678)
>         at java.util.XMLUtils.load(XMLUtils.java:57)ke0(Native
> Method)89)oke(ReflectionMetaMethod.java:58)
>   

Re: CXF and grails...

Posted by tog <gu...@gmail.com>.
Hi Anthony

Actually I found that removing  xerces-2.6.2.jar  & xml-apis.jar from
your $GRAILS_HOME/lib directory solves your problem. This is a problem
we have had some time ago while playing with cxf in groovy.
>From that time, these jars + xalan have been removed from the groovy
distribution. I cannot tell if there are mandatory for Grails.
Apparently using java5, my small controller can use groovyws without
any problem without them ;-)

import groovyx.net.ws.WSClient

class WebServiceController {

    def convert = {
           def proxy = new
WSClient("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL",
this.class.classLoader)
           def value = proxy.ConversionRate("EUR", "SGD")

           render "One euro is ${value} Sing dollar"
    }
}


Guillaume



On 10/2/07, tog <gu...@gmail.com> wrote:
> Bonjour Anthony
>
> I guess I have reproduced somehow your environment. I may hae put more
> jars into my lib directory (actually I put all the jars required for
> groovyws)
> But grails is starting fine.
>
> What I am not sure is the environment, could you tell me which are
> your conf  files exactly ? Do you have only this WEB-INF/resource.xml
> ?
>
>
>
> On 9/27/07, adupre <an...@gmail.com> wrote:
> >
> > This error comes from trying to setup a server.
> > I was able to narrow down the problem to the following steps:
> > - new grails app
> > - drop the cxf-**.jar into the lib directory (in my case
> > cxf-2.0.2-incubator.jar)
> > - drop the XmlSchema-1.2.jar (required early in by CXF)
> > - change the resource.xml to (notice that almost all is commented. The
> > <import/> is enough to create the error):
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <beans xmlns="http://www.springframework.org/schema/beans"
> >        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >        xmlns:jaxws="http://cxf.apache.org/jaxws"
> >        xsi:schemaLocation="
> > http://www.springframework.org/schema/beans
> > http://www.springframework.org/schema/beans/spring-beans.xsd
> > http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
> >
> >    <import resource="classpath:META-INF/cxf/cxf.xml" />
> >    <!-- import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> >    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" / -->
> >
> >    <!-- jaxws:endpoint
> >      id="processWS"
> >      implementor="com.nen.pegasus.ws.ProcessMgmtWService"
> >      address="/services/processWS" /-->
> >
> > </beans>
> >
> > Whenever I run the grails app, I get the error I reported.
> >
> >
> > Now, I also tried to use GroovyWS in my grails app with no success (as a
> > client) while I had no problem with a straight groovy app.
> > My guess is that the problem is related to classloading, but I'm completely
> > stuck at this point...
> >
> >
> > --
> > View this message in context: http://www.nabble.com/CXF-and-grails...-tf4524774.html#a12924445
> > Sent from the cxf-user mailing list archive at Nabble.com.
> >
> >
>
>
> --
>
> Best Regards
> Guillaume
> http://cheztog.blogspot.com
>


-- 

Best Regards
Guillaume
http://cheztog.blogspot.com

Re: CXF and grails...

Posted by tog <gu...@gmail.com>.
Bonjour Anthony

I guess I have reproduced somehow your environment. I may hae put more
jars into my lib directory (actually I put all the jars required for
groovyws)
But grails is starting fine.

What I am not sure is the environment, could you tell me which are
your conf  files exactly ? Do you have only this WEB-INF/resource.xml
?



On 9/27/07, adupre <an...@gmail.com> wrote:
>
> This error comes from trying to setup a server.
> I was able to narrow down the problem to the following steps:
> - new grails app
> - drop the cxf-**.jar into the lib directory (in my case
> cxf-2.0.2-incubator.jar)
> - drop the XmlSchema-1.2.jar (required early in by CXF)
> - change the resource.xml to (notice that almost all is commented. The
> <import/> is enough to create the error):
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xmlns:jaxws="http://cxf.apache.org/jaxws"
>        xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
>
>    <import resource="classpath:META-INF/cxf/cxf.xml" />
>    <!-- import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
>    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" / -->
>
>    <!-- jaxws:endpoint
>      id="processWS"
>      implementor="com.nen.pegasus.ws.ProcessMgmtWService"
>      address="/services/processWS" /-->
>
> </beans>
>
> Whenever I run the grails app, I get the error I reported.
>
>
> Now, I also tried to use GroovyWS in my grails app with no success (as a
> client) while I had no problem with a straight groovy app.
> My guess is that the problem is related to classloading, but I'm completely
> stuck at this point...
>
>
> --
> View this message in context: http://www.nabble.com/CXF-and-grails...-tf4524774.html#a12924445
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>


-- 

Best Regards
Guillaume
http://cheztog.blogspot.com

Re: CXF and grails...

Posted by adupre <an...@gmail.com>.
Did you get a chance to try?
Thx


tog wrote:
> 
> Bonjour Anthony,
>>
>> Now, I also tried to use GroovyWS in my grails app with no success (as a
>> client) while I had no problem with a straight groovy app.
>> My guess is that the problem is related to classloading, but I'm
>> completely
>> stuck at this point...
>>
> Well using the groovyws client from a groovlet in tomcat is working
> fine. I will try later in the afternoon to try from a grails app but
> that should not be a major problem.
> 
>>
>> --
>> View this message in context:
>> http://www.nabble.com/CXF-and-grails...-tf4524774.html#a12924445
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> 
> Best Regards
> Guillaume
> http://cheztog.blogspot.com
> 
> 

-- 
View this message in context: http://www.nabble.com/CXF-and-grails...-tf4524774.html#a12987564
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF and grails...

Posted by tog <gu...@gmail.com>.
Bonjour Anthony,
>
> Now, I also tried to use GroovyWS in my grails app with no success (as a
> client) while I had no problem with a straight groovy app.
> My guess is that the problem is related to classloading, but I'm completely
> stuck at this point...
>
Well using the groovyws client from a groovlet in tomcat is working
fine. I will try later in the afternoon to try from a grails app but
that should not be a major problem.

>
> --
> View this message in context: http://www.nabble.com/CXF-and-grails...-tf4524774.html#a12924445
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>


-- 

Best Regards
Guillaume
http://cheztog.blogspot.com

Re: CXF and grails...

Posted by adupre <an...@gmail.com>.
This error comes from trying to setup a server.
I was able to narrow down the problem to the following steps:
- new grails app
- drop the cxf-**.jar into the lib directory (in my case
cxf-2.0.2-incubator.jar)
- drop the XmlSchema-1.2.jar (required early in by CXF)
- change the resource.xml to (notice that almost all is commented. The
<import/> is enough to create the error):

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jaxws="http://cxf.apache.org/jaxws"
       xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

   <import resource="classpath:META-INF/cxf/cxf.xml" />
   <!-- import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
   <import resource="classpath:META-INF/cxf/cxf-servlet.xml" / -->

   <!-- jaxws:endpoint
     id="processWS"
     implementor="com.nen.pegasus.ws.ProcessMgmtWService"
     address="/services/processWS" /-->

</beans>

Whenever I run the grails app, I get the error I reported.


Now, I also tried to use GroovyWS in my grails app with no success (as a
client) while I had no problem with a straight groovy app.
My guess is that the problem is related to classloading, but I'm completely
stuck at this point...


-- 
View this message in context: http://www.nabble.com/CXF-and-grails...-tf4524774.html#a12924445
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF and grails...

Posted by tog <gu...@gmail.com>.
Hi anthony,

I am the developer of GroovyWS and I am currently looking into running
a service into tomcat which looks close to what you are trying to do.
Could you describe a bit more what you're doing currently ? Are you
using GroovyWS or directly CXF ?
If you are using GroovyWS, is your service using complex data type ?

Thanks
Guillaume

On 9/26/07, adupre <an...@gmail.com> wrote:
>
> Here's the error I get while loading Spring... anyone have any idea what I am
> doing wrong? Thx
>
> 2007-09-26 11:42:22.440::WARN:  Failed startup of context
> org.mortbay.jetty.webapp.WebAppContext@3525a2{/pegasus,c:\projects\pegasus/web-app}
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'org.apache.cxf.wsdl.WSDLManager' defined in class path resource
> [META-INF/cxf/cxf.xml]: Inst
> antiation of bean failed; nested exception is
> org.springframework.beans.BeanInstantiationException: Could not instantiate
> bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constr
> uctor threw exception; nested exception is java.lang.ClassCastException:
> org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to
> javax.xml.parsers.DocumentBuilderFactor
> y       at
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:531)N(ScriptBytecodeAdapter.java:159)
> Caused by: org.springframework.beans.BeanInstantiationException: Could not
> instantiate bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor
> threw exception; nested excep
> tion is java.lang.ClassCastException:
> org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to
> javax.xml.parsers.DocumentBuilderFactory
> Caused by: java.lang.ClassCastException:
> org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to
> javax.xml.parsers.DocumentBuilderFactory
>         at
> javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:123)deAdapter.java:67)
>         at
> java.util.XMLUtils.getLoadingDoc(XMLUtils.java:75)odInvoke(MetaClassHelper.java:678)
>         at java.util.XMLUtils.load(XMLUtils.java:57)ke0(Native
> Method)89)oke(ReflectionMetaMethod.java:58)
> --
> View this message in context: http://www.nabble.com/CXF-and-grails...-tf4524774.html#a12909451
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>


-- 

Best Regards
Guillaume
http://cheztog.blogspot.com