[jboss-user] [Microcontainer] - Re: Acessing Microcontainer Beans in Servlet

obelix1998 do-not-reply at jboss.com
Tue Apr 3 05:03:51 EDT 2007


This simply does not work :( There is not a single example to be found, how to access the beans defined in jboss-beans.xml from JAVA and I tried many things, none of which is working. It doesn't seem to me such an unusual idea to define beans in the xml and then use these instances within the java code (in my case a servlet). Could you please provide one WORKING example how this really works ?!!!

I defined this in jboss-beans.xml:

<bean name="surferCookieHandler" class="net.pelvit.tracker.jar.imp.SurferCookieHandler">
  | </bean>

I added this jboss-app.xml (tracker.beans is my "jar"):
<jboss-app>
  | 	<module>
  | 		<service>tracker.beans</service>
  | 	</module>
  | </jboss-app>

The in the code I used the following (as suggested by you):

BasicBootstrap bootstrap;
  | bootstrap = new BasicBootstrap();
  | bootstrap.run();
  | Object target = bootstrap.getKernel().getController().getInstalledContext("surferCookieHandler").getTarget();
  | 
Please give an example, how to really make this work because as it is, it simply doesn't and I'm beginning to think, I'm wasting my time on this microcontainer :-(


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4033927#4033927

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4033927



More information about the jboss-user mailing list