felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Moulliard <cmoulli...@gmail.com>
Subject Re: NPE for org.apache.felix.framework.resolver.ResolverImpl.permutateIfNeeded
Date Fri, 15 Jun 2012 06:54:11 GMT
Here is the code from where the error comes from

   @Override
    public Object create(CreationalContext creationalContext) {
        logger.trace("Entering OSGiServiceBean : create() with parameter");
        try {
            BundleContext context = ctx;
            if (context == null) {
                context = FrameworkUtil.getBundle(injectionPoint.getMember()
                        .getDeclaringClass()).getBundleContext();
            }
            DynamicServiceHandler handler =
                                  new DynamicServiceHandler(context,
                                                            ((Class)
type).getName(),
                                                            filter,
                                                            qualifiers,
                                                            timeout);
            Object proxy =
Proxy.newProxyInstance(getClass().getClassLoader(),
                                                  new Class[]
{getBeanClass()},
                                                  handler);
////////////////// Error is generated when we call newProxyInstance
            //memorize if the handler has been allready stored
            if (handlers.containsKey(proxy)) {
                handler.setStored(true);
            } else {
                //map.put() need a correct hashCode() method to use
                //see DynamicServiceHandler
                handlers.put(proxy, handler);
                handler.setStored(true);
            }
            logger.debug("New proxy for {} created", this);
            return proxy;
        }
        catch(Exception e) {
            logger.error("Unable to instantiate {} due to {}", this, e);
            throw new CreationException(e); // NPE is reported here
        }
    }

On Fri, Jun 15, 2012 at 8:46 AM, Charles Moulliard <cmoulliard@gmail.com>wrote:

> Hi Richard,
>
> Version of Felix and Karaf used are :
>
> Karaf
>   Karaf version               2.2.7
>   Karaf home
>  /Users/chmoulli/MyApplications/apache-karaf-2.2.7
>   Karaf base
>  /Users/chmoulli/MyApplications/apache-karaf-2.2.7
>   OSGi Framework              org.apache.felix.framework - 3.0.9
>
> JVM
>   Java Virtual Machine        Java HotSpot(TM) 64-Bit Server VM version
> 20.8-b03-424
>   Version                     1.6.0_33
>
> In our scenario, we use weld-osgi to create for each bundle a CDI
> container. The CDI container depending on the CDI annotations (@Inject,
> ...) discovered in the bundle will instantiate some new beans and add them
> to the class loader. In my case the bundle A = example has a reference to a
> class exported by a bundle B (= CdiCamelContext) and this class
> CdiCamelContext is created using java.lang.reflect.Proxy.**newProxyInstance().
> Remark, this class CdiCamelContext extends a CamelContext class exported by
> another bundle = C. The package B imports well the packages from C.
>
> Regards,
>
> Charles
>
>
>
>
>> On Thu, Jun 14, 2012 at 10:54 PM, Richard S. Hall <heavy@ungoverned.org>wrote:
>>
>>> On 6/14/12 16:44 , Charles Moulliard wrote:
>>>
>>>> Hi,
>>>>
>>>> What could be the reason why we get a NPE at the followoing line
>>>>
>>>
>>> Not sure. A similar issue was reported in:
>>>
>>>    https://issues.apache.org/**jira/browse/FELIX-3003<https://issues.apache.org/jira/browse/FELIX-3003>
>>>
>>> Can you reproduce this? That would make it a lot easier to track down.
>>>
>>> It is also not clear which version of the framework you are using...it
>>> doesn't appear to be 4.0.x.
>>>
>>> -> richard
>>>
>>>
>>>
>>>> Caused by: java.lang.NullPointerException
>>>> at
>>>> org.apache.felix.framework.**resolver.ResolverImpl.**permutateIfNeeded(
>>>> **ResolverImpl.java:1156)
>>>> at
>>>> org.apache.felix.framework.**resolver.ResolverImpl.**
>>>> checkPackageSpaceConsistency(**ResolverImpl.java:1085)
>>>> at
>>>> org.apache.felix.framework.**resolver.ResolverImpl.resolve(**
>>>> ResolverImpl.java:171)
>>>> at org.apache.felix.framework.**Felix$FelixResolver.resolve(**
>>>> Felix.java:4103)
>>>> at
>>>> org.apache.felix.framework.**ModuleImpl.**searchDynamicImports(**
>>>> ModuleImpl.java:1412)
>>>> at
>>>> org.apache.felix.framework.**ModuleImpl.**
>>>> findClassOrResourceByDelegatio**n(ModuleImpl.java:734)
>>>> at org.apache.felix.framework.**ModuleImpl.access$400(**
>>>> ModuleImpl.java:71)
>>>> at
>>>> org.apache.felix.framework.**ModuleImpl$ModuleClassLoader.**
>>>> loadClass(ModuleImpl.java:**1768)
>>>> at java.lang.ClassLoader.**loadClass(ClassLoader.java:**247)
>>>> at java.lang.Class.forName0(**Native Method)
>>>> at java.lang.Class.forName(Class.**java:247)
>>>> at java.lang.reflect.Proxy.**getProxyClass(Proxy.java:349)
>>>> at java.lang.reflect.Proxy.**newProxyInstance(Proxy.java:**581)
>>>>
>>>> Regards,
>>>>
>>>> Charles Moulliard
>>>>
>>>> Apache Committer
>>>>
>>>> Blog : http://cmoulliard.blogspot.com
>>>> Twitter : http://twitter.com/cmoulliard
>>>> Linkedin : http://www.linkedin.com/in/**charlesmoulliard<http://www.linkedin.com/in/charlesmoulliard>
>>>> Skype: cmoulliard
>>>>
>>>>
>>> ------------------------------**------------------------------**
>>> ---------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.**apache.org<users-unsubscribe@felix.apache.org>
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>>
>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message