How can I call EJB from JSP/Servlets in iWS?

Hi!!
My JSP/Servlets are on iWS, and I deploy EJB on iAS.
In this case, I don't know how JSP/Servlet call EJb on iAS.
I'd like to know how I can set JNDI name in JSP/Servlet on iWS.
I will thank you if you give me a simple example source using JSP/Servlet
and EJB.
Thanks in advance!!!
- Park-

Park,
Why Are you running your JSP/Servlets in iWS instead of iAS? For whatever
reason,
look at the Converter sample from iAS. You will be doing RMI/IIOP in this
case and the sample explains in detail what to do.
hth,
-robert
"SungHyun, Park" <[email protected]> wrote in message
news:9jpfmt$[email protected]..
Hi!!
My JSP/Servlets are on iWS, and I deploy EJB on iAS.
In this case, I don't know how JSP/Servlet call EJb on iAS.
I'd like to know how I can set JNDI name in JSP/Servlet on iWS.
I will thank you if you give me a simple example source using JSP/Servlet
and EJB.
Thanks in advance!!!
- Park-

Similar Messages

  • HOW can I call EJB with JSP?

    Hi, I'm working with JSP and want to include some EJB. I dont know how can I access EJB through JSP. I dont know if I use the right code in JSP for calling EJB. Did someone know how to use that? Can someone tell me if is the right code in JSP in my example?
    Thanks, Kristjan
    THIS IS THE JSP: (useejb.jsp)
    <%@ taglib uri="http://xmlns.oracle.com/j2ee/jsp/tld/ojsp/ejbtaglib.tld" prefix="EJB" %>
    <%@ page import="mypackage1.MySessionEJB" %>
    <%@ page import="mypackage1.MySessionEJBHome" %>
    <%@ page import="mypackage1.impl.MySessionEJBBean" %>
    <HTML>
    <head><TITLE>USEBEAN</TITLE></head>
    <body>
    <EJB:useHome id="mySessionEJBHome" type="mypackage1.MySessionEJBHome" location="java:comp/env/ejb/mySessionEJB" local="false" />
    <EJB:useBean id="mySessionEJBBean" type="mypackage1.impl.MySessionEJBBean" local="false">
    <EJB:createBean instance="<%=mySessionEJBHome.create() %>" />
    </EJB:useBean>
    <%= mySessionEJBBean.calc() %>
    </body>
    </html>
    THIS IS THE EJB CODE:(MySessionEJBBean.java)
    package mypackage1.impl;
    import javax.ejb.SessionBean;
    import javax.ejb.SessionContext;
    import java.lang.String.*;
    public class MySessionEJBBean implements SessionBean
    public void ejbCreate(){}
    public void ejbActivate(){}
    public void ejbPassivate(){}
    public void ejbRemove(){}
    public void setSessionContext(SessionContext ctx){}
    public String calc(String value)
    return value + value;
    public String zanka(String x)
    return x;
    (MySessionEJB.java)
    package mypackage1;
    import javax.ejb.EJBObject;
    import java.rmi.RemoteException;
    public interface MySessionEJB extends EJBObject
    public String calc(String value) throws RemoteException;
    String zanka(String x) throws RemoteException;
    (MySessionEJBHome.java)
    package mypackage1;
    import javax.ejb.EJBHome;
    import java.rmi.RemoteException;
    import javax.ejb.CreateException;
    public interface MySessionEJBHome extends EJBHome
    public MySessionEJB create() throws RemoteException, CreateException;
    }

    You might want to look at using a Java Bean wrapper, this can be done automically using WebSphere. It creates what is called an access bean which the JSP imports.
    HTH,
    J.Clancey

  • Calling EJB from JSP in SSL Mode

    Hi,
    I need to call an EJB from JSP in SSL Mode.
    How can i do that.
    Regards,
    S.V.Satish Kumar

    In that case you can refer to the following documents:
    Using JPA: http://help.sap.com/saphelp_nwce711/helpdata/en/44/eba6292f446c30e10000000a114a6b/frameset.htm
    Accessing persistence functionality in EJB 3.0: http://help.sap.com/saphelp_nwce711/helpdata/en/46/307a2a50094f09e10000000a114a6b/frameset.htm
    Tell me, if these documents help you. Otherwise, I will search for more information on the topic.
    Best regards,
    Ekaterina

  • How can I call AM from another page

    Hi,
    I have come across a situation which I am not sure how to solve it. Here is the issue. I have a custom requirement to add another page to an already existing custom page. The first page used to hold the data and commit buttons however because of requirements, we want users to add some comments on the second page and then save the data. In other words the save button is now suppose to move to the second page.
    The dilemma I have is that the method that used to be called from the PFR CO of Page 1 was linked to page 1 AM which had that commit method.
    I still want to re-use the method from the Page 1 AM since there is a lot of logic involved. How can I call that method while I am in my second page from my CO?
    I am using setForwardURL and I am retaining AM from page 1.
    Also, if this is not feasible what are other alternatives. Any ideas would be appreciated.
    Edited by: user501998 on Jan 7, 2010 12:21 AM

    Hi,
    Can you give me an example? I mean do I just call the AM like in the example below...in my PFR...of Page 2 Controller. I thought this would be giving me an error method not found or something since it would be looking at the AM of my current page. I will try it and see but if there is another syntax can you please provide it.
    Thanks
    Partial code from PFR of Page 2
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    if(eventName.equals("save"))
    if ( respName.endsWith("Admin") )
    am.invokeMethod("commitTransaction"); --- This is the AM Method in Page 1...
    } else
    throw new OAException("Shipper successfully updated.", OAException.CONFIRMATION);

  • Calling EJB from JSP

    Hi - I'm running OC4J 9.0.2 on windows 2000
    I have a JSP that accepts user inputs and the call respective Servlets. Before the servlet gets called, I want to log a tracing event with an EJB(Stateless Session Bean).
    I have manipulated the "form" values with JavaScript but cannot find any docs on how to call an EJB from JavaScript in a JSP.
    The JSP and EJB works fine on there own. How do I get the "form" values into the EJB variables without JavaScript?
    The EJB logs fine while still in the "JAVA" part of the JSP but I don't know how to extract these 2 index values.
    Tks
    Andre
    Here is extract of code:
    <%@ page language="java" contentType="text/html;charset=windows-1252"%>
    <%@ page language="java" import="java.io.*"%>
    <%@ page language="java" import="java.util.*"%>
    <%@ page language="java" import="javax.naming.*"%>
    <%@ page language="java" import="javax.rmi.*"%>
    <%@ page language="java" import="WizardEvents.WizEventLog.*"%>
    <HTML>
    <HEAD>
    <BODY background="/wp/Background.gif">
    <script language="JavaScript">
    // build timer to display at bottom of screen for debugging of screen dumps
    function display_time()
    var da = new Date();
    var dd = da.getDate('DD');
    var dm = da.getMonth('MON')+1;
    var dy = da.getYear('YYYY');
    var h = da.getHours();
    var m = da.getMinutes();
    if (m < 10)
    m = "0" + m;
    var t = dy+"\-"+dm+"\-"+dd+" "+h+":"+m;
    defaultStatus = t;
    setTimeout("display_time()",60000); // one minute
    return true;
    function registerEvent()
    var menuItem = document.selRequest.selCategory.selectedIndex;
    var serviceOption = document.selRequest.serviceOption.selectedIndex;
    // now invoke EJB to log event
    alert("selected menu option is "+menuItem+" and service option "+serviceOption);
    return true;
    // get the value from the categories and build up list of the options...
    function buildItems()
    // alert("Building items");
    // get the index (starting with 0) of the categories selection
    var menuItem = document.selRequest.selCategory.selectedIndex;
    // reset the values for the options selection to 0
    document.selRequest.serviceOption.length=0;
    // define new array to hold options for transfer to selection item
    newOptions = new Array;
    // Now check which menu option, build list
    var newLength = 0;
    switch(menuItem)
    case 0:
    newLength = 1;
    newOptions[0] = new Option("No Service Option",0,false,false);
    break;
    case 1:
    newLength = 1;
    newOptions[0] = new Option("No Service Option",0,false,false);
    break;
    case 2:
    newLength = 1;
    newOptions[0] = new Option("No Service Option",0,false,false);
    break;
    case 3:
    newLength = 1;
    newOptions[0] = new Option("No Service Option",0,false,false);
    break;
    case 4:
    newLength = 1;
    newOptions[0] = new Option("No Service Option",0,false,false);
    break;
    case 5:
    newLength = 5;
    newOptions[0] = new Option("All wallet and airtime balance",0,true,true);
    newOptions[1] = new Option("Airtime balance",1,false,false);
    newOptions[2] = new Option("SMS-a-lot balance",2,false,false);
    newOptions[3] = new Option("Call Extender balance",3,false,false);
    newOptions[4] = new Option("Per Second Billing balance",4,false,false);
    break;
    case 6:
    newLength = 2;
    newOptions[0] = new Option("Subscriber data - Channel Provisioning Options",8,true,true);
    newOptions[1] = new Option("IBS Pending Transaction Inquiry",9,false,false);
    break;
    default:
    newLength = 1;
    newOptions[0] = new Option("No Service Option - Default",0,false,false);
    break;
    var serviceOption = document.selRequest.serviceOption;
    // transfer array to select statement
    for (var i=0; i < newLength; i++)
    serviceOption.options[i] = newOptions;
    </script>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
    <TITLE>Wizard Prepaid Interface</TITLE>
    <%----%>
    <BODY text="#FFFFFF" bgcolour="#ffffff" bgcolor="#3c698a" onload="display_time();" >
    <H2 ALIGN=Center>Wizard Prepaid Interface</H2>
    <PRE>
    <%
    java.util.Enumeration params=request.getParameterNames();
    StringBuffer urlBuf = request.getRequestURL();
    String urlValue = urlBuf.toString();
    int colPos = urlValue.indexOf(":8888");
    String serverName = urlValue.substring(0,colPos+5);
    String paramValues1[] = request.getParameterValues("event_ref_no");
    String eventRefNo = paramValues1[0];
    String paramValues2[] = request.getParameterValues("msisdn_no");
    String msisdnNo = paramValues2[0];
    String paramValues3[] = request.getParameterValues("operator_id");
    String operatorId = paramValues3[0];
    String paramValues4[] = request.getParameterValues("wizDB");
    String wizDB = paramValues4[0].toLowerCase();
    // set session values into session object
    session.removeAttribute("eventRefNo");
    session.removeAttribute("msisdnNo");
    session.removeAttribute("operatorId");
    session.removeAttribute("wizDB");
    session.removeAttribute("serverName");
    session.setAttribute("eventRefNo",eventRefNo);
    session.setAttribute("msisdnNo",msisdnNo);
    session.setAttribute("operatorId",operatorId);
    session.setAttribute("wizDB",wizDB);
    session.setAttribute("serverName",serverName);
    session.setAttribute("eventOpenCount","0");
    session.setAttribute("errorString","No errors encountered yet");
    // now build ref to lookup event log EJB
    WizardEvents.WizEventLog eventBean;
    Context ctx = new InitialContext();
    Object homeObject=ctx.lookup("WizEventLog");
    WizardEvents.WizEventLogHome home =
    (WizardEvents.WizEventLogHome)PortableRemoteObject.narrow(homeObject, WizardEvents.WizEventLogHome.class);
    eventBean=(WizardEvents.WizEventLog)PortableRemoteObject.narrow(home.create(),
    WizardEvents.WizEventLog.class);
    int eventRefNoInput = Integer.parseInt(eventRefNo);
    int operatorIdInput = Integer.parseInt(operatorId);
    long msisdnNoInput = Long.parseLong(msisdnNo);
    int callCatCodeInput = 177;
    int callCatItemCodeInput = 2;
    String machineName = "WEB";
    String moduleName = "WIZARDPREPAID.JSP";
    String[] resArray = null;
    // event logging EJB
    resArray = eventBean.setEventDetail(eventRefNoInput,
    operatorIdInput,
    callCatCodeInput,
    callCatItemCodeInput,
    machineName,
    moduleName,
    wizDB);
    %>
    </PRE>
    <%--
    // check if data passed is valid
    --%>
    <jsp:include page="/servlet/CheckValidURL" flush="true"></jsp:include>
    <%
    if (session.getAttribute("eventOpenCount").equals("1"))
    %>
    <H3 ALIGN=CENTER>MSISDN = <%=msisdnNo%></H3>
    <HR>
    <H4 ALIGN=CENTER>Prepaid Query History</H4>
    <%--
    onclick can empty the service options field
    --%>
    <TABLE>
    <TD>Enter request target :</TD>
    <%--action="/wp/servlet/ValidateParamsClass"--%>
    <FORM name="selRequest" method="POST" >
    <TD><SELECT name="selCategory" onchange="buildItems()" >
    <OPTION value="Prepaid Cards Loaded">Prepaid Cards Loaded</OPTION>
    <OPTION value="Prepaid Recycle History">Prepaid Recycle History</OPTION>
    <OPTION value="Prepaid Failed Recharges">Prepaid Failed Recharges</OPTION>
    <OPTION value="Prepaid Access4Life Status">Prepaid Access4Life Status</OPTION>
    <OPTION value="Prepaid Number4Life Status">Prepaid Number4Life Status</OPTION>
    <OPTION value="IBS Balance Inquiry">IBS Balance Inquiry</OPTION>
    <OPTION value="IBS Subscriber Data Inquiry">IBS Subscriber Data Inquiry</OPTION>
    </SELECT>
    </TD>
    </TABLE>
    <%--
    Build the possible service options for IBS depending on selection
    Create selection list and then assign default value of none
    --%>
    <TABLE>
    <TD>Possible Service Options:</TD>
    <TD><select name="serviceOption">
    <option value="">No option available</option>
    <SCRIPT>
    // re-build items to cater for FORWARD/BACK buttons, etc
    buildItems();
    </SCRIPT>
    </TD>
    </TABLE>
    <%--
    --%>
    <%--
    --%>
    <INPUT type="submit" value="Query Prepaid Systems" onclick="registerEvent()" >
    </FORM>

    Hi Christian,
    A few questions to clarify where the cause of the problem might be:
    1. When you run the JSP app in JDeveloper, are you connecting to the remotely deployed app module, or the local one in your workspace?
    2. In your JSP project, there is an appmodule.properties file. This file should specify the connection mode to use to connect to your EJB (ConnectMode=EJB), and should be deployed to a directory on your webserver's classpath, along with the connections.properties file. If the appmodule.properties file contains the wrong connectmode setting, or is not on the classpath for the webserver, this might be the cause.
    Let us know.

  • How can I call contacts from my list without the country code that is registered with that contact?

    I have all my contacts registered with a country code. When I want to make calls from my iphone, I do not want the phone to dial the country code, but only the area code. How can I make that happen?

    Your 3G backup contains your contacts already, you don't need to sync them to Outlook or anything just restore the backup file from the 3G onto the 4S and you should be good to go.
    This kb article should help:
    http://support.apple.com/kb/ht1414

  • How can we call Tcode from the Portal?

    Senario:
    2 BAPI’s are developed:
    1. The information say... ABC is stored into the table from the portal using the Create BAPI.
    2. The change in this ABC information is done using a particular <b>Tcode</b> …say xyz. This is a report that calls the change BAPI inside.
    The ABC information change will be done either through the Tcode in ECC or through the EP.
    3. The Tcode has been created in ECC.
    Please let me know who will be responsible to call this tcode from the Portal and how?
    I am very very new to EP field so please help...

    Hi Jignesh,
    If you have already performed these steps and are able to see the iview that you have created. Then I think your issue has been sorted out.
    To explain it to you in detail.
    Let us suppose, you have created a SAP Transactional iview to access the TCODE-SE38.
    Now, as soon as the user clicks on the iview, it will authenticate by asking for the username and password for the backend system...if your SSO is not in place.
    Now, if your asking me how to make the iview visible.
    You can add assign this SAP transactional iview to a page,a workset or a role and add the corresponding page, workset or role to the user in USER ADMINISTARTION by making it an entry point.
    Or to make the iview as an entry point, right click on the iview that you have created and open the properties, then for the option that says entry point choose yes.
    I guess that answers your question.
    Let me know if you have need any further clarifications on the same.
    Regards,
    Sandeep

  • How to lookup an EJB from JSP on a Remote Server in JES2005Q4

    Hi,
    I am having two different domain (domain1,domain2) respectvely. My ABC.ear j2eee application is deployed on domain2 and its iiop port is 33703.In domain1 i have xyz.war (web application) and it's IIOP port is 3700 .In xyz.war i am having CallEJB.jsp file.In this Jsp file i want to lookup an EJB Service called PaymentEJB(JNDI Name is ejb/PaymentEJB).
    The code is below
    InitialContext context=new InitialContext();
    Object objRef=context.lookup("corbaname:iiop:andaman:33703#ejb/PaymentEJB");
    I am getting the following error.
    [#|2005-12-14T16:42:03.422+0530|SEVERE|sun-appserver-pe8.1_02|javax.enterprise.resource.corba._DEFAULT_.rpc.transport|_ThreadID=11;|"IOP00410216: (COMM_FAILURE) Unable to create IIOP listener on the specified host/port: all interfaces/3700"
    org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 216 completed: No
    at com.sun.corba.ee.impl.logging.ORBUtilSystemException.createListenerFailed(ORBUtilSystemException.java:2661)
    My doubt is
    1.While starting domain1 and domain2 iiop listeners are started on the port 3700 and 33703.in that case why EJB lookup tries to create listener on one more time.
    2.I am looking the 33703 port only.but it tries to create port on 3700 why?
    3.It was working till JES2005Q1.Is there any patch i need to install? or i need to change anything in my code.
    I am frustrated with this error for past one week.I will be happy if some body will give me the peace of mind(thru some solution).

    Hi,
    I am having two different domain (domain1,domain2) respectvely. My ABC.ear j2eee application is deployed on domain2 and its iiop port is 33703.In domain1 i have xyz.war (web application) and it's IIOP port is 3700 .In xyz.war i am having CallEJB.jsp file.In this Jsp file i want to lookup an EJB Service called PaymentEJB(JNDI Name is ejb/PaymentEJB).
    The code is below
    InitialContext context=new InitialContext();
    Object objRef=context.lookup("corbaname:iiop:andaman:33703#ejb/PaymentEJB");
    I am getting the following error.
    [#|2005-12-14T16:42:03.422+0530|SEVERE|sun-appserver-pe8.1_02|javax.enterprise.resource.corba._DEFAULT_.rpc.transport|_ThreadID=11;|"IOP00410216: (COMM_FAILURE) Unable to create IIOP listener on the specified host/port: all interfaces/3700"
    org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 216 completed: No
    at com.sun.corba.ee.impl.logging.ORBUtilSystemException.createListenerFailed(ORBUtilSystemException.java:2661)
    My doubt is
    1.While starting domain1 and domain2 iiop listeners are started on the port 3700 and 33703.in that case why EJB lookup tries to create listener on one more time.
    2.I am looking the 33703 port only.but it tries to create port on 3700 why?
    3.It was working till JES2005Q1.Is there any patch i need to install? or i need to change anything in my code.
    I am frustrated with this error for past one week.I will be happy if some body will give me the peace of mind(thru some solution).

  • How can I call reports from a third party tool?

    Hi!
    I'm a Delphi 6 developer and our company has a customer that want to call reports created in Crystal Reports directly from our software.
    What is the quickest way to open a report from a third party tool (passing parameters) ?
    There is a way to do that without embedding Crystal VCL components in Delphi?   I'm searching for a command line tool or a way to open it with URLs....
    Thanks in advance!
    Edited by: AlmirB on May 23, 2011 6:25 PM

    One of the 3rd-party Crystal Reports viewers listed at http://www.kenhamady.com/bookmarks.html provides a full command line API, so you can call a report from your app and pass parameter values, login info, etc.

  • How can i use twain from java servlet?

    dear all
    iam a web developer ,iam haviving now a task to search in point pf scanning image through web (Intranet) using java
    can any one tell where can i find resources how to deal with Twain using java (On web specially not from a desktop application)
    i hope u can help me
    Thanks in advance
    Yours,
    Amr
    Senior Java Web developer

    Hi,
    You can try a package named: JTwain, which is available at http://asprise.com/product/jtwain.
    JTwain supports all kinds of digital cameras and scanners. You can use Java to access, contorl digital cameras and scanners, and of course, to acquire images with flexible settings.
    The developers' guide is available @ http://asprise.com/product/jtwain/devGuide.php
    In the simplest case, one line of Java code can solve your problem.
    Good luck!

  • How can I call functions from a SWF loaded in to another SWF?

    Hi there,
    Please excuse my ignorance, I am very new to actionscript and flash.
    I have 2 SWF's - a.swf and b.swf.
    I load b.swf into a.swf with the following code:
    var swfLoader:MovieClipLoader = new MovieClipLoader();
    swfLoader.loadClip("b.swf", container_mc);
    Now in b.swf, I have a function as follows:
    public function sendData(){
      trace("I ran the function!");
    So I have done a lot of reading, from what I can tell I should be able to run the sendData() function from the code in a.swf, by typing:
    container_mc.sendData();
    but its not working. What am I doing wrong?
    Thanks in advance,
    Adam

    Thanks heaps mate, after a bit of trial and error it works! Here is the code that I added:
    var loadingListener:Object = new Object();
    swfLoader.addListener(loadingListener);
    loadingListener.onLoadStart = function(container:MovieClip):Void  {
        trace("The MovieClip "+container+" started loading");
    loadingListener.onLoadInit = function(container:MovieClip):Void
        trace("The MovieClip " + container + " has been initialized");
      container_mc.test();
    Marked your answer as correct :-)
    Thanks again, I really appreciate your help.
    Cheers
    Adam

  • How can I pass information from jsp script to javascript

    Hi, there,
    in my project, after the user login successfully, I want to pop up a window using javascript to show some information retrieving from the database, for example, what's the user's firstname, lastname, visittimes, etc. these information is just visible in jsp script, so I don't know if there is a way to pass these information to javascript, for example, alert window to show these information to the user.
    any hint will be great appreciated!!
    thank you very much for your great help!!

    One possibility would be to use a Login PEI to set a unique UserInfo Name/Value for the user. I think in 5.0 each guest session is unique, so would have unique UserInfo. Then you could pass this value to your portlet (by specifying it in the web service) and use it as a key into a Application-scoped hashmap where you store your info. In other words, your Application variables option, but you have a way of uniquely naming your variables via PEI-set UserInfo.

  • How can I reach Javascript from JSP code blog?

    <script>
    var name2; // want to reach the data which in JSP code blog
    </script>
    <body>
    <%
    String name; // a data from database
    %>
    </body>Simply I want to reach "*name*" valuable from Javascript..
    I'll be happy if someone helps me..
    Thanx in advance..
    Talha

    Just print it out as a Javascript variable. Carefully read this: [http://balusc.blogspot.com/2009/05/javajspjsf-and-javascript.html].

  • Call ejb from browsers

    Hello Developers!
    I deployed my ejb to OAS4081. I call that
    from JDeveloper so it good. But when I try
    to call from applet in IExpl5 I can't
    instantiate the ORB. I've got a com.ms.security.SecurityException : oracle.oas.orb.CORBA.ORB.init
    I coded the CLASSPATH(oasoorb(yoj),client,
    ejbapi...) perfectly, I think.
    If anybody could help, please...
    Thanx!

    Hi there,
              I saw someone on this group had a problem to locate proper classpath
              to call EJB from JSP. I thought if you call EJB from classpath, you are
              calling the bean. But you loss all the EJB functions. To be able to utilize
              EJB features like object pooling. You need to call it from Weblogic server
              using url/jndi, not from the jar directly.
              Any comment? Am I right?
              BTW, my question about calling EJB from JSP means calling through URL,
              not a local path.
              Thank you
              >-------------------------------------------------------------------->
              Jim wrote in message <[email protected]>...
              >Hi there,
              > Can I call EJB from JSP? Is there a particular security setting or
              >concern for Weblogic? Is there an coding example?
              >
              >Thank you
              >
              >
              

  • Calling EJB from app client

    Hello, everybody,
    I'm very new at EJB and I'm trying to learn it.
    I have created Enterprise Application using Netbeans IDE, I have EJB and APP client. What I want is to connect to my MySql database and get some info from table.
    For e.g. Login and Password.
    How can I call EJB from my client app which connects to my database and gets information I need?

    What server you are using?
    if you use jboss AS ,here is a simple Main class how to connect EJB and access ejb methods:
    package com.david.ejb.client;
    import java.util.Properties;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.rmi.PortableRemoteObject;
    import com.david.ejb.domain.Person;
    import com.david.ejb.domain.PersonRemote;
    public class Main {
         public static void main(String[] args) {
              try {
                   Context ctx = getInitialContext();
                   Object obj = ctx.lookup("PersonSessionRemote/remote");
                PersonRemote pr=(PersonRemote)PortableRemoteObject.narrow(obj, PersonRemote.class);
                Person p=new Person();
                p.setName("david");
                pr.addPerson(p);
                pr.findPerson(1);
                   // System.out.print(br.find(pk).getAuthor_name());
              } catch (Exception ex) {
                   ex.printStackTrace();
         private static Context getInitialContext() throws NamingException {
              Properties p = new Properties();
              p.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.NamingContextFactory");
              p.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
              p.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
              return new InitialContext(p);
    }Person is ant @Entity and PersonRemote is remote interfaces, to connect database you have to make datasource file at jboss-4.2.3.GA\server\default\deploy
    simle mysql-ds.xml looks like this:
    datasources>
       <local-tx-datasource>
          <jndi-name>some name</jndi-name>
          <connection-url>jdbc:mysql://localhost:3306/dbname</connection-url>
          <driver-class>com.mysql.jdbc.Driver</driver-class>
          <user-name>root</user-name>
          <password>root password</password>
          <min-pool-size>5</min-pool-size>
          <max-pool-size>100</max-pool-size>
          <idle-timeout-minutes>15</idle-timeout-minutes>
          <exception-sorter-class-name>com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter</exception-sorter-class-name>
          <valid-connection-checker-class-name>com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker</valid-connection-checker-class-name>
       </local-tx-datasource>
    </datasources>also at resources/META-INF directory you must have persistence.xml like this
    <persistence>
         <persistence-unit name="SimpleEjb">
              <jta-data-source>java:/some name</jta-data-source>
              <properties>
                   <property name="hibernate.hbm2ddl.auto" value="update" />
                   <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
                   <property name="hibernate.show_sql" value="true"/>
                   <property name="hibernate.format_sql" value="true"/>
              </properties>
         </persistence-unit>
    </persistence>

Maybe you are looking for

  • PageMaker 6.5 set default PostScript printer for PDF export

    My boss uses PageMaker 6.5 and it appears when she uses the Export to PDF option it is selecting a PostScript printer at random and asking it to "print to file" to create the PostScript file that it later gives to Distiller to create the PDF.  The pr

  • BPM Process - Exception handling or timeout issues?

    Hi Guys, I have a BPM process as below. 1. Receive step: Receive the file with multiple transactions. 2. Transformation step: Split the file into individual transactions 3  Block step which includes  -- par for each mode 1. Send Step (Synchronus): Ea

  • Having security issue with SL Screen Sharing

    Hello, Maybe I am missing some new setting in Snow Leopard that increases screen sharing security, but as it is, screen sharing is now insecure on my network. Prior to Snow Leopard I would log into my Mac from another without selecting the "remember

  • Basic settings in BW

    Hi gurus I know in MM we need to do lots of settings but do we need this settings in BW ? whats the use of SPRO in BW? pl explain with some example. I found lots of material here but all the time its giving OSS note number..so anybody pl tell me what

  • How to use ignore=check_min_mem Command

    Hi Guru's, I was  trying to install Hana on VMware in laptop. But I am having 8GB ram. I heard that ignore=check_min_mem command can be used to skip the check. Can anyone tell me how  to use this command My installation path is  - ./setup.sh /tmp/han