[jira] [Created] (FELIX-6156) Not able to find class in commons-logging bundle

2019-07-03 Thread uday ogra (JIRA)
uday ogra created FELIX-6156:


 Summary: Not able to find class in commons-logging bundle
 Key: FELIX-6156
 URL: https://issues.apache.org/jira/browse/FELIX-6156
 Project: Felix
  Issue Type: Bug
Reporter: uday ogra


I am using commons-jcs-core-2.1 which internally has dependency on 
commons-logging-1.2. In both the jars I have kept export-package as * and 
import-package as *;resolution:=optional in their corresponding Manifest.mf.

When I run the code which uses JCS library I am getting this error:

Caused by: java.lang.ClassNotFoundException: 
org.apache.commons.logging.LogFactory not found by commons-jcs-core [3]
 at 
org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1597)
 at 
org.apache.felix.framework.BundleWiringImpl.access$300(BundleWiringImpl.java:79)
 at 
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1982)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

 

I am not sure why is LogFactory class not visible to JCS code when 
commons-logging is exporting all the packages.I am starting commons-logging 
bundle first followed by commons-jcs-core. Any idea what am I missing?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (FELIX-6157) Converter build fails with Java 12

2019-07-03 Thread David Bosschaert (JIRA)
David Bosschaert created FELIX-6157:
---

 Summary: Converter build fails with Java 12
 Key: FELIX-6157
 URL: https://issues.apache.org/jira/browse/FELIX-6157
 Project: Felix
  Issue Type: Improvement
  Components: Converter
Affects Versions: converter-1.0.8
Reporter: David Bosschaert


When I build the converter project with Java 12 I get a lot of failures, see 
below.
These problems don't exist with Java 11. This needs to be investigated and 
fixed.

 
{code:java}
[INFO] ---
[INFO]  T E S T S
[INFO] ---
[INFO] Running org.osgi.util.converter.UtilTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.028 s 
- in org.osgi.util.converter.UtilTest
[INFO] Running org.osgi.util.converter.ConverterBuilderTest
[ERROR] Tests run: 9, Failures: 1, Errors: 0, Skipped: 3, Time elapsed: 0.046 s 
<<< FAILURE! - in org.osgi.util.converter.ConverterBuilderTest
[ERROR] testWildcardAdapter1(org.osgi.util.converter.ConverterBuilderTest)  
Time elapsed: 0.041 s  <<< FAILURE!
org.junit.ComparisonFailure: expected:<[1]> but was:<[describeConstable]>
at 
org.osgi.util.converter.ConverterBuilderTest.testWildcardAdapter1(ConverterBuilderTest.java:192)

[INFO] Running org.osgi.util.converter.ConverterTest
[ERROR] Tests run: 77, Failures: 6, Errors: 13, Skipped: 0, Time elapsed: 0.104 
s <<< FAILURE! - in org.osgi.util.converter.ConverterTest
[ERROR] testCustomErrorHandling(org.osgi.util.converter.ConverterTest)  Time 
elapsed: 0.001 s  <<< ERROR!
org.osgi.util.converter.ConversionException: Cannot convert 12 to class 
java.lang.Integer
at 
org.osgi.util.converter.ConverterTest.testCustomErrorHandling(ConverterTest.java:495)

[ERROR] 
testFromArrayToGenericOrderPreservingSet(org.osgi.util.converter.ConverterTest) 
 Time elapsed: 0.001 s  <<< ERROR!
java.lang.ClassCastException: class java.lang.String cannot be cast to class 
java.lang.Long (java.lang.String and java.lang.Long are in module java.base of 
loader 'bootstrap')
at 
org.osgi.util.converter.ConverterTest.testFromArrayToGenericOrderPreservingSet(ConverterTest.java:313)

[ERROR] testDTOFieldShadowing(org.osgi.util.converter.ConverterTest)  Time 
elapsed: 0.006 s  <<< FAILURE!
java.lang.AssertionError: expected:<{ping=test, count=THREE, pong=0, 
embedded=null}> but was:<{count=describeConstable, pong=describeConstable, 
embedded=null, ping=test}>
at 
org.osgi.util.converter.ConverterTest.testDTOFieldShadowing(ConverterTest.java:874)

