Re: [JBoss-user] read file for EJB

2003-08-29 Thread Adrian Brock
That works as well, but it isn't very portable.

If you have an mbean you can specify
${jboss.server.data.dir}/myfolder/23.xml"

Regards,
Adrian

On Fri, 2003-08-29 at 13:55, Stefan Groschupf wrote:
> File file = new File(System.getProperty("jboss.server.data.dir") + "/" + 
> "myFolder/23.xml");
> 
> point to / jbosshome/server/yourConfig/data/myFolder...
> 
> HTH Stefan.
> 
> 
> Milen Dyankov wrote:
> 
> > Hi,
> >
> > suppose I have EJB that needs to read some configuration data from 
> > external file (lets say an XML file).
> > Where I'm supposed to place this config file, and how can I tell my 
> > EJB where it is?
> >
> > I've tried to pack both the EJB and "config.xml" in jar and use 
> > something like
> >
> > File file = new File("config.xml");
> >
> > but it looks like my EJB is expecting to find "config.xml" in
> > "/path/to/jboss/bin" folder.
> >
> >
> >
> >
> > ---
> > This sf.net email is sponsored by:ThinkGeek
> > Welcome to geek heaven.
> > http://thinkgeek.com/sf
> > ___
> > JBoss-user mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/jboss-user
> >
> 
> 
> 
> 
> ---
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> ___
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user



---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] read file for EJB

2003-08-29 Thread Adrian Brock
Use a resource-ref to define a URL. (The most portable mechanism)

Or classloader.getResource[AsStream]() and put the file in your
deployment or the /conf folder if it is shared.

Regards,
Adrian

On Fri, 2003-08-29 at 13:02, Milen Dyankov wrote:
> Hi,
> 
> suppose I have EJB that needs to read some configuration data from external file 
> (lets say an XML file).
> Where I'm supposed to place this config file, and how can I tell my EJB where it is?
> 
> I've tried to pack both the EJB and "config.xml" in jar and use something like
> 
> File file = new File("config.xml");
> 
> but it looks like my EJB is expecting to find "config.xml" in
> "/path/to/jboss/bin" folder.
> 
> 
> 
> 
> ---
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> ___
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user



---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] read file for EJB

2003-08-29 Thread Anders Engström
On Fri, Aug 29, 2003 at 02:02:23PM +0200, Milen Dyankov wrote:
> Hi,
> 
> suppose I have EJB that needs to read some configuration data from external 
> file (lets say an XML file).
> Where I'm supposed to place this config file, and how can I tell my EJB 
> where it is?
> 
> I've tried to pack both the EJB and "config.xml" in jar and use something 
> like
> 
> File file = new File("config.xml");
> 
> but it looks like my EJB is expecting to find "config.xml" in
> "/path/to/jboss/bin" folder.
> 

Filesystem access from an EJB is not recommended according to the
specification. But - if you have packaged the config.xml in a jar, and
the jar is on the classpath, use the following construct:

InputStream in =
Thread.currentThread().getContextClassLoader().getResourceAsStream("config.xml");

then read from the InputStream.

//Anders

-- 
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. Anders Engström [EMAIL PROTECTED]
. http://www.gnejs.netPGP-Key: ED010E7F
. [Your mind is like an umbrella. It doesn't work unless you open it.]  



pgp0.pgp
Description: PGP signature


Re: [JBoss-user] read file for EJB

2003-08-29 Thread Stefan Groschupf
File file = new File(System.getProperty("jboss.server.data.dir") + "/" + 
"myFolder/23.xml");

point to / jbosshome/server/yourConfig/data/myFolder...

HTH Stefan.

Milen Dyankov wrote:

Hi,

suppose I have EJB that needs to read some configuration data from 
external file (lets say an XML file).
Where I'm supposed to place this config file, and how can I tell my 
EJB where it is?

I've tried to pack both the EJB and "config.xml" in jar and use 
something like

File file = new File("config.xml");

but it looks like my EJB is expecting to find "config.xml" in
"/path/to/jboss/bin" folder.


---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user




---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user