On 2/4/11 11:24, Lindley Andrew wrote:
I am having issues with iPojo in combination with Servlets and the whiteboard-extender when iPojos 'requires' functionality is used. Let me explain my setup in more detail: *) I've got a very simple TestServlet which just extends the HttpServlet and overrides the init, destroy and doGet methods. public class TestServlet2 extends HttpServlet *) that's my iPojo configuration - it perfectly works. Please note the static property alias='/sampleservlet' which is used for the Servlet path <ipojo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="org.apache.felix.ipojo http://felix.apache.org/ipojo/schemas/CURRENT/core.xsd" xmlns="org.apache.felix.ipojo"> <component name="TestServlet2" classname="org.apache.felix.http.samples.whiteboard.TestServlet2"> <provides> <property name="servletname" field="name" /> <property name="alias" value="/servletmapping" type="java.lang.String"/> </provides> </component> <instance name="sampleServlet2" component="TestServlet2"> <property name="alias" value="/sampleservlet" /> <property name="servletname" value="Test-Servlet2 Name"/> </instance> </ipojo> *) Within the POM I'm using the maven-bundle-plugin and maven-ipojo-plugin to build the bundle - just as you would expect. <name>Apache Felix Http Samples - Whiteboard</name> <artifactId>org.apache.felix.http.samples.whiteboard</artifactId> <packaging>bundle</packaging> <build> <plugins> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <version>2.1.0</version> <extensions>true</extensions> <configuration> <instructions> <Bundle-Category>sample</Bundle-Category> <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName> <Export-Package></Export-Package> </instructions> </configuration> </plugin> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-ipojo-plugin</artifactId> <version>1.4.2</version> <executions> <execution> <goals> <goal>ipojo-bundle</goal> </goals> <configuration> <metadata>src/main/ipojo/meta.xml</metadata> </configuration> </execution> </executions> </plugin> </plugins> </build> *) On my system I'm running karaf with the 'http' and 'war' feature installed. i.e. I've got the jetty-bundle up and running and I'm able to use the org.ops4j.pax.web/pax-web-extender-whiteboard/0.7.3 for servlet deployment This setup works like charm and the servlet is properly picked up and exposed by the whiteboard-extender. I'm able to access it at http://localhost:8181/sampleservlet and the bundle description states alias = /servletmapping factory.name = TestServlet2 instance.name = sampleServlet2 objectClass = javax.servlet.Servlet, javax.servlet.ServletConfig, java.io.Serializable service.id = 189 servletname = Test-Servlet2 Name HOWEVER, as soon as I use the iPojo 'requires' functionality the Servlet is no longer exposed. I didn't change anything else in the above configuration. Both required services 'service' (private BookshelfService service) and 'logger' (private BookshelfLogHelper logger) are available on the system as bundles.
Are these bundles also active and providing their services? -> richard
The bundle description does no longer contain information on the alias or instance.name??? Thanks for your help, I have no idea what's going wrong here?! <ipojo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="org.apache.felix.ipojo http://felix.apache.org/ipojo/schemas/CURRENT/core.xsd" xmlns="org.apache.felix.ipojo"> <component name="TestServlet2" classname="org.apache.felix.http.samples.whiteboard.TestServlet2"> <provides> <property name="servletname" field="name" /> <property name="alias" value="/servletmapping" type="java.lang.String"/> </provides> <requires field="service" /> <requires field="logger" /> </component> <instance name="sampleServlet2" component="TestServlet2"> <property name="alias" value="/sampleservlet " /> <property name="servletname" value="Test-Servlet2 Name"/> </instance> </ipojo> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
--------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

