Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-9852

keycloak-cxf quickstart fails after upgrading to CXF 3.2.x

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: fuse-7.3
    • Fix Version/s: fuse-7.3
    • Component/s: None
    • Labels:
      None
    • Sprint:
      Fuse 7.3 Sprint 38, Fuse 7.3 Sprint 42 - Bug fix

      Description

      Freeman(Yue) Fang, I have such exception:

      2018-11-26 15:10:17,149 ERROR {pipe-restart 246} [org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun()] (BlueprintContainerImpl.java:439) : Unable to start blueprint container for bundle keycloak-cxf/7.3.0.redhat-SNAPSHOT
      org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to initialize bean kc-cxf-endpoint-config
      	at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:593) ~[54:org.apache.aries.blueprint.core:1.9.0]
      	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:703) ~[54:org.apache.aries.blueprint.core:1.9.0]
      	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:666) ~[54:org.apache.aries.blueprint.core:1.9.0]
      	at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:81) ~[54:org.apache.aries.blueprint.core:1.9.0]
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:?]
      	at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:90) ~[54:org.apache.aries.blueprint.core:1.9.0]
      	at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:360) ~[54:org.apache.aries.blueprint.core:1.9.0]
      	at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:190) ~[54:org.apache.aries.blueprint.core:1.9.0]
      	at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:716) ~[54:org.apache.aries.blueprint.core:1.9.0]
      	at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:413) [54:org.apache.aries.blueprint.core:1.9.0]
      	at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:278) [54:org.apache.aries.blueprint.core:1.9.0]
      	at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:299) [54:org.apache.aries.blueprint.core:1.9.0]
      	at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:268) [54:org.apache.aries.blueprint.core:1.9.0]
      	at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:264) [54:org.apache.aries.blueprint.core:1.9.0]
      	at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:254) [54:org.apache.aries.blueprint.core:1.9.0]
      	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500) [54:org.apache.aries.blueprint.core:1.9.0]
      	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433) [54:org.apache.aries.blueprint.core:1.9.0]
      	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725) [54:org.apache.aries.blueprint.core:1.9.0]
      	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463) [54:org.apache.aries.blueprint.core:1.9.0]
      	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422) [54:org.apache.aries.blueprint.core:1.9.0]
      	at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1179) [?:?]
      	at org.apache.felix.framework.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:730) [?:?]
      	at org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:485) [?:?]
      	at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) [?:?]
      	at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) [?:?]
      	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) [?:?]
      	at org.apache.karaf.bundle.command.Restart.doExecute(Restart.java:51) [124:org.apache.karaf.bundle.core:4.2.0.fuse-730010]
      	at org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:56) [124:org.apache.karaf.bundle.core:4.2.0.fuse-730010]
      	at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) [148:org.apache.karaf.shell.core:4.2.0.fuse-730010]
      	at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) [148:org.apache.karaf.shell.core:4.2.0.fuse-730010]
      	at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) [148:org.apache.karaf.shell.core:4.2.0.fuse-730010]
      	at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:571) [148:org.apache.karaf.shell.core:4.2.0.fuse-730010]
      	at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:497) [148:org.apache.karaf.shell.core:4.2.0.fuse-730010]
      	at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:386) [148:org.apache.karaf.shell.core:4.2.0.fuse-730010]
      	at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:417) [148:org.apache.karaf.shell.core:4.2.0.fuse-730010]
      	at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) [148:org.apache.karaf.shell.core:4.2.0.fuse-730010]
      	at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) [148:org.apache.karaf.shell.core:4.2.0.fuse-730010]
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
      	at java.lang.Thread.run(Thread.java:748) [?:?]
      Caused by: java.lang.RuntimeException: Could not process configuration.
      	at org.apache.cxf.transport.http_undertow.blueprint.UndertowHTTPServerEngineFactoryHolder.init(UndertowHTTPServerEngineFactoryHolder.java:172) ~[?:?]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
      	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
      	at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:331) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:838) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:591) ~[?:?]
      	... 40 more
      Caused by: java.lang.NullPointerException
      	at org.apache.cxf.transport.http_undertow.blueprint.UndertowHTTPServerEngineFactoryHolder.init(UndertowHTTPServerEngineFactoryHolder.java:146) ~[?:?]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
      	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
      	at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:331) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:838) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:591) ~[?:?]
      	... 40 more
      

      The configuration (example: https://github.com/jboss-fuse/karaf-quickstarts/tree/7.x.redhat-7-x/security/keycloak/keycloak-cxf) is:

      <httpu:engine-factory id="kc-cxf-endpoint-config">
          <httpu:engine port="8282">
              <httpu:handlers>
                  <bean class="org.keycloak.adapters.osgi.undertow.CxfKeycloakAuthHandler">
                      <property name="configResolver">
                          <bean class="org.keycloak.adapters.osgi.PathBasedKeycloakConfigResolver" />
                      </property>
                  </bean>
              </httpu:handlers>
          </httpu:engine>
      </httpu:engine-factory>
      

      I fixed the NPE by adding:

              <httpu:threadingParameters minThreads="1" maxThreads="10" workerIOThreads="10" />
      

      there was some problem with JAXB, because in:

      if (engine.getThreadingParameters() != null) {
          ThreadingParametersType threads = engine.getThreadingParameters();
          ThreadingParameters rThreads = new ThreadingParameters();
          rThreads.setMaxThreads(threads.getMaxThreads());
          rThreads.setMinThreads(threads.getMinThreads());
          rThreads.setWorkerIOThreads(threads.getWorkerIOThreads());
          eng.setThreadingParameters(rThreads);
      }
      

      engine.getThreadingParameters() wasn't null, but it should.

      This didn't help:

              <httpu:threadingParameters xsi:nil="true" />
      

      I was getting:

      Caused by: org.xml.sax.SAXParseException: cvc-elt.3.1: Attribute 'http://www.w3.org/2001/XMLSchema-instance,nil' must not appear on element 'httpu:threadingParameters', because the {nillable} property of 'httpu:threadingParameters' is false.
      	at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) ~[?:?]
      	at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) ~[?:?]
      ...
      

      Even if I managed to configure threading properties, I started getting:

      Caused by: java.lang.IllegalStateException: Port 8282 is configured with wrong protocol "https" for "http://localhost:8282/jaxws"
      	at org.apache.cxf.transport.http_undertow.UndertowHTTPDestination.retrieveEngine(UndertowHTTPDestination.java:115) ~[?:?]
      	at org.apache.cxf.transport.http_undertow.UndertowHTTPDestination.finalizeConfig(UndertowHTTPDestination.java:129) ~[?:?]
      	at org.apache.cxf.transport.http.HTTPTransportFactory.getDestination(HTTPTransportFactory.java:288) ~[?:?]
      	at org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapTransportFactory.java:135) ~[?:?]
      	at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:85) ~[?:?]
      	at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:64) ~[?:?]
      	at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:182) ~[?:?]
      	at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211) ~[?:?]
      	at org.apache.cxf.jaxws.blueprint.JAXWSBPNamespaceHandler$BPJaxWsServerFactoryBean.create(JAXWSBPNamespaceHandler.java:111) ~[?:?]
      	at org.apache.cxf.jaxws.blueprint.JAXWSBPNamespaceHandler$BPJaxWsServerFactoryBean.init(JAXWSBPNamespaceHandler.java:106) ~[?:?]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
      	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
      	at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:331) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:838) ~[?:?]
      	at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:591) ~[?:?]
      	... 42 more
      

      Please check full configuration here: https://github.com/jboss-fuse/karaf-quickstarts/blob/7.x.redhat-7-x/security/keycloak/keycloak-cxf/src/main/resources/OSGI-INF/blueprint/blueprint.xml

      Freeman(Yue) Fang is this a know inssue when migrating from CXF 3.1 to 3.2?

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  ffang Freeman(Yue) Fang
                  Reporter:
                  grgrzybek Grzegorz Grzybek
                  Tester:
                  Jan Kasztura
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: