java.lang.IllegalArgumentException: bundle context should be set before refreshing the application context

2009-03-31 Thread Charles Moulliard
 Hi,

When I start my Apache Wicket bundle using Apache Service Mix (based on
Felix and Spring DM), I receive the following error :
 Quote:
  16:35:58,415 | DEBUG | localShell | jetty |
.service.internal.util.JCLLogger 85 | started
org.ops4j.pax.web.service.internal.model.ServletMo del-66
16:35:58,415 | INFO | localShell | HttpServiceProxy |
ervice.internal.HttpServiceProxy 129 | Registering event listener
[org.springframework.web.context.ContextLoaderListe n...@196dc61]
16:35:58,415 | DEBUG | localShell | HttpServiceStarted |
vice.internal.HttpServiceStarted 324 | Using context
[ContextModel{id=org.ops4j.pax.web.service.internal
.model.ContextModel-64,name=reportincident,httpContext=org.ops4j.pax.w
eb.extender.war.internal.webapphttpcont...@fe404a,
contextParams={webapp.context=reportincident,
contextClass=org.springframework.osgi.web.context.
support.OsgiBundleXmlWebApplicationContext}}]
16:35:58,415 | INFO | localShell | /reportincident |
.service.internal.util.JCLLogger 102 | Initializing Spring root
WebApplicationContext
16:35:58,415 | INFO | localShell | ContextLoader |
mework.web.context.ContextLoader 189 | Root WebApplicationContext:
initialization started
16:35:58,415 | ERROR | localShell | ContextLoader |
mework.web.context.ContextLoader 215 | Context initialization failed
java.lang.IllegalArgumentException: bundle context should be set before
refreshing the application context
at org.springframework.util.Assert.notNull(Assert.jav a:112)
at org.springframework.osgi.context.support.AbstractD
elegatedExecutionApplicationContext.normalRefresh(
AbstractDelegatedExecutionApplicationContext.java: 179)
at org.springframework.osgi.context.support.AbstractD
elegatedExecutionApplicationContext$NoDependencies
WaitRefreshExecutor.refresh(AbstractDelegatedExecu
tionApplicationContext.java:89)
at org.springframework.osgi.context.support.AbstractD
elegatedExecutionApplicationContext.refresh(Abstra
ctDelegatedExecutionApplicationContext.java:175)
at org.springframework.web.context.ContextLoader.crea
teWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.init
WebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListe
ner.contextInitialized(ContextLoaderListener.java: 45)
Here is the config of my web.xml file :

 Quote:
  ?xml version=1.0 encoding=ISO-8859-1?
web-app xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=
http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;
version=2.4

display-namereportincident.web/display-name

context-param
param-namecontextClass/param-name
param-valueorg.springframework.osgi.web.context.support
.OsgiBundleXmlWebApplicationContext/param-value
/context-param

listener
listener-classorg.springframework.web.context.ContextLoade
rListener/listener-class
/listener

filter
filter-namewicket.reportincident.web/filter-name
filter-classorg.apache.wicket.protocol.http.WicketFilter /filter-class
init-param
param-nameapplicationClassName/param-name
param-valueorg.apache.camel.example.WicketApplication/param-value
/init-param
/filter

