Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API-X to vagrant install #504

Closed
dannylamb opened this issue Jan 23, 2017 · 62 comments · Fixed by Islandora/Alpaca#27
Closed

Add API-X to vagrant install #504

dannylamb opened this issue Jan 23, 2017 · 62 comments · Fixed by Islandora/Alpaca#27
Assignees

Comments

@dannylamb
Copy link
Contributor

dannylamb commented Jan 23, 2017

Installation instructions are outlined here: https://github.com/fcrepo4-labs/fcrepo-api-x.

tl;dr Run this from the karaf client and see what breaks.

$ feature:repo-add mvn:org.fcrepo.apix/fcrepo-apix-karaf/LATEST/xml/features
$ feature:install fcrepo-api-x
@ruebot ruebot self-assigned this Jan 23, 2017
@ruebot
Copy link
Member

ruebot commented Jan 24, 2017

in progress

@ruebot
Copy link
Member

ruebot commented Jan 24, 2017

karaf@root()> feature:repo-add mvn:org.fcrepo.apix/fcrepo-apix-karaf/LATEST/xml/features
Adding feature url mvn:org.fcrepo.apix/fcrepo-apix-karaf/LATEST/xml/features
Error executing command: Error resolving artifact org.fcrepo.apix:fcrepo-apix-karaf:xml:features:LATEST : mvn:org.fcrepo.apix/fcrepo-apix-karaf/LATEST/xml/features

I'll bug A. Birkland or Elliot M. in #fcrepo irc.

@acoburn
Copy link
Contributor

acoburn commented Jan 24, 2017

Misspelling -- try api-x. I.e. feature:repo-add mvn:org.fcrepo.apix/fcrepo-api-x-karaf/LATEST/xml/features

You may also want to try using 0.1.0 instead of LATEST

@ruebot
Copy link
Member

ruebot commented Jan 24, 2017

@acoburn good catch! I'll send a PR to their repo.

@acoburn
Copy link
Contributor

acoburn commented Jan 24, 2017

@ruebot: just did: fcrepo4-labs/fcrepo-api-x#104

@ruebot
Copy link
Member

ruebot commented Jan 24, 2017

@acoburn thank you!

@ruebot
Copy link
Member

ruebot commented Jan 24, 2017

dannylamb pushed a commit to Islandora/Alpaca that referenced this issue Jan 27, 2017
* s/Salmon/Alpaca/g - Resolves Islandora/documentation#507

* Update various component versions to allow for API-X integration; Partially resolves Islandora/documentation#504

* code review check-in

* more code review

* one last thing
@dannylamb dannylamb reopened this Jan 27, 2017
@dannylamb
Copy link
Contributor Author

Lol, we gotta stop saying 'partially resolves' if there's more than one pull. Twice in one day.

@ruebot
Copy link
Member

ruebot commented Jan 27, 2017

Oh shit. I put "resolves" in that commit message!

@dannylamb
Copy link
Contributor Author

Happened earlier with @bryjbrown today too. Sometimes github is too smart for its own good.

@dannylamb
Copy link
Contributor Author

Closed by accident due to 'resolved' being in a message.

@dannylamb dannylamb reopened this Feb 7, 2017
@dannylamb
Copy link
Contributor Author

@ruebot I just created fcrepo4-labs/fcrepo-api-x#106 to describe the issue I'm running into with installing API-X. I'll have to circle back to this once it gets sorted out.

@ruebot
Copy link
Member

ruebot commented Feb 7, 2017

@dannylamb Great! Let me know if you need a hand on my end.

@ruebot ruebot removed the devops label Mar 29, 2017
@ruebot
Copy link
Member

ruebot commented Mar 31, 2017

Looking at this again. When I did a feature:install fcrepo-api-x on a clean vagrant (islandora-deprecated/claw_vagrant@7381e74), the command completes with no errors, but I'm getting this over and over and over and over in karaf logs.

