In OSGi the idea is that you get a bunch of bundles that collaborate through services. The bundle is a module and is therefore supposed to be impenetrable. Just like a class has private fields so does a bundle have private classes and resources. It would not be very modular if you could use the XML from other bundles, this Spring XML is supposed to be an implementation detail of the bundle. As long as you do the collaboration with services you can use many different techniques: Spring, DS, iPOJO, dependency manager, etc.
So with spring the basic idea is that spring configures your bundle to register and consume services. How this is achieved is then an implementation detail. Kind regards, Peter Kriens On 10 mei 2011, at 13:12, Daniele Dellafiore wrote: > On Fri, May 6, 2011 at 4:47 PM, Peter Kriens <peter.kri...@aqute.biz> wrote: > >> I am not sure I understand where you're going .... >> >> The -wab/-wablib facility is ONLY for people that want to make a WAR that >> also runs on OSGi. Your use case seems to be standard vanilla OSGi. Just >> make it a WAB, i.e. set the Web-ContextPath header and you're done with any >> compliant OSGi Web container. The -wab option is just a convenience that >> moves the classes from the root to WEB-INF/classes. So start from zero and >> just create a bundle. I have NO idea what will happen when you try to build >> a JAR with all these different packagers in maven. >> >> Did you try to make a simple "hello world" servlet? >> > > Yes I tried that way and I finally succeded. The misunderstanding was I > thought that "WAB" means "war without dependencies, with a context and with > classpath in WEB-INF/classes", and that bnd/maven-bundle build that > accordingly. It's not the case, a WAB is a WAR with a couple of special > instructions for OSGI in the manifest and there's to use maven-war to > exclude dependencies. > Fine > > I succeded in starting a simple servlet project, a wicket webapp and also a > wicket webapp with spring using OsgiBundleXmlWebApplicationContext from the > org.springframework.osgi.web project. > > There's still a thing I can't understand how to achieve, that involves osgi > and spring (not wicket or webapps) > In the OSGI context, I can only load spring xml files that are in the > bundle, not the ones in imported bundles. > > Anyway thanks to everyone for the help. > > > >> >> Kind regards, >> >> Peter Kriens >> >> >> >> >> On 21 apr 2011, at 10:48, Daniele Dellafiore wrote: >> >>> I thank you all for the information. I need to make it run from the >>> maven-bundle-plugin 2.2.0. >>> With the configuration (pasted in the end of the email) and instructing >> the >>> maven-war-plugin to where the MANIFEST file is, the module with packaging >> = >>> war has the osgi info but still has the /lib folder with all the jars and >>> the MANIFEST file is not even populated with the OSGI info (while for all >>> the other jar it is) >>> >>> I think I still need to add something like >>> >>> <Bundle-ClassPath>.,WEB-INF/classes</Bundle-ClassPath> >>> >>> Just for the war project. >>> >>> I'm confused about two things now: >>> 1. how do I instruct the maven plugin NOT to copy dependency? Is this >> enough >>> for the bundle to look for dependency in the container rather than in >> it's >>> own /lib folder? >>> 2. How do I instruct the container to run the bundle as a webapp? So to >> make >>> the jetty that's active on Karaf to read the web.xml of my bundle? >>> >>> Or maybe I can skip the web.xml at all, in this way I've to figure out >> how >>> to run a Wicket application without it... >>> >>>> >>>> <plugin> >>> <groupId>org.apache.felix</groupId> >>> <artifactId>maven-bundle-plugin</artifactId> >>> <version>2.2.0</version> >>> <extensions>true</extensions> >>> <executions> >>> <execution> >>> <id>bundle-manifest</id> >>> <phase>process-classes</phase> >>> <goals> >>> <goal>manifest</goal> >>> </goals> >>> </execution> >>> </executions> >>> <configuration> >>> <supportedProjectTypes> >>> <supportedProjectType>jar</supportedProjectType> >>> <supportedProjectType>bundle</supportedProjectType> >>> <supportedProjectType>war</supportedProjectType> >>> </supportedProjectTypes> >>> <instructions> >>> >>> <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> >>> <_versionpolicy>${osgi.version.policy}</_versionpolicy> >>> <Export-Package>${osgi.export.package}</Export-Package> >>> <Import-Package>${osgi.import.package}</Import-Package> >>> <_wab>src/main/webapp/</_wab> >>> </instructions> >>> </configuration> >>> </plugin> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@felix.apache.org >> For additional commands, e-mail: users-h...@felix.apache.org >> >> --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org