Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa EJB Error in simple session bean ..................
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


milind
Error in simple session bean ..................
1 Answer(s)      3 years and 8 months ago
Posted in : EJB


Hi friends,

i am trying a simple HelloWOrld EJb on Websphere Applicatiopn server 6.1. Can any one plz help me to solve this issue.

here is the client code which i have written.

package com.ibm.pck;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import com.ibm.ejb.example;
import com.ibm.ejb.exampleHome;

public class exampleClient {
    public static void main(String args[]) {
    try {
        Properties props = new Properties();
        props.put(Context.INITIAL<em>CONTEXT</em>FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory ");
        props.put(Context.PROVIDER_URL, "iiop://localhost:900");
        Context initialContext = new InitialContext(props);
        Object objref = initialContext.lookup("ejb/com/ibm/ejb/exampleHome"); <br />
        exampleHome home = (exampleHome)PortableRemoteObject.narrow(objref, exampleHome.class); <br />
        example myHelloWorld = home.create(); <br />
        String message = myHelloWorld.sayHello(); <br />
        System.out.println(message); <br />
    } 
    catch (Exception e) {
        e.printStackTrace(); <br />
        System.exit(2);
    }
    }
}

i am getting these errors while i am runnign above client.

javax.naming.NoInitialContextException: Cannot instantiate class: com.ibm.websphere.naming.WsnInitialContextFactory  [Root exception is java.lang.ClassNotFoundException: com.ibm.websphere.naming.WsnInitialContextFactory ]
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:669)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:259)
    at javax.naming.InitialContext.init(InitialContext.java:235)
    at javax.naming.InitialContext.<init>(InitialContext.java:209)
    at com.ibm.pck.exampleClient.main(exampleClient.java:21)
Caused by: java.lang.ClassNotFoundException: com.ibm.websphere.naming.WsnInitialContextFactory 
    at java.lang.Class.forName(Class.java:164)
    at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:57)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:666)
    ... 4 more

Advertisement
View Answers

February 14, 2011 at 2:49 PM


EJB Hello World Example

Please visit the following links:

http://www.roseindia.net/ejb/ejb-hello-world.shtml

http://www.roseindia.net/ejb/