2017-03-31 02:43:14,024 | INFO  | pool-68-thread-3 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Looking for container http://localhost:8080/fcrepo/rest/apix/services
2017-03-31 02:43:14,028 | INFO  | pool-68-thread-3 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Container http://localhost:8080/fcrepo/rest/apix/services does not exist, adding
2017-03-31 02:43:14,106 | INFO  | pool-68-thread-1 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Looking for container http://localhost:8080/fcrepo/rest/apix/extensions
2017-03-31 02:43:14,111 | INFO  | pool-68-thread-2 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Looking for container http://localhost:8080/fcrepo/rest/apix/ontologies
2017-03-31 02:43:14,118 | INFO  | pool-68-thread-2 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Container http://localhost:8080/fcrepo/rest/apix/ontologies does not exist, adding
2017-03-31 02:43:14,119 | INFO  | pool-68-thread-1 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Container http://localhost:8080/fcrepo/rest/apix/extensions does not exist, adding
2017-03-31 02:43:15,034 | INFO  | pool-68-thread-3 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Looking for container http://localhost:8080/fcrepo/rest/apix/services
2017-03-31 02:43:15,037 | INFO  | pool-68-thread-3 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Container http://localhost:8080/fcrepo/rest/apix/services does not exist, adding
2017-03-31 02:43:15,129 | INFO  | pool-68-thread-2 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Looking for container http://localhost:8080/fcrepo/rest/apix/ontologies
2017-03-31 02:43:15,131 | INFO  | pool-68-thread-1 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Looking for container http://localhost:8080/fcrepo/rest/apix/extensions

...and if I scroll up further:

-03-31 02:41:45,538 | INFO  | pool-2-thread-1  | BlueprintCamelContext            | 59 - org.apache.camel.camel-core - 2.18.1 | Apache Camel 2.18.1 (CamelContext: apix-listener) uptime 
2017-03-31 02:41:45,540 | INFO  | pool-2-thread-1  | BlueprintCamelContext            | 59 - org.apache.camel.camel-core - 2.18.1 | Apache Camel 2.18.1 (CamelContext: apix-listener) is shutdown in 0.033 seconds
2017-03-31 02:41:45,546 | ERROR | pool-2-thread-1  | BlueprintContainerImpl           | 12 - org.apache.aries.blueprint.core - 1.7.1 | Unable to start blueprint container for bundle fcrepo-api-x-listener/0.1.0
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to instantiate components
	at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:728)[12:org.apache.aries.blueprint.core:1.7.1]
	at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:411)[12:org.apache.aries.blueprint.core:1.7.1]
	at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:276)[12:org.apache.aries.blueprint.core:1.7.1]
	at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:300)[12:org.apache.aries.blueprint.core:1.7.1]
	at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:269)[12:org.apache.aries.blueprint.core:1.7.1]
	at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:265)[12:org.apache.aries.blueprint.core:1.7.1]
	at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:255)[12:org.apache.aries.blueprint.core:1.7.1]
	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)[21:org.apache.aries.util:1.1.1]
	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)[21:org.apache.aries.util:1.1.1]
	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)[21:org.apache.aries.util:1.1.1]
	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)[21:org.apache.aries.util:1.1.1]
	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)[21:org.apache.aries.util:1.1.1]
	at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1179)[org.apache.felix.framework-5.6.1.jar:]
	at org.apache.felix.framework.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:730)[org.apache.felix.framework-5.6.1.jar:]
	at org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:485)[org.apache.felix.framework-5.6.1.jar:]
	at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4541)[org.apache.felix.framework-5.6.1.jar:]
	at org.apache.felix.framework.Felix.startBundle(Felix.java:2172)[org.apache.felix.framework-5.6.1.jar:]
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)[org.apache.felix.framework-5.6.1.jar:]
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984)[org.apache.felix.framework-5.6.1.jar:]
	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:1287)[8:org.apache.karaf.features.core:4.0.8]
	at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:860)[8:org.apache.karaf.features.core:4.0.8]
	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1176)[8:org.apache.karaf.features.core:4.0.8]
	at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:1074)[8:org.apache.karaf.features.core:4.0.8]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_121]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]
