Hi RVic,
RVic said:
Ok, but what file do I find <env-entry> in? Is it in an xml file in
MANIFEST-INF? Or is it in an xml file I put in my deploy directory
(Using JBoss 5.1, ejb 3.0) Thank you so much. RVic
You place env-entry constants in:
META-INF/ejb-jar.xml
"The ejb-jar file must contain the deployment descriptor (if any) in the
format defined in Chapter 19. The
deployment descriptor must be stored with the name META-INF/ejb-jar.xml in
the ejb-jar file." [1, p540]
See an example of ejb-jar.xml below taken from that same spec [1, p411] and
the configurable attributes declared as [1, p412]:
// The maximum number of tax exemptions, configured by the Deployer.
@Resource int maxExemptions = 4; // defaults to 4
Another interesting reason to avoid reading even from the same ejb jar [1,
p546]:
"The enterprise bean must not attempt to directly read or write a file
descriptor.
Allowing the enterprise bean to read and write file descriptors directly
could compromise security."
HTH,
Best regards,
Giovanni
<?xml version = '1.0' encoding = 'windows-1252'?>
<ejb-jar version="3.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/ejb-jar_3_0.xsd">
<enterprise-beans>
<session>
...
<ejb-name>EmployeeService</ejb-name>
<ejb-class>com.wombat.empl.EmployeeServiceBean</ejb-class>
...
<env-entry>
<description>
The maximum number of tax exemptions
allowed to be set.
</description>
<env-entry-name>maxExemptions</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
<env-entry-value>15</env-entry-value>
</env-entry>
<env-entry>
<description>
The minimum number of tax exemptions
allowed to be set.
</description>
<env-entry-name>minExemptions</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
<env-entry-value>1</env-entry-value>
</env-entry>
<env-entry>
<env-entry-name>foo/name1</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>value1</env-entry-value>
</env-entry>
<env-entry>
<env-entry-name>foo/bar/name2</env-entry-name>
<env-entry-type>java.lang.Boolean</env-entry-type>
<env-entry-value>true</env-entry-value>
</env-entry>
<env-entry>
<description>Some description.</description>
<env-entry-name>name3</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
</env-entry>
<env-entry>
<env-entry-name>foo/name4</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
<env-entry-value>10</env-entry-value>
</env-entry>
...
</session>
</enterprise-beans>
<interceptors/>
<assembly-descriptor/>
</ejb-jar>