Related Tutorials/Questions & Answers:
Error in simple session bean ..................
Error in simple session bean ..................  Hi friends, i am trying a simple HelloWOrld EJb on Websphere Applicatiopn server 6.1. Can any one plz help me to solve this issue. here is the client code which i have
Stateless Session Bean Example Error
Stateless Session Bean Example Error  Dear sir, I'm getting following error while running StatelessSessionBean example on Jboss. Please help me...)   Please visit the following link: Stateless Session Bean Example
Advertisements
stateless session bean with methods error - Java Beginners
stateless session bean with methods error  I have to create stateless session bean with 3 methods and then create a servlet which remotely calls all three methods in that session bean. I have 4 files created-index.jsp under web
EJB Deployment how to create a simple ejd session bean and how to do project setup
EJB Deployment how to create a simple ejd session bean and how to do project setup  dear sir, i have Eclipse Helios, Jboss4.0.4CR, and Xdoclet, jdk 1.6 installed in my system. how to create a simple ejd session bean and how
Steps to create simple EJb 2.1 (Session Bean) and deploy on websphere application server 6.0,
Steps to create simple EJb 2.1 (Session Bean) and deploy on websphere application server 6.0,  Hi friends, I am trying to create simple hello world session bean having Java client. but i am unable to run it on Websphere
Session Bean
is a Session bean   A session bean is the enterprise bean that directly.... A session bean represents a single client accessing the enterprise application.... A session bean makes an interactive session only for a single client and shields
Stateful Session Bean Example
Stateful Session Bean Example   ... using stateful session bean. The purpose of account is to performs two... bean: The enterprise bean in our example is a statelful session bean called
Session Bean Example
Session Bean Example  I want to know that how to run ejb module by jboss 4.2.1 GA (session bean example by jboss configuration )?   Please visit the following link: http://www.roseindia.net/javabeans
Stateless Session Bean Example
Stateless Session Bean Example   ... stateless session bean. The purpose of example is to performs the mathematical... bean: The enterprise bean in our example is a stateless session bean called
Issue in Stateless session bean example
Issue in Stateless session bean example  Hi Team, I tried your Stateless session bean example in the path http://www.roseindia.net/ejb/examples-of-StatelessBean.shtml. I got the below exception can you plese guide to rectify
Stateless Bean Error
Stateless Bean Error  Ejb stateless bean giving following error,please help me. 11:49:54,894 INFO [STDOUT] Error:$Proxy72 cannot be cast... are providing you a link that will illustrate you more clearly about Stateless Bean
Writing Calculator Stateless Session Bean
Writing Calculator Stateless Session Bean... javax.ejb.EJBObject. Remote interface is the client view of session bean. Methods defined... for our Calculator Session Bean:   /* * 
calling a session bean bean from servlet using netbeans - EJB
calling a session bean from servlet using netbeans  How to call a session bean from servlet using netbeans in Java
Deploying and testing Stateless Session Bean
Deploying and testing Stateless Session Bean... Session Bean developed in the last section. We will use ant build tool to build... learnt how to deploy Session Bean and test on Web Logic Server
methods can be invoked by the container on a stateless session bean
methods can be invoked by the container on a stateless session bean  Which of the following methods can be invoked by the container on a stateless session bean
Stateful and Stateless Session Bean Life Cycle
Understanding Stateful and Stateless Session Bean Life Cycle... Bean Life cycle There are two stages in the Lifecycle of Stateless Session Bean... container creates the new instance of the Bean and then sets the session context
Chapter 4. Session Bean Life Cycle
Chapter 4. Session Bean Life CyclePrev Part I. ... the life cycle of a stateful or stateless session bean instance. Stateful Session Bean A session bean
Rose India Stateless Session Bean Example Question
Rose India Stateless Session Bean Example Question  Hi Team, Is this example can be compiled using NetBeans and Glass Fish ? Actually, in descriptor .xml file it is shown that it can be run by using JBoss and Apache Ant. If I
Writing Deployment Descriptor of Stateless Session Bean
Writing Deployment Descriptor of Stateless Session Bean... for the session bean. We need the deployment descriptor for application... session bean is TestSessionBean, we will call this bean from servlet
how to get session object in simple java class??
how to get session object in simple java class??  i am fallowing a simple mvc architecture. actually my problem is.... i am using 4 classes in my... into session. so, please tell me, how to get the session object (GroupPojo) in a simple
Chapter 2. Client View of a Session Bean
or examples about the client view of a session bean's local and remote home interfaces, including the code used by a client to locate a session bean's... for the Cart session bean can be located using the following code segment
Writing Session bean - Session Bean Example with Source Code
Writing Session bean In this lesson you will learn how to develop Hello World Session Bean. We will use ant to build the application. Our application will be deployed on the Web Logic Application for testing. What is Session Bean
spring3 mvc appliation bean definition not found error
the following error, can you suggest me how to solve. The error message is: Error creating bean with name...spring3 mvc appliation bean definition not found error  hi I
spring3 mvc appliation bean definition not found error
execute it shows index page, when I click on link it shows the following error Error creating bean with name...spring3 mvc appliation bean definition not found error  hi deepak I
Identify the use and the behavior of the ejbPassivate method in a session bean, including the responsibilities of both the container and the bean provider.
in a session bean, including the responsibilities of both the container and the bean provider. Prev Chapter 3. Session Bean... of the ejbPassivate method in a session bean, including
developing a Session Bean and a Servlet and deploy the web application on JBoss 3.0
Writing Stateless Session Bean and Calling through Servlet... I will show you how to develop a Stateless Session Bean and a Servlet...-client multitiered consisting of jsp, servlet and session bean
Compilation Error in Java Bean - Java Beginners
Compilation Error in Java Bean  Hello Sir, Please Help me to resolve... server.I received a compiler error. Structure is: application folder> Html file...;.java file > web.xml file Compiler Error:->
Identify the interface and method for each of the following: retrieve the session bean's remote home interface, retrieve the session bean's local component interface, determine if the sessio
: retrieve the session bean's remote home interface, retrieve the session bean's local component interface, determine if the session bean's caller has... transaction has completed. Prev Chapter 3. Session Bean
session realtime usage program simple jsp program or servlet ,which understands me importance of session
session realtime usage program simple jsp program or servlet ,which understands me importance of session  I knew importance of session theoritically like client state storage scope.,but jsp or servlet realtime simple session
developing a Session Bean and a Servlet and deploy the web application on JBoss 3.0
a Calculator Stateless Session Bean and call it through JSP file  and deploy... the MyTestSession Session Bean developed in Lesson 3. Infact we will use the same... create our Calculator Session Bean write the deployment descriptor. Writing
Given a list of responsibilities related to session beans, identify those which are the responsibility of the session bean provider and those which are the responsibility of the EJB contai
which are the responsibility of the session bean provider and those...;Chapter 3. Session Bean Component Contract Next    ... which are the responsibility of the session bean provider and those which
 

 

 

DMCA.com