Caused by: java.lang.NoClassDefFoundError: org/apache/camel/component/jms/JmsComponent
	at java.lang.ClassLoader.defineClass1(Native Method)[:1.8.0_121]
	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)[:1.8.0_121]
	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.defineClass(BundleWiringImpl.java:2370)
	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.findClass(BundleWiringImpl.java:2154)
	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1542)
	at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)[:1.8.0_121]
	at org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1415)
	at org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1595)
	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1525)
	at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)[:1.8.0_121]
	at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1925)[org.apache.felix.framework-5.6.1.jar:]
	at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:978)[org.apache.felix.framework-5.6.1.jar:]
	at org.apache.aries.blueprint.container.BlueprintContainerImpl.loadClass(BlueprintContainerImpl.java:467)[12:org.apache.aries.blueprint.core:1.7.1]
	at org.apache.aries.blueprint.container.BlueprintRepository.loadClass(BlueprintRepository.java:419)[12:org.apache.aries.blueprint.core:1.7.1]
	at org.apache.aries.blueprint.container.GenericType.parse(GenericType.java:135)
	at org.apache.aries.blueprint.di.AbstractRecipe.doLoadType(AbstractRecipe.java:168)[12:org.apache.aries.blueprint.core:1.7.1]
	at org.apache.aries.blueprint.di.AbstractRecipe.loadType(AbstractRecipe.java:161)[12:org.apache.aries.blueprint.core:1.7.1]
	at org.apache.aries.blueprint.container.BeanRecipe.loadClass(BeanRecipe.java:250)
	at org.apache.aries.blueprint.container.BeanRecipe.getType(BeanRecipe.java:917)
	at org.apache.aries.blueprint.container.BeanRecipe.getInstanceFromType(BeanRecipe.java:341)
	at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:282)
	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:830)
	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:811)
	at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_121]
	at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[12:org.apache.aries.blueprint.core:1.7.1]
	at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:255)[12:org.apache.aries.blueprint.core:1.7.1]
	at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:186)[12:org.apache.aries.blueprint.core:1.7.1]
	at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:724)[12:org.apache.aries.blueprint.core:1.7.1]
	... 26 more
Caused by: java.lang.ClassNotFoundException: org.apache.camel.component.jms.JmsComponent not found by org.apache.activemq.activemq-osgi [55]
	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1574)[org.apache.felix.framework-5.6.1.jar:]
	at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)[org.apache.felix.framework-5.6.1.jar:]
	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)[org.apache.felix.framework-5.6.1.jar:]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)[:1.8.0_121]
	... 59 more

...and a sudo service karaf-service stop hangs for quite a while, and the karaf logs just have this looping over and over:

2017-03-31 02:50:40,035 | INFO  | 1 - ShutdownTask | DefaultShutdownStrategy          | 59 - org.apache.camel.camel-core - 2.18.1 | Waiting as there are still 4 inflight and pending exchanges to complete, timeout in 126 seconds. Inflights per route: [load-service-uri = 1, load-prepare = 1, loader-http = 1, load-extension = 1]
2017-03-31 02:50:40,035 | DEBUG | 1 - ShutdownTask | DefaultShutdownStrategy          | 59 - org.apache.camel.camel-core - 2.18.1 | There are 2 inflight exchanges:
	InflightExchange: [exchangeId=ID-claw-44506-1490928104423-2-2, fromRouteId=load-extension, routeId=load-extension, nodeId=to20, elapsed=520710, duration=520734]
	InflightExchange: [exchangeId=ID-claw-44506-1490928104423-2-3, fromRouteId=loader-http, routeId=load-service-uri, nodeId=process9, elapsed=520486, duration=520603]
