Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-07-2008, 05:31 PM
Member
 
Join Date: Jul 2008
Posts: 12
parimal is on a distinguished road
problem in accessing EJB
Hi
I am getting problem to access ejb in struts framework..
while I am going to instantiate ejb class through that is displaying error like:
"Error: cannot access class javax.ejb.EJBHome; file javax\ejb\EJBHome.class not found"

My code is below:

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Locale;
import java.util.Vector;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.struts.action.*;
public class TestActionHandler extends Action
{
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException, NamingException {
testSessionEJBHome testSessionBean;
InitialContext ctx=new InitialContext();
Object objref = ctx.lookup("SessionEJB");
testSessionBean = (testSessionEJBHome)PortableRemoteObject.narrow(ob jref,testSessionEJBHome.class);
TestFormBean tform = (TestFormBean) form;
request.setAttribute("TestFormBean", tform);
String name=tform.getIpString();
String tmpStr = "Welcome " + name + " !";
tform.setIpString(tmpStr);
if(name.equals("suvankar"))
return (mapping.findForward("failure"));
else
return (mapping.findForward("success"));

}
}

Please help me out
__________________
Parimal
java heart
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing list out another class Preethi New To Java 23 10-26-2008 04:54 PM
Accessing database through applet sukatoa Java Applets 1 07-08-2008 05:49 PM
Accessing Beans (EJB) JavaForums Java Blogs 0 04-03-2008 08:21 PM
accessing cddrive milinkp AWT / Swing 2 02-06-2008 10:38 AM
Accessing Data from a .txt file Oasis13 New To Java 5 02-01-2008 02:16 AM


All times are GMT +3. The time now is 01:02 PM.


VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org