[ERROR] testEnums(org.osgi.util.converter.ConverterTest)  Time elapsed: 0.001 s 
 <<< ERROR!
org.osgi.util.converter.ConversionException: Cannot convert [] to class 
org.osgi.util.converter.ConverterTest$TestEnum
at 
org.osgi.util.converter.ConverterTest.testEnums(ConverterTest.java:212)

[ERROR] testFromUnknownDataTypeViaString(org.osgi.util.converter.ConverterTest) 
 Time elapsed: 0 s  <<< ERROR!
org.osgi.util.converter.ConversionException: Cannot convert 1234 to class 
java.lang.Integer
at 
org.osgi.util.converter.ConverterTest.testFromUnknownDataTypeViaString(ConverterTest.java:246)

[ERROR] testCharArrayConversion(org.osgi.util.converter.ConverterTest)  Time 
elapsed: 0.001 s  <<< FAILURE!
org.junit.internal.ArrayComparisonFailure: arrays first differed at element 
[0]; expected:<> but was:
at 
org.osgi.util.converter.ConverterTest.testCharArrayConversion(ConverterTest.java:342)
Caused by: java.lang.AssertionError: expected:<> but was:
at 
org.osgi.util.converter.ConverterTest.testCharArrayConversion(ConverterTest.java:342)

[ERROR] testPrefixDTO(org.osgi.util.converter.ConverterTest)  Time elapsed: 
0.001 s  <<< ERROR!
org.osgi.util.converter.ConversionException: Cannot create DTO class 
org.osgi.util.converter.PrefixDTO
at 
org.osgi.util.converter.ConverterTest.testPrefixDTO(ConverterTest.java:1288)
Caused by: org.osgi.util.converter.ConversionException: Cannot convert 327 to 
class java.lang.Long
at 
org.osgi.util.converter.ConverterTest.testPrefixDTO(ConverterTest.java:1288)

[ERROR] testFromGenericSetToLinkedList(org.osgi.util.converter.ConverterTest)  
Time elapsed: 0.001 s  <<< FAILURE!
java.lang.AssertionError: expected:<[123, 456]> but was:<[describeConstable, 
describeConstable]>
at 
org.osgi.util.converter.ConverterTest.testFromGenericSetToLinkedList(ConverterTest.java:302)

[ERROR] testDefaultValue(org.osgi.util.converter.ConverterTest)  Time elapsed: 
0 s  <<< ERROR!
org.osgi.util.converter.ConversionException: Cannot convert 12 to class 
java.lang.Long
at 
org.osgi.util.converter.ConverterTest.testDefaultValue(ConverterTest.java:723)

[ERROR] testDTONameMangling(org.osgi.util.converter.ConverterTest)  Time 
elapsed: 0.001 s  <<< ERROR!
org.osgi.util.converter.ConversionException: Cannot

Re: svn commit: r1862491 - in /felix/trunk/scr/src: main/java/org/apache/felix/scr/impl/ main/java/org/apache/felix/scr/impl/config/ main/java/org/apache/felix/scr/impl/manager/ main/java/org/apache/f

2019-07-03 Thread David Jencks
Would it be a good idea to start the serialized metadata file with a version 
number so when you discover a better format old format data can be ignored 
rather than causing a read error?

How much speedup and size reduction do you get from this binary format compared 
to say one json file as the cache?

Thanks
David Jencks 

Sent from my iPhone

