Hi, thank you! Now I know how to get the ServletContext :) But it didn't solve the main problem. This time I got following exception:
IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml] This is the right path. The xml file is there. It also schouldn't be a problem with file system permissions :( On 9 February 2011 12:57, Attila Király <kiralyattila...@gmail.com> wrote: > Hi, > > Try this in your application's #init() method (before calling #refresh() on > ctx) > > ctx.setServletContext(getServletContext()); > > Attila > > 2011/2/9 Dmitriy Neretin <dmitriy.nere...@googlemail.com> > > > Thank you for reply, > > > > yes! And I get then another exception :) > > > > Cannot resolve ServletContextResource without ServletContext > > > > Does andybody know how can I get/set the servletContext? > > > > Dmitriy > > > > On 8 February 2011 18:01, Igor Vaynberg <igor.vaynb...@gmail.com> wrote: > > > > > did you call context.refresh() ? like the error message said? > > > > > > -igor > > > > > > On Tue, Feb 8, 2011 at 1:31 AM, Dmitriy Neretin > > > <dmitriy.nere...@googlemail.com> wrote: > > > > Hi, > > > > > > > > my complete setUp looks like this: > > > > > > > > @Before > > > > public void setUp() { > > > > MworldWicketApplication wicketWebApp = new > > > MworldWicketApplication() > > > > { > > > > > > > > ApplicationContext ctx = new XmlWebApplicationContext(); > > > > > > > > @Override > > > > public void init() { > > > > addComponentInstantiationListener(new > > > > SpringComponentInjector(this, ctx, true)); > > > > } > > > > }; > > > > > > > > tester = new WicketTester(wicketWebApp); > > > > pageParams = new HashMap<String, String>(); > > > > } > > > > > > > > So the wickettester instance is created after the Appllication class > is > > > > overriden. Even if I extract the wickettester creation from setup and > > > will > > > > make it in each test (it is actually the same) I have the same > problem. > > > > > > > > After debuggin the tests I have seen that my appcontext instance was > > > created > > > > and the .xml file was correctly recognized :( But I still get the > > > > exception... > > > > > > > > On 8 February 2011 07:37, Igor Vaynberg <igor.vaynb...@gmail.com> > > wrote: > > > > > > > >> make sure your setup() code runs before wicket tester instance is > > > created. > > > >> > > > >> -igor > > > >> > > > >> On Mon, Feb 7, 2011 at 7:41 AM, Dmitriy Neretin > > > >> > > > >> > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > > > > > > > -- > "I would rather write programs to write programs than write programs." >