Hi,
I am pretty new to
EJB TEchnology. I am trying to create a simple stateless Session bean and trying to access through a Client program. I Am using BEA Weblogic Server 8.1.
This is my ejb-jar.xml
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems,
Inc.//DTD Enterprise JavaBeans 2.0//EN"
"http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd">
<ejb-jar>
<description></description>
<enterprise-beans>
<session>
<display-name>Converter</display-name>
<ejb-name>Converter</ejb-name>
<home>bean.ConverterHome</home>
<remote>bean.Converter</remote>
<ejb-class>bean.ConverterBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
And this is my weblogic-ejb-jar.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
** This file was automatically generated by EJBGen 9.0
** Build: 20040513-1205
-->
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>Converter</ejb-name>
<jndi-name>Converter</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
My Client program is somehting like this :-
import bean.ConverterHome;
import bean.Converter;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import java.util.*;
public class ConverterClient
{
public static void main(
String args[]) throws Exception
{
Properties prop = new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
prop.put(Context.PROVIDER_URL,"t3://localhost:7001");
Context initialContext = new InitialContext(prop);
ConverterHome home = (ConverterHome) initialContext.lookup("java:comp/env/Converter");
Converter currencyConverter = home.create();
System.out.println(currencyConverter.displayMessage());
}
}
However i keep on getting this expcetion
Exception in
thread "main" javax.naming.NameNotFoundException: While trying to lookup '
java:comp.env/Converter' didn't find subcontext 'java:comp'. Resolved ''
[Root exception is javax.naming.NameNotFoundException: While trying to lookup 'j
ava:comp.env/Converter' didn't find subcontext 'java:comp'. Resolved '']; remain
ing name 'java:comp/env/Converter'
Any Suggesiton would be welcomed. Thanking in advance,
Regards,