filter-mapping
filter-namewicket.reportincident.web/filter-name
url-pattern/*/url-pattern
/filter-mapping


/web-app
Any idea to solve this problem is welcome ?

Regards,

Charles
 __
SOA Architect


application context in links

2008-08-28 Thread jnesbitt

I'd like to link to static documents in the same web app that are named in
the database.  Currently I'm using ExternalLink but that obviously doesn't
use the application context in it's path.  This would be a nice to have for
development purposes.  

Is there a way for me to get the application context path so that I don't
have to hard code it?  Am I using the right type of link to do this?

Thanks

Jason
-- 
View this message in context: 
http://www.nabble.com/application-context-in-links-tp19204109p19204109.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: application context in links

2008-08-28 Thread Igor Vaynberg
see ContextImage for an example

-igor

On Thu, Aug 28, 2008 at 9:23 AM, jnesbitt [EMAIL PROTECTED] wrote:

 I'd like to link to static documents in the same web app that are named in
 the database.  Currently I'm using ExternalLink but that obviously doesn't
 use the application context in it's path.  This would be a nice to have for
 development purposes.

 Is there a way for me to get the application context path so that I don't
 have to hard code it?  Am I using the right type of link to do this?

 Thanks

 Jason
 --
 View this message in context: 
 http://www.nabble.com/application-context-in-links-tp19204109p19204109.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 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]



Re: Resources relative to application context

2008-07-16 Thread Ayodeji Aladejebi
So you mean every static image in my HTML will have to be converted to code

Basically we are having problems using any of the encoding strategies
because all of our background images and inline CSS images disappear

can this URL rewriting for resources be made to work with inline images

On Mon, Mar 31, 2008 at 5:32 PM, Zheng, Xiahong [EMAIL PROTECTED]
wrote:

 Yes, on tomcat 6.0.

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
 Of Al Maw
 Sent: Monday, March 31, 2008 10:12 AM
 To: users@wicket.apache.org
 Subject: Re: Resources relative to application context

 Actually, this should Just Work (tm). Are you running on Tomcat?

 Regards,

 Alastair

 On Mon, Mar 31, 2008 at 4:34 AM, [EMAIL PROTECTED] wrote:

  You got it
 
  -igor
 
 
  On 3/30/08, Zheng, Xiahong [EMAIL PROTECTED] wrote:
   Thanks Igor. But my resource in this case is style sheet not image.
 Does
   that mean I need to write a similar component to accomplish that?
  
   -Original Message-
   From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
   Sent: Sunday, March 30, 2008 3:48 PM
   To: users@wicket.apache.org
   Subject: Re: Resources relative to application context
  
   see source of ContextImage for details
  
   -igor
  
  
   On Sun, Mar 30, 2008 at 11:50 AM, Zheng, Xiahong
 [EMAIL PROTECTED]
   wrote:
How does wicket find such resource, e.g. as follows?
   
link href=style/my.css type=text/css rel=stylesheet /
   
I found this only works if I mount my pages with
   
mount(/pages, PackageName.forClass(Home.class));
   
Otherwise, I need to specify absolute URL. This is fine. However,
 the
subsequent problem I ran into is wicket failed to load resources
   after a
form submit which is probably caused by the resulting URL not
 being
mounted. So my question is,
   
How do I mount the resulting URL after a form submit or other
 event?
   Is
HybridUrlCodingStrategy designed for this purpose?
   
   
Thanks,
Xiaohong
   
   
 -
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]




Re: Application Context

2008-04-10 Thread lars vonk
What do you mean by non wicket files? Why do you need the
ApplicationContext?
If you just want to have your dependencies injected in a non Component class
you could use InjectHolder.getInjector().inject(objectToWire) and pass in
the Object you want to get wired. You should also annotate the properties
you want to wire with the @SpringBean annotation.

Example:

class NonWicketClass {

  @SpringBean private SomeBean someBean;

  public NonWicketClass() {
InjectorHolder.getInjector().inject(this);
  }

}

Lars

On Wed, Apr 9, 2008 at 9:25 PM, Edvin Syse [EMAIL PROTECTED] wrote:

 .. or just implement ApplicationContextAware ofcourse :)

 -- Edvin

 Edvin Syse skrev:

  Pinger wrote:
 
   All the examples I see do something like
  
  
   WebApplicationContext ctx =
WebApplicationContextUtils.getRequiredWebApplicationContext(
  this.getServletContext());
  
   how do I do the this.getServletContext() when I am not in the wicket
   file?
  
 
  Maybe you could implement ServletContextAware?
 
  -- Edvin
 
  -
  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]




Application Context

2008-04-09 Thread Pinger

So I am using wicket annot.

So I have classes elsewhere in my app that are using JMS and other services
in a web service. The issue I am having is I need the ApplicationContext in
non-wicket files. 

When I Do public static ApplicationContext spring = new
ClassPathXmlApplicationContext(applicationContext.xml);

this causes issues cause things are created 2 times..


Thanks
-- 
View this message in context: 
http://www.nabble.com/Application-Context-tp16592544p16592544.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Application Context

2008-04-09 Thread James McLaughlin
Have a look at Springs
WebApplicationContextUtils.getWebApplicationContext(...).  This in
conjunction with org.springframework.web.context.ContextLoaderListener
should give you what you need.

best,
jim

On Wed, Apr 9, 2008 at 12:41 PM, Pinger [EMAIL PROTECTED] wrote:

  So I am using wicket annot.

  So I have classes elsewhere in my app that are using JMS and other services
  in a web service. The issue I am having is I need the ApplicationContext in
  non-wicket files.

  When I Do public static ApplicationContext spring = new
  ClassPathXmlApplicationContext(applicationContext.xml);

  this causes issues cause things are created 2 times..


  Thanks
  --
  View this message in context: 
 http://www.nabble.com/Application-Context-tp16592544p16592544.html
  Sent from the Wicket - User mailing list archive at Nabble.com.


  -
  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]



Re: Application Context

2008-04-09 Thread Pinger

All the examples I see do something like


WebApplicationContext ctx = 
WebApplicationContextUtils.getRequiredWebApplicationContext(
this.getServletContext());

how do I do the this.getServletContext() when I am not in the wicket file? 

James McLaughlin-3 wrote:
 
 Have a look at Springs
 WebApplicationContextUtils.getWebApplicationContext(...).  This in
 conjunction with org.springframework.web.context.ContextLoaderListener
 should give you what you need.
 
 best,
 jim
 
 On Wed, Apr 9, 2008 at 12:41 PM, Pinger [EMAIL PROTECTED] wrote:

  So I am using wicket annot.

  So I have classes elsewhere in my app that are using JMS and other
 services
  in a web service. The issue I am having is I need the ApplicationContext
 in
  non-wicket files.

  When I Do public static ApplicationContext spring = new
  ClassPathXmlApplicationContext(applicationContext.xml);

  this causes issues cause things are created 2 times..


  Thanks
  --
  View this message in context:
 http://www.nabble.com/Application-Context-tp16592544p16592544.html
  Sent from the Wicket - User mailing list archive at Nabble.com.


  -
  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]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Application-Context-tp16592544p16593219.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Application Context

2008-04-09 Thread Edvin Syse

Pinger wrote:

All the examples I see do something like


WebApplicationContext ctx = 
	WebApplicationContextUtils.getRequiredWebApplicationContext(

this.getServletContext());

how do I do the this.getServletContext() when I am not in the wicket file? 


Maybe you could implement ServletContextAware?

-- Edvin

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Application Context

2008-04-09 Thread Edvin Syse

.. or just implement ApplicationContextAware ofcourse :)

-- Edvin

Edvin Syse skrev:

Pinger wrote:

All the examples I see do something like


WebApplicationContext ctx = 
WebApplicationContextUtils.getRequiredWebApplicationContext(

this.getServletContext());

how do I do the this.getServletContext() when I am not in the wicket 
file? 


Maybe you could implement ServletContextAware?

-- Edvin

-
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]



Re: Resources relative to application context

2008-03-31 Thread Al Maw
Actually, this should Just Work (tm). Are you running on Tomcat?

Regards,

Alastair

On Mon, Mar 31, 2008 at 4:34 AM, [EMAIL PROTECTED] wrote:

 You got it

 -igor


 On 3/30/08, Zheng, Xiahong [EMAIL PROTECTED] wrote:
  Thanks Igor. But my resource in this case is style sheet not image. Does
  that mean I need to write a similar component to accomplish that?
 
  -Original Message-
  From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
  Sent: Sunday, March 30, 2008 3:48 PM
  To: users@wicket.apache.org
  Subject: Re: Resources relative to application context
 
  see source of ContextImage for details
 
  -igor
 
 
  On Sun, Mar 30, 2008 at 11:50 AM, Zheng, Xiahong [EMAIL PROTECTED]
  wrote:
   How does wicket find such resource, e.g. as follows?
  
   link href=style/my.css type=text/css rel=stylesheet /
  
   I found this only works if I mount my pages with
  
   mount(/pages, PackageName.forClass(Home.class));
  
   Otherwise, I need to specify absolute URL. This is fine. However, the
   subsequent problem I ran into is wicket failed to load resources
  after a
   form submit which is probably caused by the resulting URL not being
   mounted. So my question is,
  
   How do I mount the resulting URL after a form submit or other event?
  Is
   HybridUrlCodingStrategy designed for this purpose?
  
  
   Thanks,
   Xiaohong
  
   -
   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]




RE: Resources relative to application context

2008-03-31 Thread Zheng, Xiahong
Yes, on tomcat 6.0. 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Al Maw
Sent: Monday, March 31, 2008 10:12 AM
To: users@wicket.apache.org
Subject: Re: Resources relative to application context

Actually, this should Just Work (tm). Are you running on Tomcat?

Regards,

Alastair

On Mon, Mar 31, 2008 at 4:34 AM, [EMAIL PROTECTED] wrote:

 You got it

 -igor


 On 3/30/08, Zheng, Xiahong [EMAIL PROTECTED] wrote:
  Thanks Igor. But my resource in this case is style sheet not image.
Does
  that mean I need to write a similar component to accomplish that?
 
  -Original Message-
  From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
  Sent: Sunday, March 30, 2008 3:48 PM
  To: users@wicket.apache.org
  Subject: Re: Resources relative to application context
 
  see source of ContextImage for details
 
  -igor
 
 
  On Sun, Mar 30, 2008 at 11:50 AM, Zheng, Xiahong
[EMAIL PROTECTED]
  wrote:
   How does wicket find such resource, e.g. as follows?
  
   link href=style/my.css type=text/css rel=stylesheet /
  
   I found this only works if I mount my pages with
  
   mount(/pages, PackageName.forClass(Home.class));
  
   Otherwise, I need to specify absolute URL. This is fine. However,
the
   subsequent problem I ran into is wicket failed to load resources
  after a
   form submit which is probably caused by the resulting URL not
being
   mounted. So my question is,
  
   How do I mount the resulting URL after a form submit or other
event?
  Is
   HybridUrlCodingStrategy designed for this purpose?
  
  
   Thanks,
   Xiaohong
  
  
-
   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]



Resources relative to application context

2008-03-30 Thread Zheng, Xiahong
How does wicket find such resource, e.g. as follows?

   link href=style/my.css type=text/css rel=stylesheet /

I found this only works if I mount my pages with

   mount(/pages, PackageName.forClass(Home.class));

Otherwise, I need to specify absolute URL. This is fine. However, the
subsequent problem I ran into is wicket failed to load resources after a
form submit which is probably caused by the resulting URL not being
mounted. So my question is,

How do I mount the resulting URL after a form submit or other event? Is
HybridUrlCodingStrategy designed for this purpose?


Thanks,
Xiaohong

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Resources relative to application context

2008-03-30 Thread Igor Vaynberg
see source of ContextImage for details

-igor


On Sun, Mar 30, 2008 at 11:50 AM, Zheng, Xiahong [EMAIL PROTECTED] wrote:
 How does wicket find such resource, e.g. as follows?

link href=style/my.css type=text/css rel=stylesheet /

  I found this only works if I mount my pages with

mount(/pages, PackageName.forClass(Home.class));

  Otherwise, I need to specify absolute URL. This is fine. However, the
  subsequent problem I ran into is wicket failed to load resources after a
  form submit which is probably caused by the resulting URL not being
  mounted. So my question is,

  How do I mount the resulting URL after a form submit or other event? Is
  HybridUrlCodingStrategy designed for this purpose?


  Thanks,
  Xiaohong

  -
  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]



RE: Resources relative to application context

2008-03-30 Thread Zheng, Xiahong
Thanks Igor. But my resource in this case is style sheet not image. Does
that mean I need to write a similar component to accomplish that? 

-Original Message-
From: Igor Vaynberg [mailto:[EMAIL PROTECTED] 
Sent: Sunday, March 30, 2008 3:48 PM
To: users@wicket.apache.org
Subject: Re: Resources relative to application context

see source of ContextImage for details

-igor


On Sun, Mar 30, 2008 at 11:50 AM, Zheng, Xiahong [EMAIL PROTECTED]
wrote:
 How does wicket find such resource, e.g. as follows?

link href=style/my.css type=text/css rel=stylesheet /

  I found this only works if I mount my pages with

mount(/pages, PackageName.forClass(Home.class));

  Otherwise, I need to specify absolute URL. This is fine. However, the
  subsequent problem I ran into is wicket failed to load resources
after a
  form submit which is probably caused by the resulting URL not being
  mounted. So my question is,

  How do I mount the resulting URL after a form submit or other event?
Is
  HybridUrlCodingStrategy designed for this purpose?


  Thanks,
  Xiaohong

  -
  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]



Re: Resources relative to application context

2008-03-30 Thread igor . vaynberg
You got it

-igor


On 3/30/08, Zheng, Xiahong [EMAIL PROTECTED] wrote:
 Thanks Igor. But my resource in this case is style sheet not image. Does
 that mean I need to write a similar component to accomplish that?

 -Original Message-
 From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
 Sent: Sunday, March 30, 2008 3:48 PM
 To: users@wicket.apache.org
 Subject: Re: Resources relative to application context

 see source of ContextImage for details

 -igor


 On Sun, Mar 30, 2008 at 11:50 AM, Zheng, Xiahong [EMAIL PROTECTED]
 wrote:
  How does wicket find such resource, e.g. as follows?
 
  link href=style/my.css type=text/css rel=stylesheet /
 
  I found this only works if I mount my pages with
 
  mount(/pages, PackageName.forClass(Home.class));
 
  Otherwise, I need to specify absolute URL. This is fine. However, the
  subsequent problem I ran into is wicket failed to load resources
 after a
  form submit which is probably caused by the resulting URL not being
  mounted. So my question is,
 
  How do I mount the resulting URL after a form submit or other event?
 Is
  HybridUrlCodingStrategy designed for this purpose?
 
 
  Thanks,
  Xiaohong
 
  -
  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]



Re: How to inject Spring Application context into WicketTester

2008-03-07 Thread lars vonk
Hi,

What we did is use the spring testing (see
http://static.springframework.org/spring/docs/2.5.x/reference/testing.html)
capabilities for this:

We created an abstract base class that all test cases that need to
test wicket pages or components

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={/applicationContext.xml})
@TransactionConfiguration
@Transactional
public abstract class AbstractWicketTestCase {

@Autowired
protected MyWebApplication wicketApplication;
protected WicketTester tester;

   @Before
   public void setup() {
  tester = new WicketTest(wicketApplication);
   }
}

Hopes this helps.

Lars

On Fri, Mar 7, 2008 at 12:11 PM, Jörn Zaefferer
[EMAIL PROTECTED] wrote:
 Hi,

  my wicket applicatin uses the SpringComponentInjector and @SpringBean
  annotations, which works great at runtime where the application
  context is present.

  I'd like to use WicketTester for JUnit tests:

  tester = new WicketTester(new MyApplication());
  In MyApplication#init, the component injector is created:
  addComponentInstantiationListener(new SpringComponentInjector(this));
  That constructor loads the ApplicationContext via
  
 WebApplicationContextUtils.getRequiredWebApplicationContext(webapp.getServletContext()

  That is the part which fails in my test, because there is no
  ApplicationContext stored in the servlet context. How can I fix that?

  My attempts so far:
  The description here doesn't help:
  http://cwiki.apache.org/WICKET/spring.html#Spring-UnitTestingtheProxyApproach
  The injector is already configured at that point.

  The alternative would be to put the application context into the
  ServletContext, so that WebApplicationContextUtils can find it. I've
  found no way to access MockWebApplication.context to set it manually,
  though I was able to set it by overwriting newServletContext. Though
  .setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
  context); where context is of type AnnotApplicationContextMock yields
  an IllegalStateException, because AnnotApplicationContextMock doesn't
  implement WebApplicationContext.

  Thanks
  Jörn

  -
  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]



Re: How to inject Spring Application context into WicketTester

2008-03-07 Thread Nino Saturnino Martinez Vazquez Wael

Checkout the blog tutorial, the unit test part

http://cwiki.apache.org/confluence/display/WICKET/Blog+Tutorial

Jörn Zaefferer wrote:

Hi,

my wicket applicatin uses the SpringComponentInjector and @SpringBean
annotations, which works great at runtime where the application
context is present.

I'd like to use WicketTester for JUnit tests:

tester = new WicketTester(new MyApplication());
In MyApplication#init, the component injector is created:
addComponentInstantiationListener(new SpringComponentInjector(this));
That constructor loads the ApplicationContext via
WebApplicationContextUtils.getRequiredWebApplicationContext(webapp.getServletContext()

That is the part which fails in my test, because there is no
ApplicationContext stored in the servlet context. How can I fix that?

My attempts so far:
The description here doesn't help:
http://cwiki.apache.org/WICKET/spring.html#Spring-UnitTestingtheProxyApproach
The injector is already configured at that point.

The alternative would be to put the application context into the
ServletContext, so that WebApplicationContextUtils can find it. I've
found no way to access MockWebApplication.context to set it manually,
though I was able to set it by overwriting newServletContext. Though
.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
context); where context is of type AnnotApplicationContextMock yields
an IllegalStateException, because AnnotApplicationContextMock doesn't
implement WebApplicationContext.

Thanks
Jörn

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  


--
-Wicket for love
-Jme for fun

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to inject Spring Application context into WicketTester

2008-03-07 Thread Nino Saturnino Martinez Vazquez Wael

Eek I might have been wrong.. Sorry..

Nino Saturnino Martinez Vazquez Wael wrote:

Checkout the blog tutorial, the unit test part

http://cwiki.apache.org/confluence/display/WICKET/Blog+Tutorial

Jörn Zaefferer wrote:

Hi,

my wicket applicatin uses the SpringComponentInjector and @SpringBean
annotations, which works great at runtime where the application
context is present.

I'd like to use WicketTester for JUnit tests:

tester = new WicketTester(new MyApplication());
In MyApplication#init, the component injector is created:
addComponentInstantiationListener(new SpringComponentInjector(this));
That constructor loads the ApplicationContext via
WebApplicationContextUtils.getRequiredWebApplicationContext(webapp.getServletContext() 



That is the part which fails in my test, because there is no
ApplicationContext stored in the servlet context. How can I fix that?

My attempts so far:
The description here doesn't help:
http://cwiki.apache.org/WICKET/spring.html#Spring-UnitTestingtheProxyApproach 


The injector is already configured at that point.

The alternative would be to put the application context into the
ServletContext, so that WebApplicationContextUtils can find it. I've
found no way to access MockWebApplication.context to set it manually,
though I was able to set it by overwriting newServletContext. Though
.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, 


context); where context is of type AnnotApplicationContextMock yields
an IllegalStateException, because AnnotApplicationContextMock doesn't
implement WebApplicationContext.

Thanks
Jörn

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  




--
-Wicket for love
-Jme for fun

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to inject Spring Application context into WicketTester

2008-03-07 Thread Igor Vaynberg
spring wiki page shows how to set it up...

-igor


On Fri, Mar 7, 2008 at 3:11 AM, Jörn Zaefferer
[EMAIL PROTECTED] wrote:
 Hi,

  my wicket applicatin uses the SpringComponentInjector and @SpringBean
  annotations, which works great at runtime where the application
  context is present.

  I'd like to use WicketTester for JUnit tests:

  tester = new WicketTester(new MyApplication());
  In MyApplication#init, the component injector is created:
  addComponentInstantiationListener(new SpringComponentInjector(this));
  That constructor loads the ApplicationContext via
  
 WebApplicationContextUtils.getRequiredWebApplicationContext(webapp.getServletContext()

  That is the part which fails in my test, because there is no
  ApplicationContext stored in the servlet context. How can I fix that?

  My attempts so far:
  The description here doesn't help:
  http://cwiki.apache.org/WICKET/spring.html#Spring-UnitTestingtheProxyApproach
  The injector is already configured at that point.

  The alternative would be to put the application context into the
  ServletContext, so that WebApplicationContextUtils can find it. I've
  found no way to access MockWebApplication.context to set it manually,
  though I was able to set it by overwriting newServletContext. Though
  .setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
  context); where context is of type AnnotApplicationContextMock yields
  an IllegalStateException, because AnnotApplicationContextMock doesn't
  implement WebApplicationContext.

  Thanks
  Jörn

  -
  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]



Re: How to inject Spring Application context into WicketTester

2008-03-07 Thread Nino Saturnino Martinez Vazquez Wael

No I think its okay:) writing too many mails.. Check it out.. And ask..

Nino Saturnino Martinez Vazquez Wael wrote:

Eek I might have been wrong.. Sorry..

Nino Saturnino Martinez Vazquez Wael wrote:

Checkout the blog tutorial, the unit test part

http://cwiki.apache.org/confluence/display/WICKET/Blog+Tutorial

Jörn Zaefferer wrote:

Hi,

my wicket applicatin uses the SpringComponentInjector and @SpringBean
annotations, which works great at runtime where the application
context is present.

I'd like to use WicketTester for JUnit tests:

tester = new WicketTester(new MyApplication());
In MyApplication#init, the component injector is created:
addComponentInstantiationListener(new SpringComponentInjector(this));
That constructor loads the ApplicationContext via
WebApplicationContextUtils.getRequiredWebApplicationContext(webapp.getServletContext() 



That is the part which fails in my test, because there is no
ApplicationContext stored in the servlet context. How can I fix that?

My attempts so far:
The description here doesn't help:
http://cwiki.apache.org/WICKET/spring.html#Spring-UnitTestingtheProxyApproach 


The injector is already configured at that point.

The alternative would be to put the application context into the
ServletContext, so that WebApplicationContextUtils can find it. I've
found no way to access MockWebApplication.context to set it manually,
though I was able to set it by overwriting newServletContext. Though
.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, 


context); where context is of type AnnotApplicationContextMock yields
an IllegalStateException, because AnnotApplicationContextMock doesn't
implement WebApplicationContext.

Thanks
Jörn

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  






--
-Wicket for love
-Jme for fun

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]