[ 
https://issues.apache.org/jira/browse/ARIES-1540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jean-Baptiste Onofré resolved ARIES-1540.
-----------------------------------------
    Resolution: Fixed

> Blueprint NamespaceHandler can't resolve XSD in offline mode
> ------------------------------------------------------------
>
>                 Key: ARIES-1540
>                 URL: https://issues.apache.org/jira/browse/ARIES-1540
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>    Affects Versions: blueprint-core-1.6.1
>            Reporter: Jean-Baptiste Onofré
>            Assignee: Jean-Baptiste Onofré
>             Fix For: blueprint-core-1.8.3, blueprint-core-1.6.2
>
>
> When the NamespaceHandler is offline, it fails to resolve the XSD:
> {code}
> 17:18:44,952 | WARN  | pool-27-thread-1 | l$NamespaceHandlerSetImpl$Loader  
> 544 | 16 - org.apache.aries.blueprint.core - 1.6.1 | Dynamically adding 
> namespace handler http://cxf.apache.org/configuration/beans to bundle 
> org.talend.esb.job.controller/6.2.0.SNAPSHOT
> 17:18:44,955 | WARN  | pool-27-thread-1 | l$NamespaceHandlerSetImpl$Loader  
> 544 | 16 - org.apache.aries.blueprint.core - 1.6.1 | Dynamically adding 
> namespace handler http://cxf.apache.org/configuration/parameterized-types to 
> bundle org.talend.esb.job.controller/6.2.0.SNAPSHOT
> 17:18:44,956 | ERROR | pool-27-thread-1 | container.BlueprintContainerImpl  
> 437 | 16 - org.apache.aries.blueprint.core - 1.6.1 | Unable to start 
> blueprint container for bundle org.talend.esb.job.controller/6.2.0.SNAPSHOT
> org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 
> 'ptp:ParameterizedInt' to a(n) 'simpleType definition' component.
>     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.xs.traversers.XSDHandler.reportSchemaError(Unknown 
> Source)[:]
>     at 
> org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(Unknown 
> Source)[:]
>     at 
> org.apache.xerces.impl.xs.traversers.XSDAbstractTraverser.reportSchemaError(Unknown
>  Source)[:]
>     at 
> org.apache.xerces.impl.xs.traversers.XSDAttributeTraverser.traverseNamedAttr(Unknown
>  Source)[:]
>     at 
> org.apache.xerces.impl.xs.traversers.XSDAttributeTraverser.traverseLocal(Unknown
>  Source)[:]
>     at 
> org.apache.xerces.impl.xs.traversers.XSDAbstractTraverser.traverseAttrsAndAttrGrps(Unknown
>  Source)[:]
>     at 
> org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.processComplexContent(Unknown
>  Source)[:]
>     at 
> org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.traverseComplexTypeDecl(Unknown
>  Source)[:]
>     at 
> org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.traverseLocal(Unknown
>  Source)[:]
>     at 
> org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(Unknown
>  Source)[:]
>     at 
> org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseGlobal(Unknown
>  Source)[:]
>     at 
> org.apache.xerces.impl.xs.traversers.XSDHandler.traverseSchemas(Unknown 
> Source)[:]
>     at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown 
> Source)[:]
>     at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source)[:]
>     at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown 
> Source)[:]
>     at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown 
> Source)[:]
>     at org.apache.xerces.jaxp.validation.XMLSchemaFactory.newSchema(Unknown 
> Source)[:]
>     at 
> org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl$NamespaceHandlerSetImpl.createSchema(NamespaceHandlerRegistryImpl.java:637)[16:org.apache.aries.blueprint.core:1.6.1]
>     at 
> org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl$NamespaceHandlerSetImpl.doGetSchema(NamespaceHandlerRegistryImpl.java:458)[16:org.apache.aries.blueprint.core:1.6.1]
>     at 
> org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl$NamespaceHandlerSetImpl.getSchema(NamespaceHandlerRegistryImpl.java:443)[16:org.apache.aries.blueprint.core:1.6.1]
>     at 
> org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:343)[16:org.apache.aries.blueprint.core:1.6.1]
>     at 
> org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:276)[16:org.apache.aries.blueprint.core:1.6.1]
>     at 
> org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:300)[16:org.apache.aries.blueprint.core:1.6.1]
>     at 
> org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:269)[16:org.apache.aries.blueprint.core:1.6.1]
>     at 
> org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:265)[16:org.apache.aries.blueprint.core:1.6.1]
>     at 
> org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:255)[16:org.apache.aries.blueprint.core:1.6.1]
>     at 
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)[26:org.apache.aries.util:1.1.1]
>     at 
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)[26:org.apache.aries.util:1.1.1]
>     at 
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)[26:org.apache.aries.util:1.1.1]
>     at 
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)[26:org.apache.aries.util:1.1.1]
>     at 
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)[26:org.apache.aries.util:1.1.1]
>     at 
> org.eclipse.osgi.internal.framework.EquinoxEventPublisher$2.call(EquinoxEventPublisher.java:189)[org.eclipse.osgi-3.10.2.jar:]
>     at 
> org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHookPrivileged(ServiceRegistry.java:1280)[org.eclipse.osgi-3.10.2.jar:]
>     at 
> org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHooksPrivileged(ServiceRegistry.java:1263)[org.eclipse.osgi-3.10.2.jar:]
>     at 
> org.eclipse.osgi.internal.framework.EquinoxEventPublisher.notifyEventHooksPrivileged(EquinoxEventPublisher.java:186)[org.eclipse.osgi-3.10.2.jar:]
>     at 
> org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:146)[org.eclipse.osgi-3.10.2.jar:]
>     at 
> org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:75)[org.eclipse.osgi-3.10.2.jar:]
>     at 
> org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:67)[org.eclipse.osgi-3.10.2.jar:]
>     at 
> org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:102)[org.eclipse.osgi-3.10.2.jar:]
>     at 
> org.eclipse.osgi.container.Module.publishEvent(Module.java:466)[org.eclipse.osgi-3.10.2.jar:]
>     at 
> org.eclipse.osgi.container.Module.start(Module.java:457)[org.eclipse.osgi-3.10.2.jar:]
>     at 
> org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:392)[org.eclipse.osgi-3.10.2.jar:]
>     at 
> org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:411)[org.eclipse.osgi-3.10.2.jar:]
>     at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:1262)[9:org.apache.karaf.features.core:4.0.5]
>     at 
> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:840)[9:org.apache.karaf.features.core:4.0.5]
>     at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1152)[9:org.apache.karaf.features.core:4.0.5]
>     at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:1048)[9:org.apache.karaf.features.core:4.0.5]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_60]
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_60]
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_60]
>     at java.lang.Thread.run(Thread.java:745)[:1.8.0_60]
> {code}
> The problem is located on the NamespaceHandler. The following fix does the 
> trick:
> {code}
> diff --git 
> a/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java
>  
> b/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java
> index 86ad15b..fd8ea52 100644
> --- 
> a/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java
> +++ 
> b/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java
> @@ -541,16 +541,20 @@ public class NamespaceHandlerRegistryImpl implements 
> NamespaceHandlerRegistry, S
>                          }
>                      }
>                      // Find a compatible namespace handler
> -                    LOGGER.warn("Dynamically adding namespace handler {} to 
> bundle {}/{}",
> -                            nsUri, bundle.getSymbolicName(), 
> bundle.getVersion());
>                      h = findCompatibleNamespaceHandler(nsUri);
>                      if (h != null) {
> -                        URL url = h.getSchemaLocation(rid);
> +                        URL url = h.getSchemaLocation(namespaceURI);
> +                        if (url == null) {
> +                           url = h.getSchemaLocation(rid);
> +                       }
>                          if (isCorrectUrl(url)) {
> +                            LOGGER.warn("Dynamically adding namespace 
> handler {} to bundle {}/{}",
> +                               nsUri, bundle.getSymbolicName(), 
> bundle.getVersion());
>                              return createLSInput(url, id, namespaceURI);
>                          }
>                      }
>                  }
> +                LOGGER.warn("Unable to find namespace handler for {}", 
> namespaceURI); 
>                  return null;
>              }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to