Hi Tim, The servlet is inside a WAB file which has a web.xml:
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <servlet> <servlet-name>HelloWorld</servlet-name> <servlet-class>com.webapp.HelloWorld</servlet-class> </servlet> <servlet-mapping> <servlet-name>HelloWorld</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> </web-app> I'm not trying to use the whiteboard pattern in the first place but rather looking for a way to inject my AdminBroker service into my servlet so I turn my servlet into a component in order to use the reference. Thai On Mon, Aug 6, 2018 at 4:44 PM, Tim Ward <tim.w...@paremus.com> wrote: > I don’t see any Http Service whiteboard properties on the Servlet > component. How are you registering it with the Servlet container? > > Tim > > Sent from my iPhone > > On 6 Aug 2018, at 16:22, Nhut Thai Le via osgi-dev <osgi-dev@mail.osgi.org> > wrote: > > Hello, > > I have a servlet defined like this: > > @Component(service = Servlet.class) > public class HelloWorld extends HttpServlet { > @Reference(cardinality = ReferenceCardinality.MANDATORY) > private AdminBroker adminBroker; > > protected void doGet(HttpServletRequest request, HttpServletResponse > response) throws ServletException, IOException { > adminBroker.doSomething(); > } > } > > My AdminBroker implementation looks like: > @Component(service=AdminBroker.class) > public class AdminBrokerImpl implements AdminBroker { > @Activate > private void init() { > String param1 = "some text"; > } > } > > When I started the env (felix 6 with pax-web), I can see the AdminBroker > instantiated (hit a break point in the init of my AdminBroker > implementation) but when the web request arrives and the doGet method is > called, the adminBroker is null. > > Does anyone have an idea what may go wrong here? > > Thai Le > > -- > Castor Technologies Inc > 460 rue St-Catherine St > <https://maps.google.com/?q=460+rue+St-Catherine+St&entry=gmail&source=g> > Ouest, Suite 613 > Montréal, Québec H3B-1A7 > (514) 360-7208 o > (514) 798-2044 f > n...@castortech.com > www.castortech.com > > CONFIDENTIALITY NOTICE: The information contained in this e-mail is > confidential and may be proprietary information intended only for the use > of the individual or entity to whom it is addressed. If the reader of this > message is not the intended recipient, you are hereby notified that any > viewing, dissemination, distribution, disclosure, copy or use of the > information contained in this e-mail message is strictly prohibited. If you > have received and/or are viewing this e-mail in error, please immediately > notify the sender by reply e-mail, and delete it from your system without > reading, forwarding, copying or saving in any manner. Thank you. > AVIS DE CONFIDENTIALITE: L’information contenue dans ce message est > confidentiel, peut être protégé par le secret professionnel et est réservé > à l'usage exclusif du destinataire. Toute autre personne est par les > présentes avisée qu'il lui est strictement interdit de diffuser, distribuer > ou reproduire ce message. Si vous avez reçu cette communication par erreur, > veuillez la détruire immédiatement et en aviser l'expéditeur. Merci. > > _______________________________________________ > OSGi Developer Mail List > osgi-dev@mail.osgi.org > https://mail.osgi.org/mailman/listinfo/osgi-dev > > -- Castor Technologies Inc 460 rue St-Catherine St Ouest, Suite 613 Montréal, Québec H3B-1A7 (514) 360-7208 o (514) 798-2044 f n...@castortech.com www.castortech.com CONFIDENTIALITY NOTICE: The information contained in this e-mail is confidential and may be proprietary information intended only for the use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any viewing, dissemination, distribution, disclosure, copy or use of the information contained in this e-mail message is strictly prohibited. If you have received and/or are viewing this e-mail in error, please immediately notify the sender by reply e-mail, and delete it from your system without reading, forwarding, copying or saving in any manner. Thank you. AVIS DE CONFIDENTIALITE: L’information contenue dans ce message est confidentiel, peut être protégé par le secret professionnel et est réservé à l'usage exclusif du destinataire. Toute autre personne est par les présentes avisée qu'il lui est strictement interdit de diffuser, distribuer ou reproduire ce message. Si vous avez reçu cette communication par erreur, veuillez la détruire immédiatement et en aviser l'expéditeur. Merci.
_______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev