You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Cord Awtry <ki...@gmail.com> on 2008/05/20 02:22:09 UTC

Exception running from unit test

I've recently migrated from CXF 2.0.5 to 2.1. After getting the code to
compile again, the app seems to run properly. Oddly, when I try to run a
unit test that inits the service client, I get the error below.

Even after commenting out the complete contents of the cxf.xml in my
WEB-INF/classes directory, I get the same error. The only solution is to
delete the cxf.xml, but that neuters the services themselves.

Any thoughts on a potential change made between 2.0.5 and 2.1 that could
cause this would be great.

  Thanks,

    -C-

    [junit] Testcase: testValidateOrder took 1.319 sec
    [junit]     Caused an ERROR
    [junit] org.springframework.beans.factory.BeanDefinitionStoreException:
Unex
pected exception parsing XML document from class path resource [cxf.xml];
nested
 exception is java.lang.AbstractMethodError:
javax.xml.parsers.DocumentBuilderFa
ctory.setFeature(Ljava/lang/String;Z)V
    [junit] java.lang.RuntimeException:
org.springframework.beans.factory.BeanDe
finitionStoreException: Unexpected exception parsing XML document from class
pat
h resource [cxf.xml]; nested exception is java.lang.AbstractMethodError:
javax.x
ml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V
    [junit]     at
org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBu
sFactory.java:96)
    [junit]     at
org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBu
sFactory.java:87)
    [junit]     at
org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBu
sFactory.java:65)
    [junit]     at
org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBu
sFactory.java:54)
    [junit]     at
org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:69)
    [junit]     at
org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java
:106)
    [junit]     at
org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java
:97)
    [junit]     at
org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(P
roviderImpl.java:64)
    [junit]     at javax.xml.ws.Service.<init>(Service.java:56)
    [junit] Caused by:
org.springframework.beans.factory.BeanDefinitionStoreExce
ption: Unexpected exception parsing XML document from class path resource
[cxf.x
ml]; nested exception is java.lang.AbstractMethodError:
javax.xml.parsers.Docume
ntBuilderFactory.setFeature(Ljava/lang/String;Z)V
    [junit]     at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader
.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:385)
    [junit]     at
org.apache.cxf.bus.spring.ControlledValidationXmlBeanDefiniti
onReader.doLoadBeanDefinitions(ControlledValidationXmlBeanDefinitionReader.java:
108)
    [junit]     at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader
.loadBeanDefinitions(XmlBeanDefinitionReader.java:313)
    [junit]     at
org.apache.cxf.bus.spring.ControlledValidationXmlBeanDefiniti
onReader.loadBeanDefinitions(ControlledValidationXmlBeanDefinitionReader.java:12
8)
    [junit]     at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader
.loadBeanDefinitions(XmlBeanDefinitionReader.java:290)
    [junit]     at
org.springframework.beans.factory.support.AbstractBeanDefinit
ionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:131)
    [junit]     at
org.springframework.context.support.AbstractXmlApplicationCon
text.loadBeanDefinitions(AbstractXmlApplicationContext.java:108)
    [junit]     at
org.apache.cxf.bus.spring.BusApplicationContext.loadBeanDefin
itions(BusApplicationContext.java:229)
    [junit]     at
org.springframework.context.support.AbstractRefreshableApplic
ationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:101)
    [junit]     at
org.springframework.context.support.AbstractApplicationContex
t.obtainFreshBeanFactory(AbstractApplicationContext.java:394)
    [junit]     at
org.springframework.context.support.AbstractApplicationContex
t.refresh(AbstractApplicationContext.java:324)
    [junit]     at
org.apache.cxf.bus.spring.BusApplicationContext.<init>(BusApp
licationContext.java:86)
    [junit]     at
org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBu
sFactory.java:93)
    [junit] Caused by: java.lang.AbstractMethodError:
javax.xml.parsers.Document
BuilderFactory.setFeature(Ljava/lang/String;Z)V
    [junit]     at
org.apache.cxf.bus.spring.TunedDocumentLoader.createDocumentB
uilderFactory(TunedDocumentLoader.java:127)
    [junit]     at
