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

 
 


milind
Error in simple session bean ..................
1 Answer(s)      2 years and 3 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
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 Pages:
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
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
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
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
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
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
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
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
An Entity Bean Example
, such as relational database an entity bean persists across multiple session and can... Implement the Annotated Session Bean: BookCatalogBean... the database. We use EJB3 session bean POJOs to implement the business logic
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 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
session
session  Which methods can be invoked by the container on a stateless session bean
Bean
visit the following links: http://www.roseindia.net/jsp/simple-jsp-example
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:->
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
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
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
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
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
Simple EJB3.0 - EJB
;>> my question is how to make session bean and how to access this session bean on servlet/jsp. thanQ  Hi Friend, Please visit...Simple EJB3.0  Hi friends... I am new user
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
A Message-Driven Bean Example
. A message-driven bean has only a bean class i.e. unlike a session bean... of a simple message-driven bean application. In this example, we are going to implement.... It can call helper methods, or invoke a session bean to process the information
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
Stateful Session Beans Example, EJB Tutorial
Stateful Session Bean Example   ... stateful session bean. The purpose of account is to performs two transaction...: The enterprise bean in our example is a statelful session bean called AccountBean
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
first entity bean example in eclipse europa - EJB
first entity bean example in eclipse europa  pls provide steps to create simple ejb3.0 application in eclipse .And also how to create entity bean ,session bean in ejb3.0  Hi Friend, Please visit the following links
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
Building a Simple EJB Application Tutorial
create a new Session Bean from the Project Explorer (EJB Projects -> Simple EJB...)  Introduction In this tutorial we will create a simple session... a Session Bean Open the J2EE perspective in eclipse (Windows -> Open Perspective
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
error
error  The content of element type "struts" must match "(package|include|bean|constant
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 the output of JSP program using Bean
through a simple program below and give the solution for the said below one...; <jsp:useBean id="counter" scope="session" class="CounterBean" /> <HTML> <HEAD><TITLE>Use Bean Counter Example</TITLE> <
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
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
pls provide steps to write ejb3.0 simple application in eclipse - EJB
pls provide steps to write ejb3.0 simple application in eclipse   hi, pls provide steps to create simple ejb3.0 application in eclipse .And also how to create entity bean ,session bean in ejb3.0
Send Mail Bean
Send Mail Bean     In our application we have developed mailer bean that sends welcome email when a new user is registered to the system. Mail Bean also used when user
A Message-Driven Bean Example
. A message-driven bean has only a bean class i.e. unlike a session bean... of a simple message-driven bean application. In this example, we are going... methods, or invoke a session bean to process the information in the message
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
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
Session scope
Session scope  Hii i m java beginner i just started learning java and i just started the topic of session tracking . I want to know about session scopes that is application ,page ,session etc etc and also their uses if possible
JSP Simple Examples
Beans And Session Scope session scope: In this the bean...; Generate Error In JSP In software engineering, the term refers... we can say that the error results from a combination of a defect
simple eg
simple eg   <?php</li> $string = ?Hello Users?; print (?Welcome to Roseindia, I want to greet $string?); print (??); $string = ?Bye Bye!?; print (?OK meet you soon, $string?); ?> in this program we get a error at line

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.