I have previously posted question about retrieving DataSource. We have found 
workaround for this (see my previous mail). 
Now we have a very similar problem with reading bean's environment 
properties, which makes me wondering if this is not bug in Jonas.

Our stateless session beans have DD similar to attached one. Each of them 
contains environment property DOCUMENT_DB_TABLE. The base class from which 
all the session beans are derived tries to read this property and it fails. 

The code
         objDocDBTable = ctcContext.lookup("java:comp/env/DOCUMENT_DB_TABLE");
         if (objDocDBTable instanceof String)
         {
            String strDocTable = (String)objDocDBTable;
            System.out.println("Value of java:comp/env/DOCUMENT_DB_TABLE is " 
+ strDocTable);
         }
         else
         {
            System.out.println("Value of java:comp/env/DOCUMENT_DB_TABLE is 
not defined");
         }

always returns an object of type org.objectweb.jonas.jtm.Current.
In fact every of following queries 
         Object objDocDBTable = ctcContext.lookup("java:comp");
         objDocDBTable = ctcContext.lookup("java:comp/");
         objDocDBTable = ctcContext.lookup("java:comp/env");
         objDocDBTable = ctcContext.lookup("java:comp/env/");
         objDocDBTable = ctcContext.lookup("java:comp/env/DOCUMENT_DB_TABLE");
         objDocDBTable = ctcContext.lookup("java:comp/env/document_db_table");

returns object of type org.objectweb.jonas.jtm.Current
This makes me wonder, because I thought that the lookup should throw JNDI 
NamingException if the name doesn't exist. We have tried the old method using 
getEnvironment() but that doesn't work either. Is maybe our deployment 
descriptor incorrect? Nor JOnas or compiler complain about them? Could you 
please help us to figure out where is the problem? Does anybody else have 
problem using environment properties? Thank you for your help.

Your sincerely 

Miroslav Halas
Compuware Corp.
[EMAIL PROTECTED]

Here is example of DD very similar to one provided in Jonas examples.

<!DOCTYPE ejb-jar SYSTEM "ejb-jar_1_1.dtd">
<ejb-jar>
   <enterprise-beans>
      <session>
         <description>Deployment descriptor for 
aqp.beans.busreq.BusinessRequirementController bean</description>
         <ejb-name>aqp.beans.busreq.BusinessRequirementController</ejb-name>
         <home>aqp.beans.busreq.BusinessRequirementControllerHome</home>
         <remote>aqp.beans.busreq.BusinessRequirementController</remote>
         
<ejb-class>aqp.beans.busreq.BusinessRequirementControllerBean</ejb-class>
         <session-type>Stateless</session-type>
         <transaction-type>Container</transaction-type>
         <env-entry>
            <env-entry-name>DOCUMENT_DB_TABLE</env-entry-name>
            <env-entry-type>java.lang.String</env-entry-type>
            <env-entry-value>T_BUSINESS_REQUIREMENT</env-entry-value>
         </env-entry>
      </session>
   </enterprise-beans>
   <assembly-descriptor>
      <container-transaction>
         <method>
            
<ejb-name>aqp.beans.busreq.BusinessRequirementController</ejb-name>
            <method-name>*</method-name>
         </method>
         <trans-attribute>Required</trans-attribute>
      </container-transaction>
   </assembly-descriptor>
</ejb-jar>

----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".

Reply via email to