org.springframework.beans.factory.xml.DefaultDocumentLoader.l
oadDocument(DefaultDocumentLoader.java:68)
    [junit]     at
org.apache.cxf.bus.spring.TunedDocumentLoader.loadDocument(Tu
nedDocumentLoader.java:117)
    [junit]     at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader
.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:361)
    [junit]

Re: Exception running from unit test

Posted by Glen Mazza <gl...@verizon.net>.
I would recommend against using a file named cxf.xml for the web service
provider (that's best for the SOAP client or for more severe CXF
architectural changes on the provider side); typically you use a
cxf-servlet.xml file or another-named file as shown in Steps #7 and #8
here:  http://www.jroller.com/gmazza/date/20080417#WFstep7

HTH,
Glen


2008-05-19 Cord Awtry wrote:
> I've recently migrated from CXF 2.0.5 to 2.1. After getting the code to
> compile again, the app seems to run properly. Oddly, when I try to run a
> unit test that inits the service client, I get the error below.
> 
> Even after commenting out the complete contents of the cxf.xml in my
> WEB-INF/classes directory, I get the same error. The only solution is to
> delete the cxf.xml, but that neuters the services themselves.
> 
> Any thoughts on a potential change made between 2.0.5 and 2.1 that could
> cause this would be great.
> 
>   Thanks,
> 
>     -C-
> 
>     [junit] Testcase: testValidateOrder took 1.319 sec
>     [junit]     Caused an ERROR
>     [junit] org.springframework.beans.factory.BeanDefinitionStoreException:
> Unex
> pected exception parsing XML document from class path resource [cxf.xml];
> nested
>  exception is java.lang.AbstractMethodError:
> javax.xml.parsers.DocumentBuilderFa
> ctory.setFeature(Ljava/lang/String;Z)V
>     [junit] java.lang.RuntimeException:
> org.springframework.beans.factory.BeanDe
> finitionStoreException: Unexpected exception parsing XML document from class
> pat
> h resource [cxf.xml]; nested exception is java.lang.AbstractMethodError:
> javax.x
> ml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V
>     [junit]     at
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBu
> sFactory.java:96)
>     [junit]     at
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBu
> sFactory.java:87)
>     [junit]     at
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBu
> sFactory.java:65)
>     [junit]     at
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBu
> sFactory.java:54)
>     [junit]     at
> org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:69)
>     [junit]     at
> org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java
> :106)
>     [junit]     at
> org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java
> :97)
>     [junit]     at
> org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(P
> roviderImpl.java:64)
>     [junit]     at javax.xml.ws.Service.<init>(Service.java:56)
>     [junit] Caused by:
> org.springframework.beans.factory.BeanDefinitionStoreExce
> ption: Unexpected exception parsing XML document from class path resource
> [cxf.x
> ml]; nested exception is java.lang.AbstractMethodError:
> javax.xml.parsers.Docume
> ntBuilderFactory.setFeature(Ljava/lang/String;Z)V
>     [junit]     at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader
> .doLoadBeanDefinitions(XmlBeanDefinitionReader.java:385)
>     [junit]     at
> org.apache.cxf.bus.spring.ControlledValidationXmlBeanDefiniti
> onReader.doLoadBeanDefinitions(ControlledValidationXmlBeanDefinitionReader.java:
> 108)
>     [junit]     at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader
> .loadBeanDefinitions(XmlBeanDefinitionReader.java:313)
>     [junit]     at
> org.apache.cxf.bus.spring.ControlledValidationXmlBeanDefiniti
> onReader.loadBeanDefinitions(ControlledValidationXmlBeanDefinitionReader.java:12
> 8)
>     [junit]     at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader
> .loadBeanDefinitions(XmlBeanDefinitionReader.java:290)
>     [junit]     at
> org.springframework.beans.factory.support.AbstractBeanDefinit
> ionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:131)
>     [junit]     at
> org.springframework.context.support.AbstractXmlApplicationCon
> text.loadBeanDefinitions(AbstractXmlApplicationContext.java:108)
>     [junit]     at
> org.apache.cxf.bus.spring.BusApplicationContext.loadBeanDefin
> itions(BusApplicationContext.java:229)
>     [junit]     at
> org.springframework.context.support.AbstractRefreshableApplic
> ationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:101)
>     [junit]     at
> org.springframework.context.support.AbstractApplicationContex
> t.obtainFreshBeanFactory(AbstractApplicationContext.java:394)
>     [junit]     at
> org.springframework.context.support.AbstractApplicationContex
> t.refresh(AbstractApplicationContext.java:324)
>     [junit]     at
> org.apache.cxf.bus.spring.BusApplicationContext.<init>(BusApp
> licationContext.java:86)
>     [junit]     at
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBu
> sFactory.java:93)
>     [junit] Caused by: java.lang.AbstractMethodError:
> javax.xml.parsers.Document
> BuilderFactory.setFeature(Ljava/lang/String;Z)V
>     [junit]     at
> org.apache.cxf.bus.spring.TunedDocumentLoader.createDocumentB
> uilderFactory(TunedDocumentLoader.java:127)
>     [junit]     at
> org.springframework.beans.factory.xml.DefaultDocumentLoader.l
> oadDocument(DefaultDocumentLoader.java:68)
>     [junit]     at
> org.apache.cxf.bus.spring.TunedDocumentLoader.loadDocument(Tu
> nedDocumentLoader.java:117)
>     [junit]     at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader
> .doLoadBeanDefinitions(XmlBeanDefinitionReader.java:361)
>     [junit]


