You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Erwin Hogeweg <er...@me.com> on 2017/02/23 13:01:32 UTC

DOSGi-1.7.0 - unable to create proxy object

Hi,

I am upgrading a system from CXF-2.7.2 and DOSGi-1.4 to 3.1.1/1.7.0 but I have run into a wall.

Before I start digging in the CXF code, would anyone have an idea why bundleContext.getService() would return a null object for a registered DOSGi service?

This is the remote service description:

  <endpoint-description>
    <property name="objectClass">
      <array>
        <value>com.seecago.service.interfaces.MyService</value>
      </array>
    </property>
    <property name="endpoint.id">http://my_service_host:12345/MyService/</property>
    <property name="service.imported.configs">org.apache.cxf.ws</property>
  </endpoint-description>


The service is registered:

osgi> services (objectClass=*MyService)
{com.seecago.interfaces.MyService}={endpoint.id=http://my_service_host:12345/MyService/, service.imported=true, service.imported.configs=org.apache.cxf.ws, service.id=163, service.bundleid=30, service.scope=bundle}
  "Registered by bundle:" cxf-dosgi-ri-dsw-cxf_1.7.0 [30]
  "No bundles using service."


This is a modified activator to prove that the service is null.

@Activate
public void activate(ComponentContext context){
	BundleContext bc = context.getBundleContext();

	// Added to see what is going on. setMyService() is not called
	if (bc != null){
		ServiceReference<MyService> sr = bc.getServiceReference(MyService.class);
		if (sr != null){
			// verified that sr has correct props here
			MyService ms = bc.getService(sr);
			if (ms == null){
				// Always get here.
				LOG.error("Ouch!");
			}
		}
	}
	LOG.info("Activated.");
}

This is the error msgs Equinox spits out:

!MESSAGE [SCR] Could not get the service object relevant to the reference. One possible reason is a circularity problem. Another possible reason is that BundleContext.getService() returns null. <—— WHICH APPEARS TO BE TRUE
	Details:
	Problematic reference = Reference[name = myService, interface = com.seecago.service.interfaces.MyService, policy = static, cardinality = 1..1, target = null, bind = setMyService, unbind = unsetMyService]
	of service component = com.seecago.client.ui.configuration
...

DOSGi- 1.7.0
CXF - 3.1.1
Equinox- 3.12
J8


Your suggestions are greatly appreciated.


Regards,

Erwin

Re: DOSGi-1.7.0 - unable to create proxy object

Posted by Erwin Hogeweg <er...@me.com>.
Christian,

Well, that is definitely not it. There is only a single version of that interface is both the source and the runtime. Do you have a suggestion on what would be a good a place in the DOSGi/CXF code to start debugging this?

Thanks,

Erwin



> On Feb 23, 2017, at 8:41 AM, Erwin Hogeweg <er...@me.com> wrote:
> 
> Hi Christian,
> 
> Thanks for the quick reply.
> 
>> this points to a class incompatiblity. The servicereference works with the name of the interface "com.seecago.interfaces.MyService" but for getService to work
>> both the client and the service bundle must be bound to the same package com.seecago.interfaces. I suspect that they see different versions of this package.
> 
> 
>> Do you maybe have the interface embedded in one or both of these bundles?
> That was my suspicion as well. I am not aware of any embedded interfaces, but I will double check.
> 
>> You can check this with "package:imports" and "headers" on the bundle ids.
> Will do, thanks again.
> 
> Erwin
> 
>> 
>> Christian
>> 
>> On 23.02.2017 14:01, Erwin Hogeweg wrote:
>>> Hi,
>>> 
>>> I am upgrading a system from CXF-2.7.2 and DOSGi-1.4 to 3.1.1/1.7.0 but I have run into a wall.
>>> 
>>> Before I start digging in the CXF code, would anyone have an idea why bundleContext.getService() would return a null object for a registered DOSGi service?
>>> 
>>> This is the remote service description:
>>> 
>>>   <endpoint-description>
>>>     <property name="objectClass">
>>>       <array>
>>>         <value>com.seecago.service.interfaces.MyService</value>
>>>       </array>
>>>     </property>
>>>     <property name="endpoint.id">http://my_service_host:12345/MyService/</property> <http://my_service_host:12345/MyService/%3C/property%3E>
>>>     <property name="service.imported.configs">org.apache.cxf.ws</property>
>>>   </endpoint-description>
>>> 
>>> 
>>> The service is registered:
>>> 
>>> osgi> services (objectClass=*MyService)
>>> {com.seecago.interfaces.MyService}={endpoint.id=http://my_service_host:12345/MyService/ <http://my_service_host:12345/MyService/>, service.imported=true, service.imported.configs=org.apache.cxf.ws, service.id=163, service.bundleid=30, service.scope=bundle}
>>>   "Registered by bundle:" cxf-dosgi-ri-dsw-cxf_1.7.0 [30]
>>>   "No bundles using service."
>>> 
>>> 
>>> This is a modified activator to prove that the service is null.
>>> 
>>> @Activate
>>> public void activate(ComponentContext context){
>>> 	BundleContext bc = context.getBundleContext();
>>> 
>>> 	// Added to see what is going on. setMyService() is not called
>>> 	if (bc != null){
>>> 		ServiceReference<MyService> sr = bc.getServiceReference(MyService.class);
>>> 		if (sr != null){
>>> 			// verified that sr has correct props here
>>> 			MyService ms = bc.getService(sr);
>>> 			if (ms == null){
>>> 				// Always get here.
>>> 				LOG.error("Ouch!");
>>> 			}
>>> 		}
>>> 	}
>>> 	LOG.info <http://log.info/>("Activated.");
>>> }
>>> 
>>> This is the error msgs Equinox spits out:
>>> 
>>> !MESSAGE [SCR] Could not get the service object relevant to the reference. One possible reason is a circularity problem. Another possible reason is that BundleContext.getService() returns null. <—— WHICH APPEARS TO BE TRUE
>>> 	Details:
>>> 	Problematic reference = Reference[name = myService, interface = com.seecago.service.interfaces.MyService, policy = static, cardinality = 1..1, target = null, bind = setMyService, unbind = unsetMyService]
>>> 	of service component = com.seecago.client.ui.configuration
>>> ...
>>> 
>>> DOSGi- 1.7.0
>>> CXF - 3.1.1
>>> Equinox- 3.12
>>> J8
>>> 
>>> 
>>> Your suggestions are greatly appreciated.
>>> 
>>> 
>>> Regards,
>>> 
>>> Erwin
>> 
>> 
>> -- 
>> Christian Schneider
>> http://www.liquid-reality.de <http://www.liquid-reality.de/>
>> 
>> Open Source Architect
>> http://www.talend.com <http://www.talend.com/>
> 


Re: DOSGi-1.7.0 - unable to create proxy object

Posted by Erwin Hogeweg <er...@me.com>.
Hi Christian,

Thanks for the quick reply.

> this points to a class incompatiblity. The servicereference works with the name of the interface "com.seecago.interfaces.MyService" but for getService to work
> both the client and the service bundle must be bound to the same package com.seecago.interfaces. I suspect that they see different versions of this package.


> Do you maybe have the interface embedded in one or both of these bundles?
That was my suspicion as well. I am not aware of any embedded interfaces, but I will double check.

> You can check this with "package:imports" and "headers" on the bundle ids.
Will do, thanks again.

Erwin

> 
> Christian
> 
> On 23.02.2017 14:01, Erwin Hogeweg wrote:
>> Hi,
>> 
>> I am upgrading a system from CXF-2.7.2 and DOSGi-1.4 to 3.1.1/1.7.0 but I have run into a wall.
>> 
>> Before I start digging in the CXF code, would anyone have an idea why bundleContext.getService() would return a null object for a registered DOSGi service?
>> 
>> This is the remote service description:
>> 
>>   <endpoint-description>
>>     <property name="objectClass">
>>       <array>
>>         <value>com.seecago.service.interfaces.MyService</value>
>>       </array>
>>     </property>
>>     <property name="endpoint.id">http://my_service_host:12345/MyService/</property> <http://my_service_host:12345/MyService/%3C/property%3E>
>>     <property name="service.imported.configs">org.apache.cxf.ws</property>
>>   </endpoint-description>
>> 
>> 
>> The service is registered:
>> 
>> osgi> services (objectClass=*MyService)
>> {com.seecago.interfaces.MyService}={endpoint.id=http://my_service_host:12345/MyService/ <http://my_service_host:12345/MyService/>, service.imported=true, service.imported.configs=org.apache.cxf.ws, service.id=163, service.bundleid=30, service.scope=bundle}
>>   "Registered by bundle:" cxf-dosgi-ri-dsw-cxf_1.7.0 [30]
>>   "No bundles using service."
>> 
>> 
>> This is a modified activator to prove that the service is null.
>> 
>> @Activate
>> public void activate(ComponentContext context){
>> 	BundleContext bc = context.getBundleContext();
>> 
>> 	// Added to see what is going on. setMyService() is not called
>> 	if (bc != null){
>> 		ServiceReference<MyService> sr = bc.getServiceReference(MyService.class);
>> 		if (sr != null){
>> 			// verified that sr has correct props here
>> 			MyService ms = bc.getService(sr);
>> 			if (ms == null){
>> 				// Always get here.
>> 				LOG.error("Ouch!");
>> 			}
>> 		}
>> 	}
>> 	LOG.info <http://log.info/>("Activated.");
>> }
>> 
>> This is the error msgs Equinox spits out:
>> 
>> !MESSAGE [SCR] Could not get the service object relevant to the reference. One possible reason is a circularity problem. Another possible reason is that BundleContext.getService() returns null. <—— WHICH APPEARS TO BE TRUE
>> 	Details:
>> 	Problematic reference = Reference[name = myService, interface = com.seecago.service.interfaces.MyService, policy = static, cardinality = 1..1, target = null, bind = setMyService, unbind = unsetMyService]
>> 	of service component = com.seecago.client.ui.configuration
>> ...
>> 
>> DOSGi- 1.7.0
>> CXF - 3.1.1
>> Equinox- 3.12
>> J8
>> 
>> 
>> Your suggestions are greatly appreciated.
>> 
>> 
>> Regards,
>> 
>> Erwin
> 
> 
> -- 
> Christian Schneider
> http://www.liquid-reality.de <http://www.liquid-reality.de/>
> 
> Open Source Architect
> http://www.talend.com <http://www.talend.com/>


Re: DOSGi-1.7.0 - unable to create proxy object

Posted by Christian Schneider <ch...@die-schneider.net>.
Hi Erwin,

this points to a class incompatiblity. The servicereference works with 
the name of the interface "com.seecago.interfaces.MyService" but for 
getService to work
both the client and the service bundle must be bound to the same package 
com.seecago.interfaces. I suspect that they see different versions of 
this package.

Do you maybe have the interface embedded in one or both of these bundles?

You can check this with "package:imports" and "headers" on the bundle ids.

Christian

On 23.02.2017 14:01, Erwin Hogeweg wrote:
> Hi,
>
> I am upgrading a system from CXF-2.7.2 and DOSGi-1.4 to 3.1.1/1.7.0 
> but I have run into a wall.
>
> Before I start digging in the CXF code, would anyone have an idea why 
> bundleContext.getService() would return a null object for a registered 
> DOSGi service?
>
> This is the remote service description:
>
>   <endpoint-description>
>     <property name="objectClass">
>       <array>
> <value>com.seecago.service.interfaces.MyService</value>
>       </array>
>     </property>
>     <property 
> name="endpoint.id">http://my_service_host:12345/MyService/</property> 
> <http://my_service_host:12345/MyService/%3C/property%3E>
>     <property name="service.imported.configs">org.apache.cxf.ws</property>
>   </endpoint-description>
>
>
> The service is registered:
>
> osgi> services (objectClass=*MyService)
> {com.seecago.interfaces.MyService}={endpoint.id=http://my_service_host:12345/MyService/, 
> service.imported=true, service.imported.configs=org.apache.cxf.ws, 
> service.id=163, service.bundleid=30, service.scope=bundle}
> "Registered by bundle:" cxf-dosgi-ri-dsw-cxf_1.7.0 [30]
>   "No bundles using service."
>
>
> This is a modified activator to prove that the service is null.
>
> @Activate
> public void activate(ComponentContext context){
> BundleContext bc = context.getBundleContext();
>
> // Added to see what is going on. setMyService() is not called
> if (bc != null){
> ServiceReference<MyService> sr = bc.getServiceReference(MyService.class);
> if (sr != null){
> // verified that sr has correct props here
> MyService ms = bc.getService(sr);
> if (ms == null){
> // Always get here.
> LOG.error("Ouch!");
> }
> }
> }
> LOG.info <http://LOG.info>("Activated.");
> }
>
> This is the error msgs Equinox spits out:
>
> !MESSAGE [SCR] Could not get the service object relevant to the 
> reference. One possible reason is a circularity problem. *Another 
> possible reason is that BundleContext.getService() returns null*. <\u2014\u2014 
> WHICH APPEARS TO BE TRUE
> Details:
> Problematic reference = Reference[name = myService, interface = 
> com.seecago.service.interfaces.MyService, policy = static, cardinality 
> = 1..1, target = null, bind = setMyService, unbind = unsetMyService]
> of service component = com.seecago.client.ui.configuration
> ...
>
> DOSGi- 1.7.0
> CXF - 3.1.1
> Equinox- 3.12
> J8
>
>
> Your suggestions are greatly appreciated.
>
>
> Regards,
>
> Erwin


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com