You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by javidelgadillo <jd...@esri.com> on 2012/03/23 01:07:23 UTC

jaxrs:providers not working within karaf/blueprint

Wondering if anyone has seen this.  I can't find something definitive on the
net.  I'm trying to configure my own JSON provider to the jaxrs:server
config in my blueprint config.xml file.  Is the jaxrs:providers tag only
functional in spring configurations?  There seem to be lots of samples where
this works in Spring but I've had no luck in blueprint.  FYI: I'm running
CXF bundle 2.4.5

Here's my config:
	<jaxrs:server id="restService" address="/">
		<jaxrs:serviceBeans>
                      ....list of service beans.....
		</jaxrs:serviceBeans>
		<jaxrs:extensionMappings>
			<entry key="json" value="application/json"/>
			<entry key="xml" value="application/xml"/>
		</jaxrs:extensionMappings>	
                <jaxrs:providers> > 
                </jaxrs:providers>	
	</jaxrs:server>

If I don't include the <jaxrs:providers> block, then the bean will load
fine.  As soon as I add it back, I get an error:


2012-03-22 16:18:47,466 | ERROR | rint Extender: 1 | BlueprintContainerImpl          
| container.BlueprintContainerImpl  358 | 9 - org.apache.aries.blueprint -
0.3.1 | Unable to start blueprint container for bundle cxf-service
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to
validate xml
        at
org.apache.aries.blueprint.container.Parser.validate(Parser.java:288)[9:org.apache.aries.blueprint:0.3.1]
        at
org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:275)[9:org.apache.aries.blueprint:0.3.1]
        at
org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:227)[9:org.apache.aries.blueprint:0.3.1]
        at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_17]
        at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_17]
        at
java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_17]
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)[:1.6.0_17]
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)[:1.6.0_17]
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_17]
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_17]
        at java.lang.Thread.run(Thread.java:619)[:1.6.0_17]
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The
matching wildcard is strict, but no declaration can be found for element
'jaxrs:providers'.
        at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)[:1.6.0_17]
        at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)[:1.6.0_17]
        at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)[:1.6.0_17]
        at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)[:1.6.0_17]
        at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:410)[:1.6.0_17]
        at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3165)[:1.6.0_17]
        at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1898)[:1.6.0_17]
        at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:685)[:1.6.0_17]
        at
com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.beginNode(DOMValidatorHelper.java:273)[:1.6.0_17]
        at
com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(DOMValidatorHelper.java:240)[:1.6.0_17]
        at
com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(DOMValidatorHelper.java:186)[:1.6.0_17]
        at
com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:100)[:1.6.0_17]
        at
javax.xml.validation.Validator.validate(Validator.java:127)[:1.6.0_17]
        at
org.apache.aries.blueprint.container.Parser.validate(Parser.java:285)[9:org.apache.aries.blueprint:0.3.1]
        ... 10 more

--
View this message in context: http://cxf.547215.n5.nabble.com/jaxrs-providers-not-working-within-karaf-blueprint-tp5588142p5588142.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: jaxrs:providers not working within karaf/blueprint

Posted by javidelgadillo <jd...@esri.com>.
Turns out the problem was with the declaration of namespaces within my xml
file.

Once I placed this at the beginning:

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws"
           xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
           xmlns:cxf="http://cxf.apache.org/blueprint/core"
           xsi:schemaLocation="
             http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
             http://cxf.apache.org/blueprint/jaxrs
http://cxf.apache.org/schemas/blueprint/jaxrs.xsd
             http://cxf.apache.org/blueprint/core
http://cxf.apache.org/schemas/blueprint/core.xsd
             ">

erverything worked fine.  

Before I only had the jaxrs xmlns entry.

--
View this message in context: http://cxf.547215.n5.nabble.com/jaxrs-providers-not-working-within-karaf-blueprint-tp5588142p5590357.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: jaxrs:providers not working within karaf/blueprint

Posted by javidelgadillo <jd...@esri.com>.
Aki,

