Load spring context from Hudson plugin

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Load spring context from Hudson plugin

kalpanab
Hi All,

Any one know how to load spring context from Hudson plugin?
I tried below way,

ApplicationContext ctx =
  new ClassPathXmlApplicationContext("hudson/plugins/plugin-name/applicationContext.xml");

But it is throwing below exception as when I run as mvn hpi:run.

IOException parsing XML document from class path resource [hudson/plugins/datastore/applicationContext.xml]; nested exception is java.io.FileNotFoundException:

Thanks,
Kalpana
Reply | Threaded
Open this post in threaded view
|

Re: Load spring context from Hudson plugin

Kohsuke Kawaguchi
Administrator

That's more of a Spring question than Hudson question, but note that
ClassPathXmlApplicationContext takes a resource name. You are not
passing a java.lang.Class, either, so I don't see how Spring could pick
up the right classloader to find your bean XML files in.

kalpanab wrote:

> Hi All,
>
> Any one know how to load spring context from Hudson plugin?
> I tried below way,
>
> ApplicationContext ctx =
>   new
> ClassPathXmlApplicationContext("hudson/plugins/plugin-name/applicationContext.xml");
>
> But it is throwing below exception as when I run as mvn hpi:run.
>
> IOException parsing XML document from class path resource
> [hudson/plugins/datastore/applicationContext.xml]; nested exception is
> java.io.FileNotFoundException:
>
> Thanks,
> Kalpana

--
Kohsuke Kawaguchi
Sun Microsystems                   http://weblogs.java.net/blog/kohsuke/

smime.p7s (4K) Download Attachment