> On Jul 3, 2019, at 9:35 AM, tjwat...@apache.org wrote:
> 
> Author: tjwatson
> Date: Wed Jul  3 16:35:54 2019
> New Revision: 1862491
> 
> URL: http://svn.apache.org/viewvc?rev=1862491&view=rev
> Log:
> FELIX-6155 - Add caching of service component metadata
> 
> By default the caching is disabled.  The configuration property (or
> framework launch property) ds.cache.metadata can be set to the string
> "true" to enable the support.  Unfortunately dynamically setting this
> with config admin is problematic because the cache is read at activation
> time currently.  This could be enhanced to read the cache any time the
> value is set to true dynamically.  For now it is required to be set from
> the start with a system or framework launch property
> 
> Added:
>
> felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/metadata/MetadataStoreHelper.java
> Modified:
>felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/Activator.java
>
> felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java
>
> felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ScrConfigurationImpl.java
>
> felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ScrConfiguration.java
>
> felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/metadata/ComponentMetadata.java
>
> felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/metadata/ReferenceMetadata.java
>
> felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/metadata/ServiceMetadata.java
>
> felix/trunk/scr/src/test/java/org/apache/felix/scr/impl/logger/MockScrLogger.java
> 
> Modified: 
> felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/Activator.java
> URL: 
> http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/Activator.java?rev=1862491&r1=1862490&r2=1862491&view=diff
> ==
> --- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/Activator.java 
> (original)
> +++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/Activator.java 
> Wed Jul  3 16:35:54 2019
> @@ -18,9 +18,24 @@
>  */
> package org.apache.felix.scr.impl;
> 
> +import java.io.BufferedInputStream;
> +import java.io.BufferedOutputStream;
> +import java.io.DataInputStream;
> +import java.io.DataOutputStream;
> +import java.io.File;
> +import java.io.FileInputStream;
> +import java.io.FileOutputStream;
> +import java.io.IOException;
> +import java.util.ArrayList;
> +import java.util.Collections;
> import java.util.HashMap;
> +import java.util.HashSet;
> import java.util.List;
> import java.util.Map;
> +import java.util.Map.Entry;
> +import java.util.Set;
> +import java.util.concurrent.ConcurrentHashMap;
> +import java.util.concurrent.ConcurrentMap;
> import java.util.concurrent.TimeUnit;
> import java.util.concurrent.locks.Lock;
> import java.util.concurrent.locks.ReentrantLock;
> @@ -28,9 +43,14 @@ import java.util.concurrent.locks.Reentr
> import org.apache.felix.scr.impl.config.ScrConfigurationImpl;
> import org.apache.felix.scr.impl.inject.ClassUtils;
> import org.apache.felix.scr.impl.logger.ScrLogger;
> +import org.apache.felix.scr.impl.manager.ComponentHolder;
> +import org.apache.felix.scr.impl.metadata.ComponentMetadata;
> +import org.apache.felix.scr.impl.metadata.MetadataStoreHelper.MetaDataReader;
> +import org.apache.felix.scr.impl.metadata.MetadataStoreHelper.MetaDataWriter;
> import org.apache.felix.scr.impl.runtime.ServiceComponentRuntimeImpl;
> import org.osgi.framework.Bundle;
> import org.osgi.framework.BundleContext;
> +import org.osgi.framework.BundleEvent;
> import org.osgi.framework.Constants;
> import org.osgi.framework.ServiceRegistration;
> import org.osgi.framework.wiring.BundleRevision;
> @@ -75,6 +95,8 @@ public class Activator extends AbstractE
> 
> private ComponentCommands m_componentCommands;
> 
> +private ConcurrentMap> 
> m_componentMetadataStore;
> +
> public Activator()
> {
> m_configuration = new ScrConfigurationImpl( this );
> @@ -102,6 +124,8 @@ public class Activator extends AbstractE
> 
> public void restart(boolean globalExtender)
> {
> +m_componentMetadataStore = load(m_context, logger,
> +m_configuration.cacheMetadata());
> BundleContext context = m_globalContext;
> if ( globalExtender )
> {
> @@ -182,6 +206,136 @@ public class Activator extends AbstractE
> {
> super.stop( context );
> m_configuration.stop();
> +store(m_componentMetadataStore, context, logger, 
> m_configuration.cacheMetadata());
> +}
> +
> +@

Re: svn commit: r1862491 - in /felix/trunk/scr/src: main/java/org/apache/felix/scr/impl/ main/java/org/apache/felix/scr/impl/config/ main/java/org/apache/felix/scr/impl/manager/ main/java/org/apache/f

2019-07-03 Thread Thomas Watson
Hi David,

Yes, I should have added a version number as the first entry into the
serialized data.  I will add one, thanks for the catch!

I have not compared to using some other more standard format.  I worry
about json in particular because then I need a json parser, and then I also
need to convert the string representation from the json values into the
proper data types used in DS metadata.  I admit that I have not dealt with
json parsing much, but I have doubts that would come for free and it would
make the file larger requiring more IO.  Here I am trying to get all the
possible gain I can and even losing 10 ms would not be worth it to me for
my purposes.

Tom.

On Wed, Jul 3, 2019 at 3:20 PM David Jencks 
wrote:

> Would it be a good idea to start the serialized metadata file with a
> version number so when you discover a better format old format data can be
> ignored rather than causing a read error?
>
> How much speedup and size reduction do you get from this binary format
> compared to say one json file as the cache?
>
> Thanks
> David Jencks
>
> Sent from my iPhone
>
> > On Jul 3, 2019, at 9:35 AM, tjwat...@apache.org wrote:
> >
> > Author: tjwatson
> > Date: Wed Jul  3 16:35:54 2019
> > New Revision: 1862491
> >
> > URL: http://svn.apache.org/viewvc?rev=1862491&view=rev
> > Log:
> > FELIX-6155 - Add caching of service component metadata
> >
> > By default the caching is disabled.  The configuration property (or
> > framework launch property) ds.cache.metadata can be set to the string
> > "true" to enable the support.  Unfortunately dynamically setting this
> > with config admin is problematic because the cache is read at activation
> > time currently.  This could be enhanced to read the cache any time the
> > value is set to true dynamically.  For now it is required to be set from
> > the start with a system or framework launch property
> >
> > Added:
> >
> felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/metadata/MetadataStoreHelper.java
> > Modified:
> >felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/Activator.java
> >
> felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java
> >
> felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ScrConfigurationImpl.java
> >
> felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ScrConfiguration.java
> >
> felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/metadata/ComponentMetadata.java
> >
> felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/metadata/ReferenceMetadata.java
> >
> felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/metadata/ServiceMetadata.java
> >
> felix/trunk/scr/src/test/java/org/apache/felix/scr/impl/logger/MockScrLogger.java
> >
> > Modified:
> felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/Activator.java
> > URL:
> http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/Activator.java?rev=1862491&r1=1862490&r2=1862491&view=diff
> >
> ==
> > ---
> felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/Activator.java
> (original)
> > +++
> felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/Activator.java Wed
> Jul  3 16:35:54 2019
> > @@ -18,9 +18,24 @@
> >  */
> > package org.apache.felix.scr.impl;
> >
> > +import java.io.BufferedInputStream;
> > +import java.io.BufferedOutputStream;
> > +import java.io.DataInputStream;
> > +import java.io.DataOutputStream;
> > +import java.io.File;
> > +import java.io.FileInputStream;
> > +import java.io.FileOutputStream;
> > +import java.io.IOException;
> > +import java.util.ArrayList;
> > +import java.util.Collections;
> > import java.util.HashMap;
> > +import java.util.HashSet;
> > import java.util.List;
> > import java.util.Map;
> > +import java.util.Map.Entry;
> > +import java.util.Set;
> > +import java.util.concurrent.ConcurrentHashMap;
> > +import java.util.concurrent.ConcurrentMap;
> > import java.util.concurrent.TimeUnit;
> > import java.util.concurrent.locks.Lock;
> > import java.util.concurrent.locks.ReentrantLock;
> > @@ -28,9 +43,14 @@ import java.util.concurrent.locks.Reentr
> > import org.apache.felix.scr.impl.config.ScrConfigurationImpl;
> > import org.apache.felix.scr.impl.inject.ClassUtils;
> > import org.apache.felix.scr.impl.logger.ScrLogger;
> > +import org.apache.felix.scr.impl.manager.ComponentHolder;
> > +import org.apache.felix.scr.impl.metadata.ComponentMetadata;
> > +import
> org.apache.felix.scr.impl.metadata.MetadataStoreHelper.MetaDataReader;
> > +import
> org.apache.felix.scr.impl.metadata.MetadataStoreHelper.MetaDataWriter;
> > import org.apache.felix.scr.impl.runtime.ServiceComponentRuntimeImpl;
> > import org.osgi.framework.Bundle;
> > import org.osgi.framework.BundleContext;
> > +import org.osgi.framework.BundleEvent;
> > import org.osgi.framework.Constants;
> > import org.osgi.framework.ServiceRegistration;
> > import org.osgi.framework.wiring.BundleRevision;
> > @