You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by spyder71 <gr...@gmail.com> on 2008/11/20 17:13:17 UTC

Mojo and Spring

Hi, 

I am writting a Mojo that should use Spring fwk.
But when i a run the Mojo, it cannot find the spring beans config file
(which is packaged into the mojo jar).

I use ClassPathXmlApplicationContext to resolve the config file, but no
success

Error is the following :

Embedded error: IOException parsing XML document from class path resource
[spring/applicationContext.xml]; 
nested exception is java.io.FileNotFoundException: class path resource
[spring/applicationContext.xml] cannot be opened because it does not exist

Has any one any hints ?

tx !



-- 
View this message in context: http://www.nabble.com/Mojo-and-Spring-tp20604693p20604693.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Mojo and Spring

Posted by "Walid \"jo\" Gedeon" <wg...@gmail.com>.
Hello spyder71,
I think this is more a question for the spring dev list... However, try
checking the following:

1) Is the resource *really* in the jar? open the jar and look for the
resource and check its location.
2) Try to load the resource yourself as a test:

 this.getClass().getClassLoader().getResourceAsStream("spring/applicationContext.xml")
will throw an exception if the resource is not found.
If this works, then consider using the constructor signature that takes a
Class as parameter, pass it 'this'

PS: Consider posting your question to the spring forum board instead [1],
you'll get a better chance of reply.

HTH,
--w
[1] http://forum.springsource.org/index.php


On Thu, Nov 20, 2008 at 5:13 PM, spyder71 <gr...@gmail.com> wrote:

>
> Hi,
>
> I am writting a Mojo that should use Spring fwk.
> But when i a run the Mojo, it cannot find the spring beans config file
> (which is packaged into the mojo jar).
>
> I use ClassPathXmlApplicationContext to resolve the config file, but no
> success
>
> Error is the following :
>
> Embedded error: IOException parsing XML document from class path resource
> [spring/applicationContext.xml];
> nested exception is java.io.FileNotFoundException: class path resource
> [spring/applicationContext.xml] cannot be opened because it does not exist
>
> Has any one any hints ?
>
> tx !
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Mojo-and-Spring-tp20604693p20604693.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>