GeeCON Prague 2014*
The moose likes EJB and other Java EE Technologies and the fly likes EJB Runtime error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB Runtime error" Watch "EJB Runtime error" New topic
Author

EJB Runtime error

Rashmee H S
Greenhorn

Joined: May 29, 2008
Posts: 6
Hi
I am getting this error while running my Ejb application
plese help me......
I done these things in my application

jboss.xml:
<?xml version="1.0" encoding="UTF-8"?>
<jboss>
<display-name>sessionBeanExp</display-name>
<enterprise-beans>
<session>
<display-name>CcountBeanExp</display-name>
<ejb-name>CcountBean</ejb-name>
<home>vtcbean.CcountHome</home>
<remote>vtcbean.CcountObject</remote>
<ejb-class>vtcbean.CcountBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
<security-identity>
<description></description>
<run-as-principal></run-as-principal>
<use-caller-identity></use-caller-identity>
</security-identity>
<jndi-name>sessionBean/remote</jndi-name>
<local-jndi-name>sessionBean/local</local-jndi-name>
</session>
</enterprise-beans>
</jboss>

and getting "sessionBean/Bean" as My Jndi-name
and in my client application
InitialContext ic=new InitialContext();
Object ref=ic.lookup("sessionBean/remote");
System.out.println(ref);
CcountHome home=(CcountHome)PortableRemoteObject.narrow(ref,CcountHome.class);
CcountObject count=home.create();
System.out.println(str);
System.out.println("Upper is"+count.upper(str));
System.out.println("Lowe is"+count.lower(str));
System.out.println("Spaces are"+count.space(str));
System.out.println("Characters are"+count.space(str));
After compiling if i run this application it will give this error
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at ejbUsage.UseEjb.main(UseEjb.java:16)

Please help me .....................

[ June 06, 2008: Message edited by: Rashmee Hs ]
[ June 06, 2008: Message edited by: Rashmee Hs ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"Rashmee Hs",
Please check your private messages regarding an important administrative matter.
-Ben


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"Rashmee H S",
Please check your private messages.
-Ben
Amit M Tank
Ranch Hand

Joined: Mar 28, 2004
Posts: 257
You have to setup your InitialContext properly.



Amit Tank
Linked In
 
GeeCON Prague 2014
 
subject: EJB Runtime error