What's needed for a Bundle App to Show Up in Karaf?

143 views
Skip to first unread message

michael...@non.agilent.com

unread,
Jul 7, 2014, 6:49:14 PM7/7/14
to cytoscape...@googlegroups.com

I need some help with understanding when a bundle is valid and shows up in Karaf vs not. What's the minimum a jar must have to show up as a bundle in Karaf?

 

We are trying to obfuscate a bundle app (ENViz) that doesn't even show up as a bundle (e.g., osgi:ls ENViz doesn't show anything). Although the app manager sees and shows it as  installed. The bundle app works fine when unobfuscated. We are calling the obfuscation program (jshrink) using the exec-maven-plugin. The program takes the unobfuscated jar and produces a new obfuscated jar. I've tried turning off all the obfuscation, that doesn't help, so maybe the problem is much more simple and high-level.

 

The unobfuscated version and the obfuscated version seem to have the same META-INF/MANIFEST.MF file.

 

Tim Hull

unread,
Jul 7, 2014, 7:27:14 PM7/7/14
to cytoscape...@googlegroups.com
The one thing that you definitely need is the correct class/package name for the CyActivator (under the Bundle-Activator: header) - if you obfuscated the code, this would have changed from the original source. You might also check for any references to package names that may have changed in the process of running Jshrink.

If that isn't it, do you see any errors relating to the bundle, either on the console or in framework-cytoscape.log (located in the CytoscapeConfiguration/3 directory under your home)? If so, what do they say?

Hope this helps...

Tim


--
You received this message because you are subscribed to the Google Groups "cytoscape-helpdesk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cytoscape-helpd...@googlegroups.com.
To post to this group, send email to cytoscape...@googlegroups.com.
Visit this group at http://groups.google.com/group/cytoscape-helpdesk.
For more options, visit https://groups.google.com/d/optout.

michael...@non.agilent.com

unread,
Jul 7, 2014, 9:16:59 PM7/7/14
to cytoscape...@googlegroups.com

Tim,

 

That's very helpful--I didn't know about the framework-cytoscape.log file. So, what the log claims is that there is no MANIFEST in the jar:

 

2014-07-07 17:46:39,174 [fileinstall-C:\Users\creech/CytoscapeConfiguration/3/apps/installed] ERROR org.apache.felix.fileinstall - Failed to install artifact: C:\Users\creech\CytoscapeConfiguration\3\apps\installed\ENViz-3.1.1.jar

org.osgi.framework.BundleException: The bundle file:/C:/Users/creech/CytoscapeConfiguration/3/apps/installed/ENViz-3.1.1.jar does not have a META-INF/MANIFEST.MF! Make sure, META-INF and MANIFEST.MF are the first 2 entries in your JAR!

               at org.apache.felix.fileinstall.internal.DirectoryWatcher.installOrUpdateBundle(DirectoryWatcher.java:994)

               at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:941)

               at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:854)

               at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:483)

               at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:291)

 

However, when I use winzip to look inside the jar file that works and the one that fails (at the location specified), they both have META-INF/MANIFEST.MF entries that look to have the same information inside them. So does this imply the jar file is formatted in some funny way not readable by felix?

Tim Hull

unread,
Jul 7, 2014, 9:31:17 PM7/7/14
to cytoscape...@googlegroups.com
Did you check if the META-INF and MANIFEST.MF are the first two entries in the JAR? If not, you have to pack the JAR such that this is the case - otherwise it won't work.. There also might be a way to specify a manifest file when using Jshrink (and make it the first entry in the JAR), but I'm not familiar with that tool so I can't say.

The following page describes how to repack a JAR file using the command line:


Let me know if this fixes it...

Tim

michael...@non.agilent.com

unread,
Jul 8, 2014, 1:15:08 PM7/8/14
to cytoscape...@googlegroups.com

Tim,

 

That was very helpful and is exactly my problem. Once again you've really helped me out!

 

The obfuscator built a jar that isn't a correct bundle because the MANIFEST isn't the first entry in the jar. I need to come up with a way to automatically repackage the obfuscated jar as a bundle each time I build our app. I didn't find any maven plugins that do this--does anyone know of anything that does? If I can't find such a maven plugin, I guess I'll write an ANT script that is called by maven to do the repackaging.

Reply all
Reply to author
Forward
0 new messages