<env-entry> recieving error
daviddryparry Dec 15, 2001 8:10 PMI am trying to just have a reference to a class name so that my bean can reference cast to it.
I have this in my jboss.xml file:
<enterprise-beans>
<ejb-name>Interest</ejb-name>
<jndi-name>interest/Interest</jndi-name>
</enterprise-beans>
<env-entry>
<env-entry-name>env/TestClass</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>com.common.TestClass</env-entry-value>
</env-entry>
Then I have this code in the client:
package org.jboss.docs.interest;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import org.jboss.docs.interest.Interest;
import org.jboss.docs.interest.InterestHome;
/** This simple application tests the 'Interest' Enterprise JavaBean which is
implemented in the package 'org.jboss.docs.interest'. For this to work, the
Bean must be deployed on an EJB server.
*/
class InterestClient
{
/** This method does all the work. It creates an instance of the Interest EJB on
the EJB server, and calls its `calculateCompoundInterest()' method, then prints
the result of the calculation.
*/
public static void main(String[] args)
{
// Enclosing the whole process in a single `try' block is not an ideal way
// to do exception handling, but I don't want to clutter the program up
// with catch blocks
InitialContext jndiContext = null;
Object ref = null;
try
{
// Get a naming context
jndiContext = new InitialContext();
System.out.println("Got context");
}
catch(Exception e)
{
System.out.println("error in getting context" + e.toString());
}
try
{
// Get a reference to the Interest Bean
ref = jndiContext.lookup("interest/Interest");
System.out.println("Got reference");
}
catch(Exception e)
{
System.out.println("error in getting Object " + e.toString());
}
try
{
Object two = jndiContext.lookup("env/TestClass"); // It is erroring here.
System.out.println("Got reference");
System.out.println("reference name:" + ref);
}
catch (Exception e)
{
System.out.println("error in getting StatDaoClass " + e.toString());
}
}
}
I get this error: javax.naming.NameNotFoundException: env not bound
I put this with the Interest Client that comes with the examples so that everyone has most of the code. I just need to get this value <env-entry-value>com.common.TestClass</env-entry-value>
I would really appreciate it.
David