This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 238494

Summary: Unable to run a felix osgi bundle with my API
Product: projects Reporter: karamba84
Component: Maven OSGi bundlesAssignee: Milos Kleint <mkleint>
Status: RESOLVED INVALID    
Severity: normal    
Priority: P1    
Version: 7.4   
Hardware: PC   
OS: Windows 7 x64   
Issue Type: DEFECT Exception Reporter:

Description karamba84 2013-11-18 09:25:01 UTC
Hi

I dont know if this is related to Netbeans or to Felix, so i thought
lets mail it to the mailing list and see what others say

I have a project called SoundBox which also has a API Bundle.
It worked a couple of months ago, i dont know what i changed. But as
soon as i create a new OSGi Bundle in Netbeans and add the API, i can
not start the bundle. I get an exception from Felix(?):

main:
[propertyfile] Creating new property file:
G:\data\code\soundbox\SoundBox\target\run.properties
     [java] Auto-properties install:
file:/G:/data/code/soundbox/SoundBox-CoreLibrary/target/classes/
(org.osgi.framework.BundleException: Unable to cache bundle:
file:/G:/data/code/soundbox/SoundBox-CoreLibrary/target/classes/ -
java.util.zip.ZipException: error in opening zip file)
     [java] org.osgi.framework.BundleException: Unable to cache
bundle: file:/G:/data/code/soundbox/SoundBox-CoreLibrary/target/classes/
     [java] 	at
org.apache.felix.framework.Felix.installBundle(Felix.java:2870)
     [java] 	at
org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:165)
     [java] 	at
org.apache.felix.main.AutoProcessor.processAutoProperties(AutoProcessor.java:296)
     [java] 	at
org.apache.felix.main.AutoProcessor.process(AutoProcessor.java:79)
     [java] 	at org.apache.felix.main.Main.main(Main.java:292)
     [java] Caused by: java.util.zip.ZipException: error in opening
zip file
     [java] 	at java.util.zip.ZipFile.open(Native Method)
     [java] 	at java.util.zip.ZipFile.<init>(ZipFile.java:220)
     [java] 	at java.util.zip.ZipFile.<init>(ZipFile.java:150)
     [java] 	at java.util.zip.ZipFile.<init>(ZipFile.java:164)
     [java] 	at
org.apache.felix.framework.util.SecureAction.openZipFile(SecureAction.java:623)
     [java] 	at
org.apache.felix.framework.util.WeakZipFileFactory$WeakZipFile.<init>(WeakZipFileFactory.java:185)
     [java] 	at
org.apache.felix.framework.util.WeakZipFileFactory$WeakZipFile.<init>(WeakZipFileFactory.java:168)
     [java] 	at
org.apache.felix.framework.util.WeakZipFileFactory.create(WeakZipFileFactory.java:71)
     [java] 	at
org.apache.felix.framework.cache.JarRevision.<init>(JarRevision.java:84)
     [java] 	at
org.apache.felix.framework.cache.BundleArchive.createRevisionFromLocation(BundleArchive.java:878)
     [java] 	at
org.apache.felix.framework.cache.BundleArchive.reviseInternal(BundleArchive.java:550)
     [java] 	at
org.apache.felix.framework.cache.BundleArchive.<init>(BundleArchive.java:153)
     [java] 	at
org.apache.felix.framework.cache.BundleCache.create(BundleCache.java:277)
     [java] 	at
org.apache.felix.framework.Felix.installBundle(Felix.java:2866)
     [java] 	... 4 more
     [java] Auto-properties start:
file:/G:/data/code/soundbox/SoundBox-CoreLibrary/target/classes/
(org.osgi.framework.BundleException: Unable to cache bundle:
file:/G:/data/code/soundbox/SoundBox-CoreLibrary/target/classes/ -
java.util.zip.ZipException: error in opening zip file)
     [java]
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
: Enabling SLF4J API support.
     [java]
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
: Enabling Jakarta Commons Logging API support.
     [java]
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
: Enabling Log4J API support.
     [java]
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
: Enabling Avalon Logger API support.
     [java]
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
: Enabling JULI Logger API support.
     [java]
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
: Enabling SLF4J API support.
     [java]
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
: Enabling Jakarta Commons Logging API support.
     [java]
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
: Enabling Log4J API support.
     [java]
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
: Enabling Avalon Logger API support.
     [java]
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
: Enabling JULI Logger API support.

I just updated the API here:
https://github.com/olze/SoundBox-CoreLibrary.git,

So if someone could try to check it out, create a new osgi bundle with
an Activator, add the API as dependency and start it. Then the error
should also be thrown.