2017-03-31 02:50:40,279 | INFO  | pool-68-thread-1 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Looking for container http://localhost:8080/fcrepo/rest/apix/extensions
2017-03-31 02:50:40,280 | INFO  | pool-68-thread-1 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Container http://localhost:8080/fcrepo/rest/apix/extensions does not exist, adding
2017-03-31 02:50:40,306 | INFO  | pool-68-thread-2 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Looking for container http://localhost:8080/fcrepo/rest/apix/ontologies
2017-03-31 02:50:40,307 | INFO  | pool-68-thread-2 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Container http://localhost:8080/fcrepo/rest/apix/ontologies does not exist, adding
2017-03-31 02:50:40,308 | INFO  | pool-68-thread-3 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Looking for container http://localhost:8080/fcrepo/rest/apix/services
2017-03-31 02:50:40,309 | INFO  | pool-68-thread-3 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Container http://localhost:8080/fcrepo/rest/apix/services does not exist, adding
2017-03-31 02:50:41,036 | INFO  | 1 - ShutdownTask | DefaultShutdownStrategy          | 59 - org.apache.camel.camel-core - 2.18.1 | Waiting as there are still 4 inflight and pending exchanges to complete, timeout in 125 seconds. Inflights per route: [load-service-uri = 1, load-prepare = 1, loader-http = 1, load-extension = 1]
2017-03-31 02:50:41,036 | DEBUG | 1 - ShutdownTask | DefaultShutdownStrategy          | 59 - org.apache.camel.camel-core - 2.18.1 | There are 2 inflight exchanges:
	InflightExchange: [exchangeId=ID-claw-44506-1490928104423-2-2, fromRouteId=load-extension, routeId=load-extension, nodeId=to20, elapsed=521711, duration=521735]
	InflightExchange: [exchangeId=ID-claw-44506-1490928104423-2-3, fromRouteId=loader-http, routeId=load-service-uri, nodeId=process9, elapsed=521487, duration=521604]

...and finally, when I start the service again - sudo service karaf-service start - I'm still getting this over and over in the karaf logs:

2017-03-31 02:58:09,159 | INFO  | pool-26-thread-3 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Looking for container http://localhost:8080/fcrepo/rest/apix/services
2017-03-31 02:58:09,160 | INFO  | pool-26-thread-3 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Container http://localhost:8080/fcrepo/rest/apix/services does not exist, adding
2017-03-31 02:58:09,957 | INFO  | pool-26-thread-1 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Looking for container http://localhost:8080/fcrepo/rest/apix/extensions
2017-03-31 02:58:09,959 | INFO  | pool-26-thread-1 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Container http://localhost:8080/fcrepo/rest/apix/extensions does not exist, adding
2017-03-31 02:58:10,173 | INFO  | pool-26-thread-3 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Looking for container http://localhost:8080/fcrepo/rest/apix/services
2017-03-31 02:58:10,175 | INFO  | pool-26-thread-2 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Looking for container http://localhost:8080/fcrepo/rest/apix/ontologies
2017-03-31 02:58:10,176 | INFO  | pool-26-thread-2 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Container http://localhost:8080/fcrepo/rest/apix/ontologies does not exist, adding
2017-03-31 02:58:10,177 | INFO  | pool-26-thread-3 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Container http://localhost:8080/fcrepo/rest/apix/services does not exist, adding
2017-03-31 02:58:10,962 | INFO  | pool-26-thread-1 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Looking for container http://localhost:8080/fcrepo/rest/apix/extensions
2017-03-31 02:58:10,964 | INFO  | pool-26-thread-1 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Container http://localhost:8080/fcrepo/rest/apix/extensions does not exist, adding
2017-03-31 02:58:11,178 | INFO  | pool-26-thread-2 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Looking for container http://localhost:8080/fcrepo/rest/apix/ontologies
2017-03-31 02:58:11,180 | INFO  | pool-26-thread-3 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Looking for container http://localhost:8080/fcrepo/rest/apix/services
2017-03-31 02:58:11,180 | INFO  | pool-26-thread-2 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Container http://localhost:8080/fcrepo/rest/apix/ontologies does not exist, adding
2017-03-31 02:58:11,182 | INFO  | pool-26-thread-3 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Container http://localhost:8080/fcrepo/rest/apix/services does not exist, adding
2017-03-31 02:58:11,966 | INFO  | pool-26-thread-1 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Looking for container http://localhost:8080/fcrepo/rest/apix/extensions
2017-03-31 02:58:11,969 | INFO  | pool-26-thread-1 | LdpContainerRegistry             | 189 - fcrepo-api-x-jena - 0.1.0 | Container http://localhost:8080/fcrepo/rest/apix/extensions does not exist, adding

@ajs6f
Copy link

ajs6f commented Apr 19, 2017

That looks vaguely like a provisioning problem, like the camel-jms feature wasn't getting loaded or something. But that would seem really weird.

@ajs6f
Copy link

ajs6f commented Apr 24, 2017

Pinging @emetsger and @birkland on this-- before I launch into it, does this look familiar at all? Any thoughts?

@birkland
Copy link