Re: Exception running from unit test

Posted by Cord Awtry <ki...@gmail.com>.
Glen: Thanks for the blog info. I ended up moving to a cxf-servlet.xml file
in the WEB-INF directory and that worked
Benson: Thanks for the info on 2.1.1. I'll check that out.

  -C-

On Mon, May 19, 2008 at 9:20 PM, Benson Margulies <bi...@gmail.com>
wrote:

> The immediate error has to do with your choice of an XML parser. Some
> optimization code in 2.1 calls a feature API that is absent in some
> old Xerces code. Snapshots for the will-be 2.1.1 have a fix.
>
> On Mon, May 19, 2008 at 8:22 PM, Cord Awtry <ki...@gmail.com> wrote:
> > I've recently migrated from CXF 2.0.5 to 2.1. After getting the code to
> > compile again, the app seems to run properly. Oddly, when I try to run a
> > unit test that inits the service client, I get the error below.
> >
> > Even after commenting out the complete contents of the cxf.xml in my
> > WEB-INF/classes directory, I get the same error. The only solution is to
> > delete the cxf.xml, but that neuters the services themselves.
> >
> > Any thoughts on a potential change made between 2.0.5 and 2.1 that could
> > cause this would be great.
> >
> >  Thanks,
> >
> >    -C-
> >
> >    [junit] Testcase: testValidateOrder took 1.319 sec
> >    [junit]     Caused an ERROR
> >    [junit]
> org.springframework.beans.factory.BeanDefinitionStoreException:
> > Unex
> > pected exception parsing XML document from class path resource [cxf.xml];
> > nested
> >  exception is java.lang.AbstractMethodError:
> > javax.xml.parsers.DocumentBuilderFa
> > ctory.setFeature(Ljava/lang/String;Z)V
> >    [junit] java.lang.RuntimeException:
> > org.springframework.beans.factory.BeanDe
> > finitionStoreException: Unexpected exception parsing XML document from
> class
> > pat
> > h resource [cxf.xml]; nested exception is java.lang.AbstractMethodError:
> > javax.x
> > ml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V
> >    [junit]     at
> > org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBu
> > sFactory.java:96)
> >    [junit]     at
> > org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBu
> > sFactory.java:87)
> >    [junit]     at
> > org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBu
> > sFactory.java:65)
> >    [junit]     at
> > org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBu
> > sFactory.java:54)
> >    [junit]     at
> > org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:69)
> >    [junit]     at
> > org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java
> > :106)
> >    [junit]     at
> > org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java
> > :97)
> >    [junit]     at
> > org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(P
> > roviderImpl.java:64)
> >    [junit]     at javax.xml.ws.Service.<init>(Service.java:56)
> >    [junit] Caused by:
> > org.springframework.beans.factory.BeanDefinitionStoreExce
> > ption: Unexpected exception parsing XML document from class path resource
> > [cxf.x
> > ml]; nested exception is java.lang.AbstractMethodError:
> > javax.xml.parsers.Docume
> > ntBuilderFactory.setFeature(Ljava/lang/String;Z)V
> >    [junit]     at
> > org.springframework.beans.factory.xml.XmlBeanDefinitionReader
> > .doLoadBeanDefinitions(XmlBeanDefinitionReader.java:385)
> >    [junit]     at
> > org.apache.cxf.bus.spring.ControlledValidationXmlBeanDefiniti
> >
> onReader.doLoadBeanDefinitions(ControlledValidationXmlBeanDefinitionReader.java:
> > 108)
> >    [junit]     at
> > org.springframework.beans.factory.xml.XmlBeanDefinitionReader
> > .loadBeanDefinitions(XmlBeanDefinitionReader.java:313)
> >    [junit]     at
> > org.apache.cxf.bus.spring.ControlledValidationXmlBeanDefiniti
> >
> onReader.loadBeanDefinitions(ControlledValidationXmlBeanDefinitionReader.java:12
> > 8)
> >    [junit]     at
> > org.springframework.beans.factory.xml.XmlBeanDefinitionReader
> > .loadBeanDefinitions(XmlBeanDefinitionReader.java:290)
> >    [junit]     at
> > org.springframework.beans.factory.support.AbstractBeanDefinit
> > ionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:131)
> >    [junit]     at
> > org.springframework.context.support.AbstractXmlApplicationCon
> > text.loadBeanDefinitions(AbstractXmlApplicationContext.java:108)
> >    [junit]     at
> > org.apache.cxf.bus.spring.BusApplicationContext.loadBeanDefin
> > itions(BusApplicationContext.java:229)
> >    [junit]     at
> > org.springframework.context.support.AbstractRefreshableApplic
> >
> ationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:101)
> >    [junit]     at
> > org.springframework.context.support.AbstractApplicationContex
> > t.obtainFreshBeanFactory(AbstractApplicationContext.java:394)
> >    [junit]     at
> > org.springframework.context.support.AbstractApplicationContex
> > t.refresh(AbstractApplicationContext.java:324)
> >    [junit]     at
> > org.apache.cxf.bus.spring.BusApplicationContext.<init>(BusApp
> > licationContext.java:86)
> >    [junit]     at
> > org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBu
> > sFactory.java:93)
> >    [junit] Caused by: java.lang.AbstractMethodError:
> > javax.xml.parsers.Document
> > BuilderFactory.setFeature(Ljava/lang/String;Z)V
> >    [junit]     at
> > org.apache.cxf.bus.spring.TunedDocumentLoader.createDocumentB
> > uilderFactory(TunedDocumentLoader.java:127)
> >    [junit]     at
> > org.springframework.beans.factory.xml.DefaultDocumentLoader.l
> > oadDocument(DefaultDocumentLoader.java:68)
> >    [junit]     at
> > org.apache.cxf.bus.spring.TunedDocumentLoader.loadDocument(Tu
> > nedDocumentLoader.java:117)
> >    [junit]     at
> > org.springframework.beans.factory.xml.XmlBeanDefinitionReader
> > .doLoadBeanDefinitions(XmlBeanDefinitionReader.java:361)
> >    [junit]
> >
>

