You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by janb <jb...@talend.com> on 2014/01/06 11:39:36 UTC

External Policy Attachment not working with Blueprint

Hi CXF-Users,

I'm trying now for quite some time to get a remote policy attachment applied
to one of my CXF services, but without any success. Any help would be very
welcome!

Here is what I did so far:
1) I created a blueprint config file with my soap service client
2) I tried adding an externalAttachment element as a child of my blueprint
element [1]
The result was that I get the following error:

{code}
2014-01-06 11:19:19,976 | ERROR | Refresh Packages | BlueprintContainerImpl          
| container.BlueprintContainerImpl  393 | 7 -
org.apache.aries.blueprint.core - 1.1.0 | Unable to start blueprint
container for bundle reservationservice-client
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to
validate xml
        at
org.apache.aries.blueprint.parser.Parser.validate(Parser.java:288)[7:org.apache.aries.blueprint.core:1.1.0]
        at
org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:313)[7:org.apache.aries.blueprint.core:1.1.0]
        at
org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:261)[7:org.apache.aries.blueprint.core:1.1.0]
        at
org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:259)[7:org.apache.aries.blueprint.core:1.1.0]
        at
org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:222)[7:org.apache.aries.blueprint.core:1.1.0]
        at
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)[11:org.apache.aries.util:1.1.0]
        at
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)[11:org.apache.aries.util:1.1.0]
        at
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)[11:org.apache.aries.util:1.1.0]
        at
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)[11:org.apache.aries.util:1.1.0]
        at
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)[11:org.apache.aries.util:1.1.0]
        at
org.eclipse.osgi.framework.internal.core.Framework$10.call(Framework.java:1606)[osgi-3.8.0.v20120529-1548.jar:]
        at
org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHookPrivileged(ServiceRegistry.java:1239)[osgi-3.8.0.v20120529-1548.jar:]
        at
org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHooksPrivileged(ServiceRegistry.java:1222)[osgi-3.8.0.v20120529-1548.jar:]
        at
org.eclipse.osgi.framework.internal.core.Framework.notifyEventHooksPrivileged(Framework.java:1603)[osgi-3.8.0.v20120529-1548.jar:]
        at
org.eclipse.osgi.framework.internal.core.Framework.publishBundleEventPrivileged(Framework.java:1558)[osgi-3.8.0.v20120529-1548.jar:]
        at
org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1505)[osgi-3.8.0.v20120529-1548.jar:]
        at
org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1500)[osgi-3.8.0.v20120529-1548.jar:]
        at
org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:391)[osgi-3.8.0.v20120529-1548.jar:]
        at
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:300)[osgi-3.8.0.v20120529-1548.jar:]
        at
org.eclipse.osgi.framework.internal.core.PackageAdminImpl.resumeBundles(PackageAdminImpl.java:312)[osgi-3.8.0.v20120529-1548.jar:]
        at
org.eclipse.osgi.framework.internal.core.PackageAdminImpl.processDelta(PackageAdminImpl.java:556)[osgi-3.8.0.v20120529-1548.jar:]
        at
org.eclipse.osgi.framework.internal.core.PackageAdminImpl.doResolveBundles(PackageAdminImpl.java:251)[osgi-3.8.0.v20120529-1548.jar:]
        at
org.eclipse.osgi.framework.internal.core.PackageAdminImpl$1.run(PackageAdminImpl.java:174)[osgi-3.8.0.v20120529-1548.jar:]
        at java.lang.Thread.run(Thread.java:724)[:1.7.0_25]
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
'p:externalAttachment'.
        at
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
Source)[:]
        at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown
Source)[:]
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
Source)[:]
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
Source)[:]
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
Source)[:]
        at
org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown
Source)[:]
        at
org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown
Source)[:]
        at
org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown
Source)[:]
        at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown
Source)[:]
        at
org.apache.xerces.jaxp.validation.DOMValidatorHelper.beginNode(Unknown
Source)[:]
        at
org.apache.xerces.jaxp.validation.DOMValidatorHelper.validate(Unknown
Source)[:]
        at
org.apache.xerces.jaxp.validation.DOMValidatorHelper.validate(Unknown
Source)[:]
        at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(Unknown
Source)[:]
        at javax.xml.validation.Validator.validate(Unknown Source)[:2.2.0]
        at
org.apache.aries.blueprint.parser.Parser.validate(Parser.java:285)[7:org.apache.aries.blueprint.core:1.1.0]
        ... 23 more
{code}

Here is my blueprint file:

{code}

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cxf="http://cxf.apache.org/blueprint/core"
	xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws"
	xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
	xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
	xmlns:soap="http://cxf.apache.org/bindings/soap"
	xmlns:p="http://cxf.apache.org/policy"
	xmlns:wsp="http://www.w3.org/2006/07/ws-policy"
	xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
  						http://www.osgi.org/xmlns/blueprint-ext/v1.1.0
https://svn.apache.org/repos/asf/aries/tags/blueprint-0.3.1/blueprint-core/src/main/resources/org/apache/aries/blueprint/ext/blueprint-ext.xsd  
  						http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0
http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
  						http://cxf.apache.org/blueprint/jaxws
http://cxf.apache.org/schemas/blueprint/jaxws.xsd
						http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.xsd
  						http://cxf.apache.org/blueprint/core
http://cxf.apache.org/schemas/blueprint/core.xsd
                        http://cxf.apache.org/bindings/soap
http://cxf.apache.org/schemas/configuration/soap.xsd
  	">

	<cm:property-placeholder persistent-id="rac.reservationservice.client"
update-strategy="reload" />

	<p:externalAttachment
location="http://localhost:8040/services/registry/lookup/policy/%7Bhttp%3A%2F%2Fservices.talend.org%2FReservationService%7DReservationServiceProvider"
/>
	
	<jaxws:client id="ReservationServiceClient"
		xmlns:serviceNamespace="http://services.talend.org/ReservationService"
		serviceClass="org.talend.services.reservationservice.ReservationService"
		serviceName="serviceNamespace:ReservationServiceProvider"
		endpointName="serviceNamespace:ReservationServicePort"
		wsdlLocation="${address.wsdl}"
		address="${address.service}">
		<jaxws:features>
			<cxf:logging />
		</jaxws:features>
	</jaxws:client>
</blueprint>
{code}

3) next I tried to embed the <p:externalAttachment> element within the
jaxws:feature element like this:

{code}
<jaxws:features>
	<p:policies>
		<p:externalAttachment
location="file:///C:/tmp/ReservationServiceProvider.policy.xml" />
	</p:policies>
</jaxws:features>
{code}

Now my error by starting this bundle is gone, but I realized that the
external Policy will not be used at all as soon as I started using the
client.

4) I also tried to use the policyReference element for my policy attachment,
but this didn't work ether because CXF then complains that there is not a
valid policy element within the document, but instead a PolicyAttachment
element. Which is understandable.

5) I tried to find a system test from CXF using the externalAttachment
element feature, but it looks like that there is none. Am I doing something
wrong, or is this feature not fully supported within CXF 2.7.7 ?

Thank you for your support! CXF is awesome!

Best regards
Jan

[1]
http://cxf.apache.org/docs/wspconfiguration.html#WSPConfiguration-SpecifyingtheLocationofExternalAttachments



--
View this message in context: http://cxf.547215.n5.nabble.com/External-Policy-Attachment-not-working-with-Blueprint-tp5738294.html
Sent from the cxf-user mailing list archive at Nabble.com.