birkland commented Apr 25, 2017 via email

@ajs6f
Copy link

ajs6f commented Apr 27, 2017

@ruebot You didn't end up with a branch for this, right? You were just working off of a clean master vagrant and manually trying to get API-X into the runtime, right?

@whikloj
Copy link
Member

whikloj commented Apr 27, 2017

The issue I have is less about the broker being inside Karaf and more about using camel-jms and ActiveMQ together inside karaf.
ie. this is what fails consistently
https://github.com/whikloj/islandora-1x-derivative-toolkit/blob/master/islandora-1x-gatekeeper/src/main/resources/OSGI-INF/blueprint/blueprint.xml#L36-L39

@ajs6f
Copy link

ajs6f commented Apr 27, 2017

@whikloj Seems like that is relevant here though, eh? Because camel-toolbox will be in the same position of trying to use a camel-jms client within Karaf to an AMQ broker also within the same Karaf?

@ruebot
Copy link
Member

ruebot commented Apr 27, 2017

@ajs6f nope, no branch on this since islandora-deprecated/claw_vagrant@8eb5513 -- I was just testing on a master build a while back and trying to implement what @acoburn recommended in the API-X ticket.

@whikloj
Copy link
Member

whikloj commented Apr 27, 2017

@ajs6f I agree but this could also be relative amateurish work in OSGI that is causing the problems. But if I figure out something, I will definitely report back.

@ajs6f
Copy link

ajs6f commented Apr 27, 2017

@ruebot @whikloj Okay, sounds like it is as least worth me starting where @ruebot got to and just seeing how far I get with the new knowledge in this ticket.

@ajs6f
Copy link

ajs6f commented Apr 27, 2017

After a good bit of tinkering about today, most of which was really just me learning claw_vagrant, I think I understand that the root of the container problem is that API-X is unaware of CLAW's Syn authN system, and thus fails to create the containers it wants on startup. The JMS question is a different story, but I am currently inclined to leave it be for the nonce and fix the authN problem first, to get a clean API-X startup.

This hypothesis does have the advantage of predicting that (as happened) @birkland would be able to start API-X cleanly in a non-CLAW env, but that I (in claw-vagrant) would see the same thing @ruebot did, which I did.

@birkland
Copy link

Hi @ajs6f ,

Ah, I see. API-X needs to be able to bootstrap and maintain itself (i.e. create containers in the repository for registries, persist extension definitions, ontologies, etc). If CLAW's repo is locked down, then API-X would need to be configured with credentials in order to maintain the data it needs to. So far, we haven't needed to do that. I think some of the API-X blueprint files would need to be updated in order to make that possible.

fcrepo-api-x-jena/LdpContainerRegistry is the base impl that does such writing. It has an HttpClient injected here. That's a service reference from the bundle's blueprint file. The blueprint file from fcrepo-api-x-registry exports an HttpClient as a service, but unfortunately it isn't configured for authentication.

