View Full Version : DM server bundle init-method
bc56
Mar 19th, 2009, 01:54 PM
All I have followed the threads on using the init-method in your beans to try and startup your bean once the server deploys your bundle. But my bundle gets deployed but it does not call the init-method is there anything else one should do in order to get the dm server to start my bean ?
oleg.zhurakousky
Mar 19th, 2009, 02:03 PM
Could you post your configuration as well as its locations (in case you out it in the wrong spot).
When you say bundle is deployed, do you see it ACTIVE via OSGi console?
What threads you are referring too? "init-method" is plain non-osgi Spring which means OSGi can not affect it. Does you bean get properly bootstrpped (init-method being eecuted) in non-osgi environment?
bc56
Mar 19th, 2009, 02:23 PM
Sorry yes me posting the config would help :)
so in the META-INF/spring/apptx*.xml file I have this bean
<bean id="engineService" class="com.strader.baseserver.engine.EngineServiceImpl"
destroy-method="shutdownEngine" init-method="startupEngine">
<constructor-arg type="java.lang.String" value="engine-config.xml" />
</bean>
The Manifest.mf file looks like
Manifest-Version: 1.0
Bundle-Version: 1.0
Bundle-SymbolicName: com.test
Bundle-Name: Server Base Bundle
Bundle-Vendor: test
Bundle-ManifestVersion: 2
Import-Package: org.apache.log4j;version="[1.12.15]",com.espertech;version="[3.0.0]"
When i packup the jar and place it into the pickup directory and start the dm server.
I get
[2009-03-18 09:15:59.468] fs-watcher <SPDE0048I> Processing 'CREATED' event for file 'test-1.0-SNAPSHO
T.jar'.
[2009-03-18 09:16:01.093] fs-watcher <SPDE0018E> Unable to install application from location 'file:/C:/dev/downloads
/springsource-dm-server-1.0.2.RELEASE/springsource-dm-server-1.0.2.RELEASE/pickup/test-1.0-SNAPSHOT.jar'. Could not
satisfy constraints for bundle 'com. test' at version '1.0.0'.
Unable to install bundle from module 'file [C:\dev\downloads\springsource-dm-server-1.0.2.RELEASE\springsource-dm-server-1.0.2.RE
LEASE\work\com.springsource.server.deployer\Module \test-1.0-SNAPSHOT.jar-0\ test-1.0-SNAPSHOT.jar]':org
.osgi.framework.BundleException.
[2009-03-18 09:16:01.562] fs-watcher <SPDE0011E> Deployment of 'com. test' version '1' failed.
[2009-03-18 09:16:01.578] fs-watcher <SPDE0005E> Hot deploy failed for resource 'C:\dev\downloads\springsource-dm-se
rver-1.0.2.RELEASE\springsource-dm-server-1.0.2.RELEASE\pickup\test-1.0-SNAPSHOT.jar'.
oleg.zhurakousky
Mar 19th, 2009, 02:48 PM
[2009-03-18 09:16:01.562] fs-watcher <SPDE0011E> Deployment of 'com. test' version '1' failed.
[2009-03-18 09:16:01.578] fs-watcher <SPDE0005E> Hot deploy failed for resource 'C:\dev\downloads\springsource-dm-se
rver-1.0.2.RELEASE\springsource-dm-server-1.0.2.RELEASE\pickup\test-1.0-SNAPSHOT.jar'.
Deployment failed means your bundle was not deployed. You have obvious issues in your manifest so I would start by fixing it. You specified an invalid range.
For example:
Import-Package: org.apache.log4j;version="[1.12.15]"
instead of the actual range (not to mention 1.12.15 doesn't even exist):
Import-Package: org.apache.log4j;version="[1.2.15,1.2.15]"
and so on. . .
Or you can specify "at least" version:
org.apache.log4j;version="1.12.15"
without brackets which means "at least version 1.2.15"
bc56
Mar 19th, 2009, 02:56 PM
Thank you , so I change the manifest. But it does not look for my thirdparty libs
Unsatisfied leaf constraints:
Bundle: com.strader.baseserver_1.0.0 - Import-Package: org.apache.log4j; version="1.12.15"
Did you mean: 'org.apache.log4j'?
Bundle: com.strader.baseserver_1.0.0 - Import-Package: com.espertech.esper; version="3.0.0"
Did you mean: 'org.aspectj.weaver'?
Bundle: com.strader.baseserver_1.0.0 - Import-Package: org.antlr.runtime; version="3.1.1"
Did you mean: 'org.antlr.runtime'?
I have placed the jars into repository\library\usr
Thanks again for your help
oleg.zhurakousky
Mar 19th, 2009, 03:07 PM
Where are you getting your bundles and version information from?
As I said before there is no log4j 1.12.15
There is no com.espertech.esper there are com.espertech.esper.(each apckage) (e.g., com.espertech.esper.antlr, com.espertech.esper.cloient etc. . .) all must be listed individually or use Import-Bundle header.
There is also no 3.0.0 version of this bundle unless you created your own.
and so on. . . .
Check http://www.springsource.com/repository
have placed the jars into repository\library\usr
This is definitely not the place for JARs. You might want to read up on dmSErver documentation:
http://static.springsource.com/projects/dm-server/1.0.x/programmer-guide/html/
http://static.springsource.com/projects/dm-server/1.0.x/user-guide/html/
bc56
Mar 19th, 2009, 03:10 PM
Aaaa I see, Is there a way for me to use maven to create these from my local repo. How do i bundle all of my thirdparty libs up into a bundle and package them as one into the server ?>
oleg.zhurakousky
Mar 19th, 2009, 03:16 PM
http://www.springsource.com/repository - provides you with already OSGified versions of most of the JARs you need. It has maven access (read the FAQ there)
If you want to create your own bundles then you can use BND tool or maven-bundle-plugin from Felix or Bundlor that is coming out shortly from Spring.
bc56
Mar 19th, 2009, 03:21 PM
Thank you for all your help, this has been great and helps loads.
bc56
Mar 19th, 2009, 03:45 PM
Sorry I am back, So i got the deps working. But still no init-method being called on the top appCtx. so the application is not starting.
[code]
[2009-03-18 10:38:00.734] fs-watcher <SPDE0048I> Processing 'MODIFIED' event for file 'strader-baseserver-1.0-SNAPSH
OT.jar'.
[2009-03-18 10:38:03.796] fs-watcher <SPDE0010I> Deployment of 'com.strader.baseserver' version '1' completed.
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.