(As a side note, I forget to mention that I'm running Karaf 2.2.5

I am behind the firewall so maybe this is an issue.  I'll look into
upgrading bp-core and let you know how it goes.

-Javier

--
View this message in context: http://cxf.547215.n5.nabble.com/jaxrs-providers-not-working-within-karaf-blueprint-tp5588142p5590266.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: jaxrs:providers not working within karaf/blueprint

Posted by Aki Yoshida <el...@googlemail.com>.
There was a known issue in bp-core 0.3.1 that tried to access the
schemas from the network in general. This issue was fixed in
0.4.1-snapshot. From a quick look at the error message, I am
suspecting you hit this issue. Are you behind a firewall or have no
connection to the internet? If that is the case, you can try running
your scenario with the internet connection.

Alternatively, you can try the snapshot karaf that uses the bp-core
0.4.1-snapshot or you can manually replace your bp version.

regards, aki

2012/3/23 javidelgadillo <jd...@esri.com>:
> Wondering if anyone has seen this.  I can't find something definitive on the
> net.  I'm trying to configure my own JSON provider to the jaxrs:server
> config in my blueprint config.xml file.  Is the jaxrs:providers tag only
> functional in spring configurations?  There seem to be lots of samples where
> this works in Spring but I've had no luck in blueprint.  FYI: I'm running
> CXF bundle 2.4.5
>
> Here's my config:
>        <jaxrs:server id="restService" address="/">
>                <jaxrs:serviceBeans>
>                      ....list of service beans.....
>                </jaxrs:serviceBeans>
>                <jaxrs:extensionMappings>
>                        <entry key="json" value="application/json"/>
>                        <entry key="xml" value="application/xml"/>
>                </jaxrs:extensionMappings>
>                <jaxrs:providers> >
>                </jaxrs:providers>
>        </jaxrs:server>
>
> If I don't include the <jaxrs:providers> block, then the bean will load
> fine.  As soon as I add it back, I get an error:
>
>
> 2012-03-22 16:18:47,466 | ERROR | rint Extender: 1 | BlueprintContainerImpl
> | container.BlueprintContainerImpl  358 | 9 - org.apache.aries.blueprint -
> 0.3.1 | Unable to start blueprint container for bundle cxf-service
> org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to
> validate xml
>        at
> org.apache.aries.blueprint.container.Parser.validate(Parser.java:288)[9:org.apache.aries.blueprint:0.3.1]
>        at
> org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:275)[9:org.apache.aries.blueprint:0.3.1]
>        at
> org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:227)[9:org.apache.aries.blueprint:0.3.1]
>        at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_17]
>        at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_17]
>        at
> java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_17]
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)[:1.6.0_17]
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)[:1.6.0_17]
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_17]
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_17]
>        at java.lang.Thread.run(Thread.java:619)[:1.6.0_17]
> Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The
> matching wildcard is strict, but no declaration can be found for element
> 'jaxrs:providers'.
>        at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)[:1.6.0_17]
>        at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)[:1.6.0_17]
>        at
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)[:1.6.0_17]
>        at
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)[:1.6.0_17]
>        at
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:410)[:1.6.0_17]
>        at
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3165)[:1.6.0_17]
>        at
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1898)[:1.6.0_17]
>        at
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:685)[:1.6.0_17]
>        at
> com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.beginNode(DOMValidatorHelper.java:273)[:1.6.0_17]
>        at
> com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(DOMValidatorHelper.java:240)[:1.6.0_17]
>        at
> com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(DOMValidatorHelper.java:186)[:1.6.0_17]
>        at
> com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:100)[:1.6.0_17]
>        at
> javax.xml.validation.Validator.validate(Validator.java:127)[:1.6.0_17]
>        at
> org.apache.aries.blueprint.container.Parser.validate(Parser.java:285)[9:org.apache.aries.blueprint:0.3.1]
>        ... 10 more
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/jaxrs-providers-not-working-within-karaf-blueprint-tp5588142p5588142.html
> Sent from the cxf-user mailing list archive at Nabble.com.