[ 
https://issues.apache.org/jira/browse/CAMEL-14843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17075782#comment-17075782
 ] 

Gerald Kallas commented on CAMEL-14843:
---------------------------------------

I was changing my DSL as followingI was changing my DSL as following
{code:java}
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 
https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd";
   xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0";>

   <bean id="constraint" class="org.eclipse.jetty.util.security.Constraint">
      <property name="name" value="BASIC"/>
      <property name="roles" value="admingroup"/>
      <property name="authenticate" value="true"/>
   </bean>

   <bean id="constraintMapping" 
class="org.eclipse.jetty.security.ConstraintMapping">
      <property name="constraint" ref="constraint"/>
      <property name="pathSpec" value="/*"/>
   </bean>

   <bean id="securityHandler" 
class="org.eclipse.jetty.security.ConstraintSecurityHandler">
      <property name="authenticator">
         <bean 
class="org.eclipse.jetty.security.authentication.BasicAuthenticator"/>
      </property>
      <property name="constraintMappings">
         <list>
            <ref component-id="constraintMapping"/>
         </list>
      </property>
   </bean>

   <camelContext id="WEBISP001" 
xmlns="http://camel.apache.org/schema/blueprint";>

      <route id="WEBISP001">
         <from uri="jetty:http://0.0.0.0:8182/hello?handlers=securityHandler"; />
         <log message="hello request body: ${in.body}" />
      </route>

   </camelContext>
 </blueprint>{code}
Seems that the class

org.eclipse.jetty.util.security.Constraint

has been replaced with

org.eclipse.jetty.util.security.Constraint

in Jetty9. Now I'm getting an error


{code:java}
org.osgi.service.blueprint.container.ComponentDefinitionException: Error 
setting property: PropertyDescriptor <name: roles, getter: class 
org.eclipse.jetty.util.security.Constraint.getRoles(), setter: [class 
org.eclipse.jetty.util.security.Constraint.setRoles(class [Ljava.lang.String;)] 
       at 
org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:818)
 ~[!/:1.10.2]        at 
org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:784)
 ~[!/:1.10.2]        at 
org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:765)
 ~[!/:1.10.2]        at 
org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:699)
 ~[!/:1.10.2]        at 
org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:666)
 ~[!/:1.10.2]        at 
org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:81) 
~[!/:1.10.2]        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
~[?:1.8.0_242]        at 
org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:90) 
~[!/:1.10.2]        at 
org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:360)
 ~[!/:1.10.2]        at 
org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:190)
 ~[!/:1.10.2]        at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:737)
 ~[!/:1.10.2]        at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:433)
 [!/:1.10.2]        at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:298)
 [!/:1.10.2]        at 
org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:311)
 [!/:1.10.2]        at 
org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:280)
 [!/:1.10.2]        at 
org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:276)
 [!/:1.10.2]        at 
org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:266)
 [!/:1.10.2]        at 
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)
 [!/:1.10.2]        at 
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)
 [!/:1.10.2]        at 
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)
 [!/:1.10.2]        at 
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)
 [!/:1.10.2]        at 
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)
 [!/:1.10.2]        at 
org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1179)
 [org.apache.felix.framework-5.6.12.jar:?]        at 
org.apache.felix.framework.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:730)
 [org.apache.felix.framework-5.6.12.jar:?]        at 
org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:485)
 [org.apache.felix.framework-5.6.12.jar:?]        at 
org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) 
[org.apache.felix.framework-5.6.12.jar:?]        at 
org.apache.felix.framework.Felix.startBundle(Felix.java:2174) 
[org.apache.felix.framework-5.6.12.jar:?]        at 
org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) 
[org.apache.felix.framework-5.6.12.jar:?]        at 
org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260)
 [!/:3.6.4]        at 
org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233)
 [!/:3.6.4]        at 
org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221)
 [!/:3.6.4]        at 
org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515)
 [!/:3.6.4]        at 
org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365)
 [!/:3.6.4]        at 
org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316)
 [!/:3.6.4]Caused by: java.lang.Exception: Unable to convert value admingroup 
to type class [Ljava.lang.String;. Type class [Ljava.lang.String; is an 
interface or an abstract class        at 
org.apache.aries.blueprint.container.AggregateConverter.createObject(AggregateConverter.java:313)
 ~[!/:1.10.2]        at 
org.apache.aries.blueprint.container.AggregateConverter.convertFromString(AggregateConverter.java:307)
 ~[!/:1.10.2]        at 
org.apache.aries.blueprint.container.AggregateConverter.convert(AggregateConverter.java:177)
 ~[!/:1.10.2]        at 
org.apache.aries.blueprint.container.BlueprintRepository.convert(BlueprintRepository.java:516)
 ~[!/:1.10.2]        at 
org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.convert(ReflectionUtils.java:434)
 ~[!/:1.10.2]        at 
org.apache.aries.blueprint.utils.ReflectionUtils$MethodPropertyDescriptor.internalSet(ReflectionUtils.java:668)
 ~[!/:1.10.2]        at 
org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.set(ReflectionUtils.java:418)
 ~[!/:1.10.2]        at 
org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:816)
 ~[!/:1.10.2]
{code}

> Outdated documentation for camel-jetty Basic Authentication
> -----------------------------------------------------------
>
>                 Key: CAMEL-14843
>                 URL: https://issues.apache.org/jira/browse/CAMEL-14843
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jetty
>    Affects Versions: 3.0.1
>            Reporter: Gerald Kallas
>            Priority: Major
>
> The documentation for camel-jetty seems to be outdated as the HTTP Basic 
> Authentication sample doesn't work as described. See the route below.
> I followed the documentation
> [https://camel.apache.org/components/latest/jetty-component.html]
> 2 observations
>  * Unresolved requirements: [[WEBISP001.xml [264](R 264.12)] 
> osgi.wiring.package; (osgi.wiring.package=org.eclipse.jetty.http.security)]
>  * org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'bean' is 
> not allowed to appear in element 'ref'.
> The documentation should be updated to provide a working configuration for 
> Camel 3.x
> {code:java}
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>    xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 
> https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd";
>    xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0";>
>    <bean id="constraint" class="org.eclipse.jetty.http.security.Constraint">
>       <property name="name" value="BASIC"/>
>       <property name="roles" value="tracker-users"/>
>       <property name="authenticate" value="true"/>
>    </bean>
>    <bean id="constraintMapping" 
> class="org.eclipse.jetty.security.ConstraintMapping">
>       <property name="constraint" ref="constraint"/>
>       <property name="pathSpec" value="/*"/>
>    </bean>
>    <bean id="securityHandler" 
> class="org.eclipse.jetty.security.ConstraintSecurityHandler">
>       <property name="authenticator">
>          <bean 
> class="org.eclipse.jetty.security.authentication.BasicAuthenticator"/>
>       </property>
>       <property name="constraintMappings">
>          <list>
>             <ref bean="constraintMapping"/>
>          </list>
>       </property>
>    </bean>
>    <camelContext id="WEBISP001" 
> xmlns="http://camel.apache.org/schema/blueprint";>
>       <route id="WEBISP001">
>          <from uri="jetty:http://0.0.0.0:8182/hello"; />
>          <log message="hello request body: ${in.body}" />
>       </route>
>    </camelContext>
>  </blueprint>
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to