Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javax.naming NoInitialContextException

 
prakash ayyardevar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

My Environment:
OS = HP-UX
App. Server = JBoss 4.0

Problem:
I have created an Entity EJB bean and succesfully deployed in JBoss. But while trying to access the EJB through an client program there is an exception javax.naming.NoInitialContextException.

Files in the Deployed JAR file:
Cabin.class - Remote Interface
CabinBean.class - Bean Implementation
CabinHome.class - Home Interface
CabinPK.class - primary key files
ejb-jar.xml - Deployment Descriptor

Content of Deployment Descriptor:

<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 1.1//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd">


<ejb-jar>
<enterprise-beans>
<entity>
<description>
This is the first bean, Cabin bean.
</description>
<ejb-name>CabinBean</ejb-name>
<jndi-name>MyBeain</jndi-name>
<local-jndi-name>MyLocalBean</local-jndi-name>
<home>com.titan.cabin.CabinHome</home>
<remote>com.titan.cabin.Cabin</remote>
<ejb-class>com.titan.cabin.CabinBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>com.titan.cabin.CabinPK</prim-key-class>
<reentrant>false</reentrant>

<cmp-field><field-name>id</field-name></cmp-field>
<cmp-field><field-name>name</field-name></cmp-field>
<cmp-field><field-name>deckLevel</field-name></cmp-field>
<cmp-field><field-name>bedCount</field-name></cmp-field>
<cmp-field><field-name>ship</field-name></cmp-field>
</entity>
</enterprise-beans>
<assembly-descriptor>
<security-role>
<description>
roles are described.
</description>
<role-name>everyone</role-name>
</security-role>

<method-permission>
<role-name>everyone</role-name>
<method>
<ejb-name>CabinBean</ejb-name>
<method-name>*</method-name>
</method>
</method-permission>

<container-transaction>
<method>
<ejb-name>CabinBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>


Thanks in Advance
Prakash.A
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic