You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Grimm, Markus" <Gr...@juris.de> on 2008/09/18 15:17:32 UTC
READ a resource inside an aar
Hi all,
a question similar to this message-context [1]
[1]
http://www.nabble.com/Path-to-a-resource-inside-an-aar-tp19506606p195083
56.html
I followed Deepal's link to http://wso2.org/library/259
and tried to read a file inside the service-archive (*.aar).
the file is in the same folder as the ServiceImpl-class and
the SerciveImpl-class wants to read the file as an inutStream.
I tried both ways:
> MessageContext ctx = MessageContext.getCurrentMessageContext();
> AxisService svc = ctx.getAxisService();
> ClassLoader loader = svc.getClassLoader();
> String filename = (String)svc.getParameterValue("file.txt");
> InputStream is = loader.getResourceAsStream(filename);
and
>getClass().getClassLoader().getResourceAsStream("file.txt");
Both ways don't find the file. If I debug my read-method, the loader
shows in both cases:
WebappClassLoader
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@cd5f8b
So, if I put the 'file.txt' to the /WEB-INF/classes/ -folder, I can read
the file.
How can I get the classloader of the single service, so I can read a
resouce that resides inside of an archive ?
Thanks,
Markus
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
AW: READ a resource inside an aar
Posted by "Grimm, Markus" <Gr...@juris.de>.
Hi Carl,
great advice! Now it works.
Thanks,
Markus
Markus Grimm
Systementwicklung
juris GmbH
Abteilung IT
Gutenbergstraße 23
66117 Saarbrücken
Telefon: 0681 5866-0, Durchwahl -0
Telefax: 0681 5866-239
E-Mail: grimm@juris.de
www.juris.de
Geschäftssitz: Saarbrücken, Amtsgericht Saarbrücken, HRB 8485
Geschäftsführer: Dr. h. c. Gerhard Käfer (Sprecher) und Samuel van Oostrom
Aufsichtsratsvorsitzender: Ministerialdirektor Gerrit Stein
-----Ursprüngliche Nachricht-----
Von: Walker, Carleton [mailto:Carleton.Walker@finra.org]
Gesendet: Donnerstag, 18. September 2008 15:47
An: axis-user@ws.apache.org
Betreff: RE: READ a resource inside an aar
Hi,
I put the file in the root folder of the AAR (not in the package
folders). I pass only a filename to the getResourceAsStream() without
any absolute or relative path.
-Carl
-----Original Message-----
From: Grimm, Markus [mailto:Grimm@juris.de]
Sent: Thursday, September 18, 2008 9:18 AM
To: axis-user@ws.apache.org
Subject: READ a resource inside an aar
Hi all,
a question similar to this message-context [1]
[1]
http://www.nabble.com/Path-to-a-resource-inside-an-aar-tp19506606p195083
56.html
I followed Deepal's link to http://wso2.org/library/259 and tried to
read a file inside the service-archive (*.aar).
the file is in the same folder as the ServiceImpl-class and the
SerciveImpl-class wants to read the file as an inutStream.
I tried both ways:
> MessageContext ctx = MessageContext.getCurrentMessageContext();
> AxisService svc = ctx.getAxisService();
> ClassLoader loader = svc.getClassLoader();
> String filename = (String)svc.getParameterValue("file.txt");
> InputStream is = loader.getResourceAsStream(filename);
and
>getClass().getClassLoader().getResourceAsStream("file.txt");
Both ways don't find the file. If I debug my read-method, the loader
shows in both cases:
WebappClassLoader
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@cd5f8b
So, if I put the 'file.txt' to the /WEB-INF/classes/ -folder, I can read
the file.
How can I get the classloader of the single service, so I can read a
resouce that resides inside of an archive ?
Thanks,
Markus
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Confidentiality Notice: This email, including attachments, may include non-public, proprietary, confidential or legally privileged information. If you are not an intended recipient or an authorized agent of an intended recipient, you are hereby notified that any dissemination, distribution or copying of the information contained in or transmitted with this e-mail is unauthorized and strictly prohibited. If you have received this email in error, please notify the sender by replying to this message and permanently delete this e-mail, its attachments, and any copies of it immediately. You should not retain, copy or use this e-mail or any attachment for any purpose, nor disclose all or any part of the contents to any other person. Thank you
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
RE: READ a resource inside an aar
Posted by "Walker, Carleton" <Ca...@finra.org>.
Hi,
I put the file in the root folder of the AAR (not in the package
folders). I pass only a filename to the getResourceAsStream() without
any absolute or relative path.
-Carl
-----Original Message-----
From: Grimm, Markus [mailto:Grimm@juris.de]
Sent: Thursday, September 18, 2008 9:18 AM
To: axis-user@ws.apache.org
Subject: READ a resource inside an aar
Hi all,
a question similar to this message-context [1]
[1]
http://www.nabble.com/Path-to-a-resource-inside-an-aar-tp19506606p195083
56.html
I followed Deepal's link to http://wso2.org/library/259 and tried to
read a file inside the service-archive (*.aar).
the file is in the same folder as the ServiceImpl-class and the
SerciveImpl-class wants to read the file as an inutStream.
I tried both ways:
> MessageContext ctx = MessageContext.getCurrentMessageContext();
> AxisService svc = ctx.getAxisService();
> ClassLoader loader = svc.getClassLoader();
> String filename = (String)svc.getParameterValue("file.txt");
> InputStream is = loader.getResourceAsStream(filename);
and
>getClass().getClassLoader().getResourceAsStream("file.txt");
Both ways don't find the file. If I debug my read-method, the loader
shows in both cases:
WebappClassLoader
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@cd5f8b
So, if I put the 'file.txt' to the /WEB-INF/classes/ -folder, I can read
the file.
How can I get the classloader of the single service, so I can read a
resouce that resides inside of an archive ?
Thanks,
Markus
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Confidentiality Notice: This email, including attachments, may include non-public, proprietary, confidential or legally privileged information. If you are not an intended recipient or an authorized agent of an intended recipient, you are hereby notified that any dissemination, distribution or copying of the information contained in or transmitted with this e-mail is unauthorized and strictly prohibited. If you have received this email in error, please notify the sender by replying to this message and permanently delete this e-mail, its attachments, and any copies of it immediately. You should not retain, copy or use this e-mail or any attachment for any purpose, nor disclose all or any part of the contents to any other person. Thank you
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org