Re: Exception running from unit test

Posted by Benson Margulies <bi...@gmail.com>.
The immediate error has to do with your choice of an XML parser. Some
optimization code in 2.1 calls a feature API that is absent in some
old Xerces code. Snapshots for the will-be 2.1.1 have a fix.

On Mon, May 19, 2008 at 8:22 PM, Cord Awtry <ki...@gmail.com> wrote:
> I've recently migrated from CXF 2.0.5 to 2.1. After getting the code to
> compile again, the app seems to run properly. Oddly, when I try to run a
> unit test that inits the service client, I get the error below.
>
> Even after commenting out the complete contents of the cxf.xml in my
> WEB-INF/classes directory, I get the same error. The only solution is to
> delete the cxf.xml, but that neuters the services themselves.
>
> Any thoughts on a potential change made between 2.0.5 and 2.1 that could
> cause this would be great.
>
>  Thanks,
>
>    -C-
>
>    [junit] Testcase: testValidateOrder took 1.319 sec
>    [junit]     Caused an ERROR
>    [junit] org.springframework.beans.factory.BeanDefinitionStoreException:
> Unex
> pected exception parsing XML document from class path resource [cxf.xml];
> nested
>  exception is java.lang.AbstractMethodError:
> javax.xml.parsers.DocumentBuilderFa
> ctory.setFeature(Ljava/lang/String;Z)V
>    [junit] java.lang.RuntimeException:
> org.springframework.beans.factory.BeanDe
> finitionStoreException: Unexpected exception parsing XML document from class
> pat
> h resource [cxf.xml]; nested exception is java.lang.AbstractMethodError:
> javax.x
> ml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V
>    [junit]     at
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBu
> sFactory.java:96)
>    [junit]     at
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBu
> sFactory.java:87)
>    [junit]     at
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBu
> sFactory.java:65)
>    [junit]     at
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBu
> sFactory.java:54)
>    [junit]     at
> org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:69)
>    [junit]     at
> org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java
> :106)
>    [junit]     at
> org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java
> :97)
>    [junit]     at
> org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(P
> roviderImpl.java:64)
>    [junit]     at javax.xml.ws.Service.<init>(Service.java:56)
>    [junit] Caused by:
> org.springframework.beans.factory.BeanDefinitionStoreExce
> ption: Unexpected exception parsing XML document from class path resource
> [cxf.x
> ml]; nested exception is java.lang.AbstractMethodError:
> javax.xml.parsers.Docume
> ntBuilderFactory.setFeature(Ljava/lang/String;Z)V
>    [junit]     at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader
> .doLoadBeanDefinitions(XmlBeanDefinitionReader.java:385)
>    [junit]     at
> org.apache.cxf.bus.spring.ControlledValidationXmlBeanDefiniti
> onReader.doLoadBeanDefinitions(ControlledValidationXmlBeanDefinitionReader.java:
> 108)
>    [junit]     at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader
> .loadBeanDefinitions(XmlBeanDefinitionReader.java:313)
>    [junit]     at
> org.apache.cxf.bus.spring.ControlledValidationXmlBeanDefiniti
> onReader.loadBeanDefinitions(ControlledValidationXmlBeanDefinitionReader.java:12
> 8)
>    [junit]     at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader
> .loadBeanDefinitions(XmlBeanDefinitionReader.java:290)
>    [junit]     at
> org.springframework.beans.factory.support.AbstractBeanDefinit
> ionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:131)
>    [junit]     at
> org.springframework.context.support.AbstractXmlApplicationCon
> text.loadBeanDefinitions(AbstractXmlApplicationContext.java:108)
>    [junit]     at
> org.apache.cxf.bus.spring.BusApplicationContext.loadBeanDefin
> itions(BusApplicationContext.java:229)
>    [junit]     at
> org.springframework.context.support.AbstractRefreshableApplic
> ationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:101)
>    [junit]     at
> org.springframework.context.support.AbstractApplicationContex
> t.obtainFreshBeanFactory(AbstractApplicationContext.java:394)
>    [junit]     at
> org.springframework.context.support.AbstractApplicationContex
> t.refresh(AbstractApplicationContext.java:324)
>    [junit]     at
> org.apache.cxf.bus.spring.BusApplicationContext.<init>(BusApp
> licationContext.java:86)
>    [junit]     at
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBu
> sFactory.java:93)
>    [junit] Caused by: java.lang.AbstractMethodError:
> javax.xml.parsers.Document
> BuilderFactory.setFeature(Ljava/lang/String;Z)V
>    [junit]     at
> org.apache.cxf.bus.spring.TunedDocumentLoader.createDocumentB
> uilderFactory(TunedDocumentLoader.java:127)
>    [junit]     at
> org.springframework.beans.factory.xml.DefaultDocumentLoader.l
> oadDocument(DefaultDocumentLoader.java:68)
>    [junit]     at
> org.apache.cxf.bus.spring.TunedDocumentLoader.loadDocument(Tu
> nedDocumentLoader.java:117)
>    [junit]     at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader
> .doLoadBeanDefinitions(XmlBeanDefinitionReader.java:361)
>    [junit]
>