On 2/7/11 5:18, Lindley Andrew wrote:
Hi Clement,
Thanks for pointing me to the ipojo webconsole plugin
I noticed that one of my 'required' services is in the state invalid. That's
the issue.
It probably could have saved me lots of time if I had seen this information
when deploying an iPojo service in the command line.
Then you could consider deploying the iPOJO architecture command for
Gogo, whose purpose is to allow you to inspect such things from the
command line.
-> richard
Thanks,
Kr Andrew
-----Original Message-----
From: Clement Escoffier [mailto:[email protected]]
Sent: Friday, February 04, 2011 8:01 PM
To: Apache Felix - Users Mailing List
Subject: Re: iPojo with HttpServlet and WhiteboardExtender - when using iPojo
'requires'
Hi,
If you're using the felix web console, could you deploy:
http://repo1.maven.org/maven2/org/apache/felix/org.apache.felix.ipojo.webco
nsole/1.4.4/org.apache.felix.ipojo.webconsole-1.4.4.jar
And check the state of the sampleServlet2 instance (before and after the
issue). To get the state, in the web console, just go to the iPOJO Tab.
Regards,
Clement
On 04.02.11 17:36, "Richard S. Hall"<[email protected]> wrote:
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]
---------------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]