Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » service lookup fails with plan based deployment(service lookup fails with plan based deployment)
service lookup fails with plan based deployment [message #985657] Thu, 15 November 2012 15:54 Go to next message
Erik Vande Velde is currently offline Erik Vande VeldeFriend
Messages: 82
Registered: September 2012
Member
In my application I've got a mysql datasource that's deployed in a separate 'infrastructure bundle', and published as a javax.sql.DataSource service. Then a second 'database bundle' uses the service from the other bundle to do some db related stuff. When I deploy both bundles from eclipse everything goes fine (to be on the safe side I wait a bit before deploying the second bundle, so I'm sure the first one is active by then). Now, in deployment mode, I've put both bundles in separate plans, to be able to wait a bit in between activating both plans. The problem is that, no matter how long I wait, the second plan/bundle doesn't find the DataSource service:
===
[2012-11-15 16:22:35.643] service-monitor-thread-1 <KE0100W> Reference '&dat
aSource' in bundle 'gwf_plan_1b_db-2-com.fugro.gwf.dbmanager' version '1.0.0' is
waiting for service with filter '(objectClass=javax.sql.DataSource)'.
[2012-11-15 16:23:35.648] service-monitor-thread-1 <KE0100W> Reference '&dat
aSource' in bundle 'gwf_plan_1b_db-2-com.fugro.gwf.dbmanager' version '1.0.0' is
waiting for service with filter '(objectClass=javax.sql.DataSource)'.
[2012-11-15 16:24:35.653] service-monitor-thread-1 <KE0100W> Reference '&dat
aSource' in bundle 'gwf_plan_1b_db-2-com.fugro.gwf.dbmanager' version '1.0.0' is
waiting for service with filter '(objectClass=javax.sql.DataSource)'.
[2012-11-15 16:25:35.658] service-monitor-thread-1 <KE0100W> Reference '&dat
aSource' in bundle 'gwf_plan_1b_db-2-com.fugro.gwf.dbmanager' version '1.0.0' is
waiting for service with filter '(objectClass=javax.sql.DataSource)'.
[2012-11-15 16:26:30.449] http-bio-8080-exec-5 <DE0502E> Start of plan '
gwf_plan_1b_db' version '2.0.0' has taken longer than the configured timeout of
'300' seconds.
[2012-11-15 16:26:30.650] ng DM Context Creation Timer <AG0000E> Application con
text creation failure for bundle 'gwf_plan_1b_db-2-com.fugro.gwf.dbmanager' vers
ion '1.0.0'. org.springframework.context.ApplicationContextException: Applicatio
n context initialization for 'gwf_plan_1b_db-2-com.fugro.gwf.dbmanager' has time
d out waiting for (objectClass=javax.sql.DataSource)
===
Still I can see in the console that the other bundle is ready to offer this service:
===
osgi> bundle 151
gwf_plan_1_init-2-com.fugro.gwf.infrastructure.mysql_1.0.0 [151]
Id=151, Status=ACTIVE Data Root=C:\programs\virgo-tomcat-server-3.5.0.for_gwf_deployed\work\org.eclipse.osgi\bundles\151\data
"Registered Services"
{javax.sql.DataSource}={org.eclipse.gemini.blueprint.bean.name=dataSource, org.springframework.osgi.bean.name=dataSource, osgi.service.blueprint.compname=dataSource, Bundle-SymbolicName=gwf_plan_1_init-2-com.fugro.gwf.infrastructure.mysql, Bundle-Version=1.0.0, service.id=267}
===
THE QUESTION: why doesn't plan/bundle 2 just use the available service ?
Re: service lookup fails with plan based deployment [message #985871 is a reply to message #985657] Fri, 16 November 2012 14:04 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
Are you using scoped plans?
Re: service lookup fails with plan based deployment [message #986151 is a reply to message #985871] Mon, 19 November 2012 08:35 Go to previous messageGo to next message
Erik Vande Velde is currently offline Erik Vande VeldeFriend
Messages: 82
Registered: September 2012
Member
A short response, but a very useful one... Thanks !! I just copied over an existing plan from somewhere and didn't appreciate the importance of that scoped attribute. Now my deployment goes further, but I stumbled on a maven plugin problem. The maven jar plugin tries to combine my OSGi compliant manifest.mf with something he produces himself, and in at least one bundle some parts of my original manifest.mf don't make it to the manifest in the jar. I found out because my exports couldn't be imported by other bundles, the Export-package area was just gone. I reported this to the maven plugin producers, but I guess for the time being I will need a workaround unzipping the jar, injecting my own manifest, and zipping it again with some custom maven task ...
Re: service lookup fails with plan based deployment [message #986214 is a reply to message #986151] Mon, 19 November 2012 13:45 Go to previous messageGo to next message
Florian Waibel is currently offline Florian WaibelFriend
Messages: 166
Registered: June 2010
Senior Member
The maven-jar-plugin offers some configuration options regarding the manifest file:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-jar-plugin</artifactId>
  <version>2.4</version>
  <configuration>
    <archive>
      <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
    </archive>
  </configuration>
</plugin>


Maybe this option fits your needs.
Re: service lookup fails with plan based deployment [message #986222 is a reply to message #986214] Mon, 19 November 2012 13:58 Go to previous message
Erik Vande Velde is currently offline Erik Vande VeldeFriend
Messages: 82
Registered: September 2012
Member
Thanks for your feedback, but I was already using that option. My impression is that the plugin tries to make an hybrid between what you feed it with the manifestFile tag, and what it normally would produce without that tag being present. And I suspect there is a bug in the code producing the hybrid (some random sections being dropped, there might be a logic behind what is dropped exactly, but i don't see that logic yet). The workaround with the unzipping-fixing-zipping of the jar seems to work ...
Previous Topic:Listener for bundle consuming services
Next Topic:II18N message from diffrent bundels
Goto Forum:
  


Current Time: Fri Apr 26 23:37:45 GMT 2024

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

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

Back to the top