I'm not sure if you can reference a Properties from a bean.  How would 
you bind the Properties to JNDI?

I also have log4j setup for my beans.  I reference the log4j properties 
file as an <env-entry>, and look it up in the java:comp/env space.

Victor

----- Original Message -----
From: "Otis Gospodnetic" <[EMAIL PROTECTED]>
Date: Friday, May 11, 2001 9:18 am
Subject: [JBoss-user] How do I specify a resource (properties file) for 
a bean to look up

> Hello, 
> ��
> I am writing a bean for logging (using log4j), to be
> used by other beans. 
> I would like to do the following, but am unsure about
> where and how to define the log4j properties file as
> an EJB Container resource: 
> ��
> Make a properties-file available for the EJB Container
> as resource, define a logical name of this resource in
> the xml-files(Which ones? In the Deployment
> Descriptor? ejb-jar.xml?) 
> 
> So far I have:
> In ejb-jar.xml:
> ...
> <session>
>  <ejb-name>LogManagerEJB</ejb-name>
>  ...
>  <resource-ref>
>    <description>LogManager Properties File</description>
>    <res-ref-name>LogManagerProperties</res-ref-name> 
>    <res-type>java.util.Properties</res-type>
>    <res-auth>Container</res-auth>
>  </resource-ref>
> ...
> </session>
> 
> In my app's jboss.xml:
> ...
> <session>
>  <ejb-name>LogManagerEJB</ejb-name>
>  <jndi-name>util/LogManager</jndi-name>
> </session>
> ...
> 
> Is this right so far? Are those two linked via ejb-name
> (LogManagerEJB in both cases)?
> One thing that is definitely missing is the location of the
> properties file, a path to it.
> How and where would I specify that?
> 
> 
> I assume that after I get the above right I could then
> somehow ask for this resource from within my logging
> bean and configure log4j based on the properties from
> that config/properties resource file. 
> 
> It seems in my LogManagerBean I would write something like:
> 
> Properties p = (Properties)(new
> InitialContext()).lookup("???");
> 
> What goes in place of '???'?
> 
> 
> Still learning... :)
> Thank you,
> ��
> Otis
> 
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
>


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to