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 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
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
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
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
Stateful Session Bean Example
Stateful Session Bean Example   ... using stateful session bean. The purpose of account is to performs two... is a statelful session bean called AccountBean. The account session bean
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... is a stateless session bean called CalculatorBean. The source code
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
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
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
Writing Calculator Stateless Session Bean
Writing Calculator Stateless Session Bean... javax.ejb.EJBObject. Remote interface is the client view of session bean. Methods... Session Bean:ADS_TO_REPLACE_5   /* * 
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
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... In this lesson we learnt how to deploy Session Bean and test on Web Logic Server
Stateful and Stateless Session Bean Life Cycle
Understanding Stateful and Stateless Session Bean Life Cycle... Session Bean. These are: a) Does Not Exist In the Does Not Exist stage, bean... Diagram shows the Life cycle of Stateless Session Bean
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...;display-name>Stateless Session Bean Example</dislay-name> <module>
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
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
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
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
session
session  Which methods can be invoked by the container on a stateless session bean
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
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:->
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. ADS
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
Error : javax.servlet.jsp.JspException: Cannot find bean org.apache.struts.taglib.html.BEAN in any scope
Error : javax.servlet.jsp.JspException: Cannot find bean org.apache.struts.taglib.html.BEAN in any scope  I am getting following error in my struts-jsp proram for adding data to the database. 500 Internal Server Error
Fatal error: Call to undefined function session_register() in .php file
Fatal error: Call to undefined function session_register() in .php file  I upgraded the PHP and MySQL and in my application following error is coming: Fatal error: Call to undefined function session_register() in ...php file
ModuleNotFoundError: No module named 'django-simple-error'
ModuleNotFoundError: No module named 'django-simple-error'  Hi, My... named 'django-simple-error' How to remove the ModuleNotFoundError: No module named 'django-simple-error' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-simple-error'
ModuleNotFoundError: No module named 'django-simple-error'  Hi, My... named 'django-simple-error' How to remove the ModuleNotFoundError: No module named 'django-simple-error' error? Thanks   Hi
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
Identify correct and incorrect statements or examples about the client view of a session bean's local and remote component interfaces.
the client view of a session bean's local and remote component interfaces... the client view of a session bean's local and remote component interfaces... to the session bean instance.Get the session object’s remote home interface.ADS
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.ADS_TO_REPLACE_1
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
Match the correct description about purpose and function to which session bean type they apply: stateless, stateful, or both.
session bean type they apply: stateless, stateful, or both. Prev Chapter 3. Session Bean Component Contract Next  ... to which session bean type they apply: stateless, stateful, or both
Session Beans
; What is a Session bean   A session bean is the enterprise bean... of the enterprise application. A session bean represents a single client accessing... to the application. A session bean makes an interactive session only for a single
Java Session Beans
; A session bean is the enterprise bean that directly interacts with the user and contains the business logic of the enterprise application. A session bean...-server session. A session bean performs and handles operations, such as calculations
i have got error while compiling simple tag handler
i have got error while compiling simple tag handler   javac.servlet.jsp not found! tell me what are the jar files required to run simple tag handler...;it is : javax.servlet.jsp only but getting error wt is reason
Session
Session   how to session maintaining in servlet with use of hidden fieds
session
session  is there any possibility to call one session from another session
session
session  is there any possibility to call one session from another session
session
session  Session management in Java
Bean
Bean  what is bean? how to use bean   HTML Code: Contents MOBILE STORE HOME PRODUCTS IMAGES COMPANY...) { out.println("Error "+E); } finally { rs.close(); con.close(); } %>
Session
Session  How fined session is new or old
I am getting error org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'IS_AUTHENTICATED_ANONYMOUSLY' is defined - Spring
I am getting error org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'IS_AUTHENTICATED_ANONYMOUSLY' is defined  Hello, I am getting error
Session
Session   How can we set the inactivity period on a per-session basis?   We can set the session time out programmatically by using the method setMaxInactiveInterval() of HttpSession
session
Session Management in PHP  Handling session in PHP. Can anyone please explain it with the help of an existing example about, how to handle a session while a user is logged in PHP

Ads