Regards,
Oli
Comment 1 Milos Kleint 2013-11-22 07:07:31 UTC
apparently felix cannot cope with the inter-project links created with Compile on Save turned on. We replace the repository jars with target/classes folders (effectively simulating a reactor build)

that's where
file:/G:/data/code/soundbox/SoundBox-CoreLibrary/target/classes/ 
comes from.

Disabling CoS on the project (or all projects) should help

http://wiki.netbeans.org/FaqCompileOnSave#Using_Compile_on_Save_in_Maven_Projects
Comment 2 karamba84 2013-11-23 20:47:47 UTC
Thanks. But now i get another error/warning.
When i run my application, it does not go into the activator.java
When i create a new maven osgi bundle, i get:

main:
[propertyfile] Creating new property file: C:\Users\oli\Documents\NetBeansProjects\Test\target\run.properties
     [java] org.osgi.framework.BundleException: Unresolved constraint in bundle org.dyndns.soundi.SoundBox-API [1]: Unable to resolve 1.0: mERROR: Bundle org.dyndns.soundi.SoundBox-API [1] Error starting file:/C:/Users/oli/.m2/repository/org/dyndns/soundi/SoundBox-APIissing requirement [1.0] osgi.wiring.package; (osgi.wiring.package=org.dyndns.soundi.soundboxcorelibrary)
     [java] 	at org.apache.felix./1.0-SNAPSHOT/SoundBox-API-1.0-SNAPSHOT.jar (org.osgi.framework.BundleException: Unresolved constraint in bundle org.dyndns.sounframework.Felix.resolveBundleRevision(Felix.java:3974)
     [java] 	at org.apache.felix.framework.Felix.startBundle(Felix.java:2037)
     [java] 	at odi.SoundBox-API [1]: Unable to resolve 1.0: missing requirement [1.0] osgi.wiring.package; (osgi.wiring.package=org.dyndns.soundrg.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1291)
     [java] 	at org.apache.felix.framework.FrameworkStartLevelImpl.runi.soundboxcorelibrary))
     [java] hi
     [java] (FrameworkStartLevelImpl.java:304)
     [java] 	at java.lang.Thread.run(Thread.java:744)

So the output is pretty messed up. Also, i dont understand whats now wrong. Because the API has no activator and no dependency (except the OSGi one).
Should i file a new bug or do you see whats wrong?
Comment 3 Milos Kleint 2013-11-27 14:14:35 UTC
(In reply to karamba84 from comment #2)
> Thanks. But now i get another error/warning.
> When i run my application, it does not go into the activator.java
> When i create a new maven osgi bundle, i get:
> 
> main:
> [propertyfile] Creating new property file:
> C:\Users\oli\Documents\NetBeansProjects\Test\target\run.properties
>      [java] org.osgi.framework.BundleException: Unresolved constraint in
> bundle org.dyndns.soundi.SoundBox-API [1]: Unable to resolve 1.0: mERROR:
> Bundle org.dyndns.soundi.SoundBox-API [1] Error starting
> file:/C:/Users/oli/.m2/repository/org/dyndns/soundi/SoundBox-APIissing
> requirement [1.0] osgi.wiring.package;
> (osgi.wiring.package=org.dyndns.soundi.soundboxcorelibrary)
>      [java] 	at org.apache.felix./1.0-SNAPSHOT/SoundBox-API-1.0-SNAPSHOT.jar
> (org.osgi.framework.BundleException: Unresolved constraint in bundle
> org.dyndns.sounframework.Felix.resolveBundleRevision(Felix.java:3974)
>      [java] 	at org.apache.felix.framework.Felix.startBundle(Felix.java:2037)
>      [java] 	at odi.SoundBox-API [1]: Unable to resolve 1.0: missing
> requirement [1.0] osgi.wiring.package;
> (osgi.wiring.package=org.dyndns.soundrg.apache.felix.framework.Felix.
> setActiveStartLevel(Felix.java:1291)
>      [java] 	at
> org.apache.felix.framework.FrameworkStartLevelImpl.runi.soundboxcorelibrary))
>      [java] hi
>      [java] (FrameworkStartLevelImpl.java:304)
>      [java] 	at java.lang.Thread.run(Thread.java:744)
> 
> So the output is pretty messed up. Also, i dont understand whats now wrong.
> Because the API has no activator and no dependency (except the OSGi one).
> Should i file a new bug or do you see whats wrong?

The output being message up is unfortunately outside of our hands.

when spawning the maven build JVM, we use         ProcessBuilder.redirectErrorStream(true); call to make sure error and std outputs are merged on the side of the process for us. So it's either the jdk messing up, or more likely the maven plugin/ant task executing.

In terms what the error means, I'm not sure, it looks like some dependency bundles are missing or a version mismatch.

That no longer appears to be netbeans codebase related though.