You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Atul From Infosys <at...@infosys.com> on 2007/05/16 03:50:57 UTC

Loading resources in Assembly

Hi All,
 I need your suggestion or help in  order to understand how the resources
gets referred in servicemix of Serviceunit when packaged as a zip. 
I define a servicemix assembly which has two servicemix unit and each su has
got its own set of resource files in organized dir structure. it is the
configuration data and files for the components referred in servicemix file. 
This assembly works perfectly ok when i keep the resources outside from the
su zip, as probably it able to resolve the path of resources. 
However, i want these files to be packaged along with their serviceunit in
respective zip to make deployment easier. When i try packaging them by
putting them in resource dir of serviceunit as suggested in documents, i can
see them  getting included in the root dir of serviceunit. however,  after
deploying su along with sa, during intialization of su, it throws an
exception , saying FileNotFound kind of exception.
I tried even putting entry as classpath location in respective servicemix.

Pls do let know how to refer resources in servicemix.xml after packaging
them in su zip. 
thanks in adv for any kind of help .

Regards,
Atul

-- 
View this message in context: http://www.nabble.com/Loading-resources-in-Assembly-tf3762111s12049.html#a10634363
Sent from the ServiceMix - User mailing list archive at Nabble.com.


RE: Loading resources in Assembly

Posted by ra...@wipro.com.
AFAIK..
-Put the file in the resources folder of the su
-Include it as a spring resource(ex. private Resource xxx;) with getter and setter in the bean class.
- In the xbean.xml u have to define the property for the bean as <property name="xxxx" value="classpath:xxx.xml"/>
- you can then read the file as xxx.getFile() in the bean class.
 
hope this helps. This works for me.
 
 
Regards, 
Rabi Mishra 
http://rabisblog.blogspot.com/

________________________________

From: Atul From Infosys [mailto:atul_gupta04@infosys.com]
Sent: Wed 5/16/2007 7:20 AM
To: servicemix-users@geronimo.apache.org
Subject: Loading resources in Assembly




Hi All,
 I need your suggestion or help in  order to understand how the resources
gets referred in servicemix of Serviceunit when packaged as a zip.
I define a servicemix assembly which has two servicemix unit and each su has
got its own set of resource files in organized dir structure. it is the
configuration data and files for the components referred in servicemix file.
This assembly works perfectly ok when i keep the resources outside from the
su zip, as probably it able to resolve the path of resources.
However, i want these files to be packaged along with their serviceunit in
respective zip to make deployment easier. When i try packaging them by
putting them in resource dir of serviceunit as suggested in documents, i can
see them  getting included in the root dir of serviceunit. however,  after
deploying su along with sa, during intialization of su, it throws an
exception , saying FileNotFound kind of exception.
I tried even putting entry as classpath location in respective servicemix.

Pls do let know how to refer resources in servicemix.xml after packaging
them in su zip.
thanks in adv for any kind of help .

Regards,
Atul

--
View this message in context: http://www.nabble.com/Loading-resources-in-Assembly-tf3762111s12049.html#a10634363
Sent from the ServiceMix - User mailing list archive at Nabble.com.






The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
 
www.wipro.com

Re: Loading resources in Assembly

Posted by Gert Vanthienen <ge...@skynet.be>.
Atul,

As you will be able to find in this URL [1], starting with version 3.1 the
root of your service unit is automatically added to your classpath.  If you
want to store your resources somewhere else (e.g. in a resources folder in
the SU archive), you should add the folder to the classpath.

With the resource being available on the classpath, you should be able to
use getClass().getResource() or .getResourceAsStream() to load it in your
code.

Regards,

Gert

[1] http://incubator.apache.org/servicemix/classloaders.html


Atul From Infosys wrote:
> 
> Hi All,
>  I need your suggestion or help in  order to understand how the resources
> gets referred in servicemix of Serviceunit when packaged as a zip. 
> I define a servicemix assembly which has two servicemix unit and each su
> has got its own set of resource files in organized dir structure. it is
> the configuration data and files for the components referred in servicemix
> file. 
> This assembly works perfectly ok when i keep the resources outside from
> the su zip, as probably it able to resolve the path of resources. 
> However, i want these files to be packaged along with their serviceunit in
> respective zip to make deployment easier. When i try packaging them by
> putting them in resource dir of serviceunit as suggested in documents, i
> can see them  getting included in the root dir of serviceunit. however, 
> after deploying su along with sa, during intialization of su, it throws an
> exception , saying FileNotFound kind of exception.
> I tried even putting entry as classpath location in respective servicemix.
> 
> Pls do let know how to refer resources in servicemix.xml after packaging
> them in su zip. 
> thanks in adv for any kind of help .
> 
> Regards,
> Atul
> 
> 

-- 
View this message in context: http://www.nabble.com/Loading-resources-in-Assembly-tf3762111s12049.html#a10636418
Sent from the ServiceMix - User mailing list archive at Nabble.com.