1

Currently I have a situation, where I develop a project, then run mvn install and it get's put into my local Maven repository as a simple JAR file

Then, I have a crafted by some other guys "environment" which includes a whole lot of bundles and stuff, and is ultimately run via mvn pax:run and it takes like 5 minutes to run

I would like to be able to just run felix:update <bundle-name> but I cannot fill the gap between a Maven JAR artifact in local Maven repo, and a ready-for-provisioning bundle that I could put somewhere to just run felix:update or whatever, maybe uninstall/install

When I try to run mvn pax:create-bundle with my project, it throws a Containing project does not have packaging type 'pom' exception

Any help is highly appreciated

UPDATE: I've noticed that problems with re-installed bundle begin in it's activator, with a ClassNotFoundException (although the class mentioned is and always present in the bundle, so it must an issue with classpath, ClassLoader setup or whatever)

at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation BundleWiringImpl.java:1574 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 at some.external.adapters.package.guice.SomeModule.configure SomeModule.java:46 at com.google.inject.AbstractModule.configure AbstractModule.java:59

62mkv
  • 1,444
  • 1
  • 16
  • 28
  • the closest I come so far is running `mvn bundle:bundle` from the project root, then in gogo console: `uninstall `, `install file:` and `start ` However, it does not get published properly by the `portalCore`. and also I am in doubt as to why the `osgi_container/bundles/original-bundle-name` is not updated at all (might be because it contains bundles that were "download" before the container was started, so it's not that much of a problem, but still) – 62mkv Mar 29 '18 at 06:00
  • Attempt to start a bundle leads to an error of a kind ` 15:35:08.375 [DEBUG] [NO_AUTH:NO_SESSION] [Gogo shell] r.o.a.f.b.activator.SomeActivator - Configure servlet support Guice module for SOME-External-Ad apter 15:35:08.397 [ERROR] [NO_AUTH:NO_SESSION] [Gogo shell] r.o.a.f.b.activator.SomeActivator - Bundle SOME-External-Adapter. Failed to start. java.lang.No ClassDefFoundError caused by java.lang.ClassNotFoundException (some.external.adapters.package.service.callback.SomeReplyReceiver not found by SOME-External-Adapter [150 ]) at ...` – 62mkv Mar 29 '18 at 08:49
  • at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation BundleWiringImpl.java:1574 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 at some.external.adapters.package.guice.SomeModule.configure SomeModule.java:46 at com.google.inject.AbstractModule.configure AbstractModule.java:59 – 62mkv Mar 29 '18 at 08:49
  • another attempt to re-install bundle led to "Address already in use" error while re-registering the bundle. so, no ClassNotFound issue. needs more investigation though – 62mkv Mar 29 '18 at 11:28
  • If you have important additional information, do not post it in comments where the formatting makes it impossible to process. Please edit the original question to add the information. – Neil Bartlett Mar 29 '18 at 13:48
  • I did it, eventually. those comments I have kept mostly for myself. however, almost all of this turned out to be irrelevant anyway – 62mkv Mar 30 '18 at 11:37

2 Answers2

0

If you have a path to a file which is the newly built bundle, you can update it from the Gogo shell as follows:

felix:update <bundleid> file:/path/to/file
refresh

Where <bundleid> is the numeric ID of the bundle that you want to update. The refresh command is needed in case any bundles depend on or import packages from the bundle you are updating; this command will cause the Framework to attempt to re-resolve them using the new dependency.

Neil Bartlett
  • 23,743
  • 4
  • 44
  • 77
  • thanks, I was going to post my own answer but will look into your recipe, it's one line less – 62mkv Mar 30 '18 at 11:36
  • Good to hear you've solved the problem. If you tell me what you had to do, I might be able to identify what was really going wrong. – Neil Bartlett Mar 30 '18 at 12:34
0

I am happy to accept @neil-bartlett's answer, though I have to add some more context:

1) one of the biggest issues I had initially is that a JAR-file in local Maven repo IS NOT THE SAME as an OSGi bundle. In order to create bundle, I had to run mvn bundle:bundle AFTER mvn install. And the bundle got created in target/ folder.

2) afterwards, in a GoGo shell, I could indeed run felix:update <bundle-id> file:C:/Users/blablabla/bundle-SNAPSHOT-2.0.jar, and for some reasons, these days it just works. The exceptions, mentioned in updates to original post, are indeed occurring, but they do not prevent proper installation of an updated bundle.

62mkv
  • 1,444
  • 1
  • 16
  • 28