Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » exporting services via spring configuration not working
exporting services via spring configuration not working [message #1004153] Tue, 22 January 2013 17:17 Go to next message
James Gartner is currently offline James GartnerFriend
Messages: 30
Registered: March 2012
Member
Folks,
I have a bundle ( a DAL ) where I have specified it as a service using the spring xml configuration.
When I deploy this, it gets resolved, and I can START it, making it active.

When I inspect it, I get that there are "No registered Services" from this, so when I try to USE it from another bundle, I get a NullPointerReference when trying to get the service.

How do I debug the registration of the service inside the Virgo container when the setup is via the spring xml config file?

Any help greatly appreciated...
Re: exporting services via spring configuration not working [message #1004839 is a reply to message #1004153] Thu, 24 January 2013 00:56 Go to previous messageGo to next message
Eduardo Frazão is currently offline Eduardo FrazãoFriend
Messages: 123
Registered: January 2012
Senior Member
Hi James.

You can inspect exported services in the Virgo Web Admin Console (localhost:8080/admin)

Or, you can enable telnet server, conect to it, and use the Equinox Console as well.

Enable it in : repository/ext/osgi.console.properties

And later

telnet localhost 2501 (default port)
> ss (to show status and bundle ids)

> services (objectClass="com.mypackage.MyService")

Will find an service that implements this interface.

Re: exporting services via spring configuration not working [message #1005324 is a reply to message #1004839] Thu, 24 January 2013 21:22 Go to previous messageGo to next message
James Gartner is currently offline James GartnerFriend
Messages: 30
Registered: March 2012
Member
Thanks -- it shows NO service that matches what I expect. It looks like the <osgi:service> items in the spring configuration are not causing this to be registered as a service...
Re: exporting services via spring configuration not working [message #1005347 is a reply to message #1005324] Thu, 24 January 2013 23:13 Go to previous messageGo to next message
Eduardo Frazão is currently offline Eduardo FrazãoFriend
Messages: 123
Registered: January 2012
Senior Member
Its is weird. Where is located the spring config in your project? Can you post all configuration?
Re: exporting services via spring configuration not working [message #1005760 is a reply to message #1005347] Mon, 28 January 2013 15:49 Go to previous messageGo to next message
James Gartner is currently offline James GartnerFriend
Messages: 30
Registered: March 2012
Member
OK, I have the spring config.xml in ...target/classes/META-INF/spring/config.xml
It has
....
    <bean id="myDriver" class="com.nnnnnn.msp.my_service.dao.MyDriverImpl">
	    <property name="documentTypeMapping" ref="documentTypeMapping" />
    </bean>
...    		     
    <osgi:service id="epiDaoOSGIService" ref="myDriver"
       interface="com.nnnnnn.msp.my_service.dao.MyDriver" auto-export="interfaces" >
    </osgi:service>


Re: exporting services via spring configuration not working [message #1006562 is a reply to message #1005760] Thu, 31 January 2013 18:12 Go to previous messageGo to next message
Eduardo Frazão is currently offline Eduardo FrazãoFriend
Messages: 123
Registered: January 2012
Senior Member
This tag means to have an ">" at the end of auto export.

<osgi:service id="epiDaoOSGIService" ref="myDriver"
       interface="com.nnnnnn.msp.my_service.dao.MyDriver" auto-export="interfaces" >
    </osgi:service>


Could try to change for that:

<osgi:service id="epiDaoOSGIService" ref="myDriver" interface="com.nnnnnn.msp.my_service.dao.MyDriver" />


As you are already declaring the implemented service interface, you do not need to declare the autoexport.

Do you use the osgi xml namespace?

This is a context config of a bundle here, that is working as expected:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:osgi="http://www.springframework.org/schema/osgi"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
       http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"
       default-init-method="init">
       
	<bean id="i18NServiceImpl" class="br.com.autmix.shared.spi.impl.i18n.I18NServiceImpl" />
	
	<osgi:service ref="i18NServiceImpl" interface="br.com.autmix.shared.spi.i18n.I18NService" />

</beans>

[Updated on: Thu, 31 January 2013 18:16]

Report message to a moderator

Re: exporting services via spring configuration not working [message #1006567 is a reply to message #1006562] Thu, 31 January 2013 19:26 Go to previous messageGo to next message
James Gartner is currently offline James GartnerFriend
Messages: 30
Registered: March 2012
Member
Thanks for this -- I did the changes, but I still see "No Registered services"

This is the set I WAS using:
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">

SO I updated to the set that you indicated.
I also changed the line to:
<osgi:service ref="epiDriver" interface="com.nnnnnnn.msp.my_service.dao.MyDriver" />

When I do the services bundleId, I still see "No registered services", No services in use, but the bundle is started.
Re: exporting services via spring configuration not working [message #1006738 is a reply to message #1006567] Fri, 01 February 2013 16:19 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry SklyutFriend
Messages: 279
Registered: January 2010
Senior Member
James, what version of Virgo are you deploying this to?
Re: exporting services via spring configuration not working [message #1007573 is a reply to message #1006738] Wed, 06 February 2013 14:53 Go to previous messageGo to next message
James Gartner is currently offline James GartnerFriend
Messages: 30
Registered: March 2012
Member
Virgo 3.0.3
Re: exporting services via spring configuration not working [message #1007676 is a reply to message #1007573] Thu, 07 February 2013 02:31 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry SklyutFriend
Messages: 279
Registered: January 2010
Senior Member
James,

Would you mind posting MANIFEST.MF for this bundle? Do you see any errors in the logs? Is the bundle actually active?

Thanks
Dmitry
Re: exporting services via spring configuration not working [message #1021694 is a reply to message #1007676] Wed, 20 March 2013 14:27 Go to previous message
James Gartner is currently offline James GartnerFriend
Messages: 30
Registered: March 2012
Member
Sorry for this VERY late reply (I was pulled into another project for the past month and had no time for this).
HERE is the part of the config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"
default-init-method="init">
.....
<bean id="epiDriver" class="com.moodys.msp.epi_service.dao.EpiDriverImpl">
<property name="documentTypeMapping" ref="documentTypeMapping" />
</bean>
.....

<osgi:service ref="epiDriver" interface="com.moodys.msp.epi_service.dao.EpiDriver" />

HERE is the manifest for the bundle:

Manifest-Version: 1.0
Bnd-LastModified: 1359659639062
Build-Jdk: 1.6.0_31
Built-By: gartnerj
Bundle-ClassPath: .,slf4j-log4j12-1.6.1.jar,slf4j-api-1.6.1.jar
Bundle-ManifestVersion: 2
Bundle-Name: EPI DAO - IMPL
Bundle-SymbolicName: com.moodys.msp.epi_service-dao-jdbc-impl
Bundle-Vendor: Moody's
Bundle-Version: 1.0.0.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Embed-Dependency: *;scope=compile|runtime;inline=false
Embed-Transitive: false
Embedded-Artifacts: slf4j-log4j12-1.6.1.jar;g="org.slf4j";a="slf4j-log4j
12";v="1.6.1",slf4j-api-1.6.1.jar;g="org.slf4j";a="slf4j-api";v="1.6.1"
Export-Package: com.moodys.msp.epi_service.dao;uses:="com.moodys.msp.epi
_service.exception,org.springframework.beans.factory.annotation,com.moo
dys.msp.epi_service.util.dao";version="1.0.0.SNAPSHOT",com.moodys.msp.e
pi_service.dataobject;uses:="com.moodys.msp.epi_service.dao,com.moodys.
msp.epi_service.util.dao,com.moodys.msp.epi_service.exception,org.sprin
gframework.jdbc.core,com.moodys.msp.epi_service.util,org.springframewor
k.dao";version="1.0.0.SNAPSHOT"
Import-Package: com.moodys.msp.epi_service.dao;version="[1.0,2)",com.moo
dys.msp.epi_service.exception;version="[1.0,2)",com.moodys.msp.epi_serv
ice.util;version="[1.0,2)",com.moodys.msp.epi_service.util.dao;version=
"[1.0,2)",com.sybase.jdbc3.jdbc;version="[6.0,7)",org.apache.commons.db
cp;version="[1.2,2)",org.apache.log4j,org.springframework.beans.factory
.annotation;version="[3.0,4)",org.springframework.dao;version="[3.0,4)"
,org.springframework.jdbc.core;version="[3.0,4)",org.springframework.jd
bc.datasource;version="[3.0,4)"
Tool: Bnd-1.50.0

The bundles are ACTIVE, everything in the log appears to be fine here is the log from when I STARTED the bundle:

Bundle com.moodys.msp.epi_service-dao-jdbc-impl_1.0.0.SNAPSHOT, BundleEvent STARTED
Started bundle 'com.moodys.msp.epi_service-dao-jdbc-impl' version '1.0.0.SNAPSHOT'.


Nothing fails until I try to use the original service which uses this dao bundle.
Previous Topic:Deploying Multiple Bundles at Once
Next Topic:LDAP over SSL keystore
Goto Forum:
  


Current Time: Fri Apr 19 06:40:48 GMT 2024

Powered by FUDForum. Page generated in 0.02942 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top