One approach to adding auth would be to configure the client exported in fcrepo-api-x-registry to authenticate with the appropriate credentials to the desired realm (i.e the Fedora instance, at whatever host it's at). That would require updating the one blueprint file.

Another approach might be to not import an HttpClient as a service reference in fcrepo-api-x-jena, and just build a new one there in its blueprint file; adding the appropriate config properties to add credentials when auth is desired.

I'm not sure which approach is best...

@dannylamb
Copy link
Contributor Author

If it's possible for CLAW to publish its own in Alpaca, then that's probably the least invasive way to do it. Api-X can provide a default that we just would supplant with our own.

As far as getting that token, we could provide a static one for Api-X or find some other way to get it by giving Api-X a Drupal user/pass and using that to get a token.

@ajs6f
Copy link

ajs6f commented Apr 28, 2017

From experience with exactly this problem in Jena, I think it's better long-term to treat with actual clients, rather than try to think of every possible option or weirdness that people might want to inflict on HTTP. But in additional to HttpClient, we would want also to have HttpContext available, for authN patterns that require state in the conversation.

@ajs6f
Copy link

ajs6f commented Apr 28, 2017

Sounds like the immediate short-term fix for CLAW is to set the right config in blueprint using Vagrant setup scripts or the like. For the long term, API-X can decide on a pattern and CLAW can adjust to match. That sound good?

@birkland
Copy link

Sounds good to me. I need to better understand the Auth setup CLAW uses, buy would be happy to implement whatever it takes on the API-X end to make it straightforward!

@dannylamb
Copy link
Contributor Author

@birkland, Based on some cursory looks, it appears that separating the blueprint from the code would let us provide our own config and therefore http client. Or we can take the one that's declared as a service in api-x, give it a jndi name, and then make the bean refs that look for it accept a configurable jndi name. In Alpaca, CLAW can just provide its own bundle that exports an http client as another name and just update configuration to pull in the right one from jndi. I think that'd be the least invasive option.

I can help out with that right after I wrap up #597, which should be soon.

@ajs6f
Copy link

ajs6f commented May 2, 2017

All of those ideas sound good, and if I'm not mistaken, there is an additional possibility that comes from OSGi: using OSGi Services to provide a properly-configured client Karaf-wide (like JNDI, but OSGi-specific with some extra flavor). Blueprint can use a service ranking to select from various clients on offer.

@ajs6f
Copy link

ajs6f commented May 2, 2017

Now that I examine JWT a bit more, it's not clear to me that a simple client will do the job. Is it not the case that a series of interactions must take place between client and server to start an authenticated conversation? We may need to look at HttpClientContext and other HTTP Commons facilities...

@birkland
Copy link

birkland commented May 2, 2017

I was taking a look at it yesterday - having no prior familiarity with JWT. It looks to me like there needs to be an exchange that ultimately results the client getting a token that it can then use in requests to Fedora. It's unclear to me if that token expires, or otherwise needs to be messed with once it's obtained. In any case, it looks like we'd need to have a service which performs that interaction, then publishes a pre-configured HTTPClient to the OSGi service registry. That HTTPClient may have to be a façade or proxy to hide token re-negotiation logic that may have to occur from time time, if necessary. I think this is what @dannylamb was referring to by "a bundle that exports an http client as another name"

If that's the case, then the modification API-X needs is a configuration param for the identity/name of the httpclient.

@ajs6f
Copy link

ajs6f commented May 2, 2017

+1 to API-X having such a config-- that would be useful far beyond this ticket.

@birkland
Copy link

birkland commented May 2, 2017

All right, I'll get on it!

@ajs6f
Copy link

ajs6f commented May 2, 2017

For the JWT case, I suspect that we might be able to use interceptors to deal with the pattern, a la https://hc.apache.org/httpcomponents-client-4.2.x/httpclient/examples/org/apache/http/examples/client/ClientGZipContentCompression.java

@dannylamb
Copy link
Contributor Author

So we haven't tried it yet, but the drupal module we're using for JWT auth provides an endpoint to request a token using your drupal user/pass. That's the exchange that would have to take place.

So we'll need to make an API-X user for CLAW and give it a user/pass (or just let it run as admin for now), use that to get the token, and then jam that token in as an Authorization header for every request that gets sent out during bootstrapping. And yes, that token can expire, so care may have to be taken there.

I don't have a ton of experience using the Apache HTTP client, so I'm not sure what the best way to force that header is.

Either way, I'm going to play around with the drupal module to see if I can enable that endpoint and see how it behaves.

@ajs6f
Copy link

ajs6f commented May 2, 2017

@dannylamb I think we can use the interceptors I mention above for the kind of pattern you are describing. We'd have a stateful request interceptor which would check to see if it has a token in hand, and if not, request one, presumably using the same "wrapped" client. In either case, it then adds the token to the header appropriately. I don't think we would need a response interceptor...

@ajs6f
Copy link

ajs6f commented May 3, 2017

@birkland We've got a PR ^^^ for when you're ready to try injecting the client.

@birkland
Copy link

birkland commented May 3, 2017

@ajs6f Great, thanks. I'm aiming for an API-X PR this afternoon

@dannylamb
Copy link
Contributor Author

@ajs6f @birkland Many thanks for all your efforts on this. Islandora CLAW now comes loaded with API-X!

@ajs6f
Copy link

ajs6f commented May 25, 2017

"What do you implement content services in?"
"ANYTHING I FEEL LIKE, BABY!"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants