This content has been marked as final.
Show 4 replies
-
1. Re: No application context when instantiating
chawax Mar 23, 2009 10:23 AM (in response to reneger)Try the following :
Component component = Component.componentForName("physicalDeviceDAO"); PhysicalDeviceDAO physicalDeviceDAO = (PhysicalDeviceDAO) component.newInstance();
-
2. Re: No application context when instantiating
reneger Mar 24, 2009 8:59 AM (in response to reneger)Component.componentForName isn't available in my config...
-
3. Re: No application context when instantiating
chawax Mar 24, 2009 10:48 AM (in response to reneger)Not available ? I can't understand, it is part of Seam core ! Did I miss something ?
-
4. Re: No application context when instantiating
reneger Mar 24, 2009 3:15 PM (in response to reneger)I dont know, i couldn't find the function anywhere.
But i've found the solution. I wrapped the servletrequest in my own ContextualServletRequest, found somewhere on the internet (http://sfwk.org/Documentation/ReplacingServletsWithSeamResources)
public class RdmHttpServlet extends HttpServlet{
@Logger
private static Log log;
private static final long serialVersionUID = -1859937460510960239L;
/**
* XML Processor.
*/
protected Processor processor = Processor.getInstance();
protected void service(final HttpServletRequest request, final HttpServletResponse response)
throws ServletException, IOException {
new ContextualHttpServletRequest(request) {
@Override
public void process() throws Exception {
handleRequest(request, response);
}
}.run();
}
The handlerequest is the old function which was called by the doGet and doPost functions.
The handlerequest is now a Seam object, and therefore i can get my instances for my DAO's.