Help needed in EJB - to call AS from EJB a Session Bean

Hi All ,
I have been strictly told not to use Web Services as all the applications are on the same server
actually I have to make an EJB invocation to an Application Service from the CAF layer from a Session Bean of another EJB Project(Not a CAF Service).
the CAF layer has 5 parts metadata , permissions , dictionary , ear and ejbmodule.
I added the ejbModule to the Build Path of the calling EJB Session Bean. And so I was able to access the operations of the Application Service which in turn accesses a BAPI(The Appl Service operation returns a String).
But while executing I got the exception java.lang.RuntimeException: java.lang.NoClassDefFoundError
My method :
Normally from a Dynamic Web Project acting as a client to an EJB Session bean, I was able to get access to EJB Local Interface by using
  private ConverterLocal converterBean = null;
  public void jspInit() {
    try {
     InitialContext ic = new InitialContext();
     converterBean = (ConverterLocal)
     ic.lookup("java:comp/env/Converter");
    } catch (Exception ex) {
         System.out.println("Couldn't create converter bean."+
       ex.getMessage());
BigDecimal dollarAmount =  converterBean.euroToDollar(value);
So I created a JNDI field in ejb-j2ee-engine.xml
enterprise-beans>
        <enterprise-bean>
     <ejb-name>com.sap*******.bapi_company_getlist.BAPI_COMPANY_GETLIST</ejb-name>
               <jndi-name>COMPANY</jndi-name>
            </enterprise-bean>
</enterprise-beans>
And from my Session Bean , I tried to access it using the code in already existing Bean which was working fine
BAPI_COMPANY_GETLISTBeanImpl bean = new BAPI_COMPANY_GETLISTBeanImpl();
          try {
               InitialContext ctx = new InitialContext();
               bean = (BAPI_COMPANY_GETLISTBeanImpl)ctx.lookup("COMPANY");
          } catch (NamingException e) {
               System.out.println("Converter Bean can't be created");
               String send = bean.returnDetails();
And I tried to print the String , but I got the above error
I have a doubt :
1) How do I specify the JNDI name ie in the ejb-j2ee-engine.xml file , what should I add as the name of the ejb
is this sufficient , or are there more steps ??

Hi Ekaterina,
I have the document to access my Bean from another Bean.
I could access my Bean from a standalone Java class with this code
Properties props = new Properties();
          props.put(Context.INITIAL_CONTEXT_FACTORY,"com.sap.engine.services.jndi.InitialContextFactoryImpl");
          props.put(Context.PROVIDER_URL,"hostname:port");
          try{
               Context ctx = new InitialContext(props);
               Object o = ctx.lookup("sap.com/TestEAR/REMOTE/TestBean/com.@#$.TestRemote");
               TestRemote testRem = (TestRemote)javax.rmi.PortableRemoteObject.narrow(o, TestRemote.class);
               String msg = testRem.getMessage();
               System.out.println(msg);
And in this document there is a way shown to access a bean from another Bean.
   http://help.sap.com/saphelp_nw04/helpdata/en/13/c8633e0084e946e10000000a114084/frameset.htm
If your client is another enterprise bean, declare the EJB reference in the ejb-jar.xml.
-For more information, see Declaring EJB References.
But the problem is that in EJB 3.0 ,  I can't see the ejb-jar.xml file .
So how should I have a Bean as a client to another Bean, I am not that familiar with Annotations.

Similar Messages

  • Calling EJB on specific node from EJB on another node

    Hello,
    In cluster environment what is the best approach to call session bean on one node from session bean on another node? The scenario would allow synchronization of local cache (singleton) between two nodes. I understand that there are other options like SingletonService, distributed cache etc., but I wonder how hard would be to implement synchronization calls between nodes on remote session beans.
    Thanks
    Greg K.

    Hi,
    Based on your query on thread i can suggestthe following as a best option: Re: replica-aware stub.
    Use the JMX code to get the Cluster details....It means the name of the Cluster members and their Listen port and Listen Addresses then in your Client code do the following:
    InitialContext ic = getInitialContext(“t3://ClusterMemberOne:7002,ClusterMemberTwo:7003″);Like that whatever InitialContext object you will get will be able to provide you the correct EJB from any newly added member of the Cluster as well..
    You can enhance the JMX code mentioned in the following link : http://middlewaremagic.com/weblogic/?p=210 you will need to add only 2-3 lines to make it work for your requirement.
    Just tweak the following code to get the ListenPort and ListenAddress of cluster Nodes:
    public void printClusterInfo() throws Exception
         ObjectName[] serverRT = getServerRuntimes();
         Hashtable server_states = new Hashtable();
         for(ObjectName ser: serverRT)
              server_states.put((String) connection.getAttribute(ser,”Name”), (String) connection.getAttribute(ser,”State”));
         }Thanks
    Jay SenSharma

  • Adobe Premire Elements 13 purchase wouldn't download. No support no help no phone mnubers. Found a number and was on hold for over 25 minutes. need help need a number to call.

    Adobe Premire Elements 13 purchase wouldn't download. No support no help no phone mnubers. Found a number and was on hold for over 25 minutes. need help need a number to call.

    Downloadable installation files available:
    Suites and Programs:  CC 2014 | CC | CS6 | CS5.5 | CS5 | CS4, CS4 Web Standard | CS3
    Acrobat:  XI, X | 9,8 | 9 standard
    Premiere Elements:  13 | 12 | 11, 10 | 9, 8, 7 win | 8 mac | 7 mac
    Photoshop Elements:  13 |12 | 11, 10 | 9,8,7 win | 8 mac | 7 mac
    Lightroom:  5.7.1| 5 | 4 | 3
    Captivate:  8 | 7 | 6 | 5.5, 5 | 1
    Contribute:  CS5 | CS4, CS3 | 3,2
    FrameMaker:  12, 11, 10, 9, 8, 7.2
    Download and installation help for Adobe links
    Download and installation help for Prodesigntools links are listed on most linked pages.  They are critical; especially steps 1, 2 and 3.  If you click a link that does not have those steps listed, open a second window using the Lightroom 3 link to see those 'Important Instructions'.

  • JNDI lookup of a Stateless Session bean from another stateless session bean

    Hi,
       I am working on SAP Netweaver. We have created a stateless session bean which is finally deployed as a webservice. From this stateless session bean we need to call another stateless session bean as a local reference.
        I have done the following.
    1. Added JNDI-Name to the ejb-j2ee-engine.xml.
    2. My lookup code is as follows
    Context context = null;
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
    context = new InitialContext(env);
    Object ejbObj =     context.lookup("MyBean");
    But i get the NamingException .Here MyBean is the jndi-name provided in the ejb-j2ee-engine.xml.
    Can somebody tell me what i am doing wrong.
    Thanks
    Priya

    Hi,
        Thanks for your replies.I did as you had suggested.I added ejb-local-ref to the ejb-jar.xml and i provided ejb-ref as MyBean.
    My lookup code uses the string
    ctxt.lookup("localejbs\MyBean");
    But still i get Naming Exception.
    I tried something different yesterday.
    I changed the code to use
    InitialContext ctxt = new InitialContext();
    ctxt.lookup("localejbs/"+ pathfromJNDIRegistry);
    and this time i did not get Naming exception but i got RemoteException saying there was error loading the class.
    Is there something i need to add somewhere for the classloader to be able to find and load this class in the second scenario.
    Please suggest me which method to go for amongst the two and what is the missing information i need to add.
    Thanks
    Priya

  • Can we call a method in stateless session bean ?

    Can we call a method in stateless session bean in onMessage method?

    Hi,
    The purpose of service locator is to abstract the lookup of the server side services like ejb and DSNs. It should be a normal java class but as such there is no such restriction. You can have a look at the service locator patter at the j2ee blue prints.
    /Ashwani

  • How to call a  servlet in a Session Bean

    Hi All
    I have one servlet program.And i have One Sessionbean.
    I want to call the servlet in the session bean.
    I am using Runtime method in java to call the servlet by giving it's full
    path as it's argument.
    But it is not working fine.I don't know what is the Problem.
    Bye
    Satyam

    Hi,
    I don't know why you want to do that? You should be doing the other way round i.e. call your session bean from servlet.
    I must say that servlets are presentation tier components and session beans are middleware components related to workflow.
    HTH
    VJ

  • Calling Servlets from EJB

    Please can anyone help me out of how to make sevlet calls from EJB? Example source code if available will be of great help too.
    I know that this is a rare senario but this is required for a very urgent work.

    Vladimir - thanks again !!
    I am getting closer, I have 3 errors for "cannot resolve symbol"
    .../work/jsp_testmap1175186470750.java:78: cannot resolve symbol
    symbol  : class mappingservices
    location: package appsrv
    fsd.oms.appsrv.mappingservices mappingServicesLocal = null;
                          ^
    .../work/jsp_testmap1175186470750.java:79: cannot resolve symbol
    symbol  : class mappingservices
    location: package appsrv
    mappingServicesLocal = (fsd.oms.appsrv.mappingservices)pageContext.getAttribute("mappingServicesLocal", PageContext.SESSION_SCOPE);
                                                               ^
    .../work/jsp_testmap1175186470750.java:85: cannot resolve symbol
    symbol  : class mappingservices
    location: package appsrv
    mappingServicesLocal = (fsd.oms.appsrv.mappingservices) Beans.instantiate(getClass().getClassLoader(), "fsd.oms.appsrv.mappingservices");
                                                               ^
    3 errors
    (all ^ point between appsrv and mappingservices)
    This appears to be a classpath issue? Could this fall under this SAP note?
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bc_jas/~form/handler
    Or do you know of issues with string methods instead of object methods?
    Those were a couple of posts I found, that seemed similar, but not really. I appreciate the experienced help and your thoughts!
    thanks again - Allen

  • How can I deploy a simple stateless ssion EJB and call it from a standalone client

    Hi,
    I'm creating s simple staless session EJB that has a method that takes a name and prints "Hello" + name. This EJB is in a package called "com.demos.mydemo.ejbs.hello"
    How can I deploy this to OC4J?
    How can I call it from a standalone client(no JSP, no servlets)?
    In Sun's J2EE is very easy to deploy and I don't have to know any XML stuff.
    can I use the .ear file created by the Sun's "deploytool" to deploy my EJB to OC4J?
    This is the code at I'm using and it works on Sun's j2sdkee1.2.1:
    ///////// Remote /////////
    package com.demos.mydemo.ejbs.hello;
    import java.rmi.RemoteException;
    import javax.ejb.EJBObject;
    public interface Hello extends EJBObject {
    public String sayHello(String name) throws RemoteException;
    ///////// Home //////////
    package com.demos.mydemo.ejbs.hello;
    import java.rmi.RemoteException;
    import javax.ejb.EJBHome;
    import javax.ejb.CreateException;
    public interface HelloHome extends EJBHome {
    public Hello create() throws CreateException, RemoteException;
    /////////// Bean class ///////////
    package com.demos.mydemo.ejbs.hello;
    import java.rmi.RemoteException;
    import javax.ejb.SessionBean;
    import javax.ejb.SessionContext;
    import javax.ejb.CreateException;
    import javax.ejb.EJBException;
    import java.sql.Connection;
    import java.sql.SQLException;
    //import java.sql.PreparedStatement;
    import javax.sql.DataSource;
    import javax.naming.NamingException;
    import javax.naming.InitialContext;
    public class HelloEJB implements SessionBean {
    private SessionContext context;
    private Connection con;
    private String dbName =
    "java:comp/env/jdbc/Oracle";
    public HelloEJB() {}
    public void setSessionContext (SessionContext context) {
    this.context = context;
    public void ejbCreate() throws CreateException {
    try {
    makeConnection();
    catch (Exception e) {
    System.err.println("HelloEJB: exception in ejbCreate:" + e.getMessage());
    e.printStackTrace();
    throw new CreateException(e.getMessage());
    public void ejbActivate() {
    public void ejbPassivate() {
    public void ejbRemove() {
    try {
    con.close();
    catch (SQLException ex) {
    throw new EJBException("HelloEJB: exception in ejbRemove: " + ex.getMessage());
    public String sayHello(String name) {
    return "Hello " + name;;
    private void makeConnection() throws NamingException, SQLException {
    try {
    InitialContext ic = new InitialContext();
    DataSource ds = (DataSource) ic.lookup(dbName);
    con = ds.getConnection();
    catch (Exception e) {
    System.err.println("HelloEJB: exception in makeConnection:" + e.getMessage() );
    e.printStackTrace();
    //////////// EJB client that uses a stateless session bean
    package com.demos.mydemo.ejbs.hello;
    import java.io.*;
    import java.sql.*;
    import javax.sql.*;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.rmi.PortableRemoteObject;
    public class HelloClient {
    public static void main(String[] args) {
    try {
    Context initial = new InitialContext();
    Object objref = initial.lookup("HelloSession");
    HelloHome home = (HelloHome)PortableRemoteObject.narrow(objref,HelloHome.class);
    Hello h = home.create();
    String msg = h.sayHello("John Doe");
    System.out.println(msg);
    //h.remove();
    } catch (Exception ex) {
    System.err.println("Caught an exception." );
    ex.printStackTrace();
    Thanks
    Nabil
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Nabil Khalil ([email protected]):
    I deployed and .ear file created by Sun's J2EE deployment tool on the OC4J. It looks that it was deployed fine -- did not get a deployment error.
    When I run the client I'm getting the following error: Caught an exception.
    javax.naming.CommunicationException: Can't find SerialContextProvider
    at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:60)
    at com.sun.enterprise.naming.SerialContext.<init>(SerialContext.java:79)
    at com.sun.enterprise.naming.SerialInitContextFactory.getInitialContext(SerialInitContextFactory.java:54)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:668)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)
    at javax.naming.InitialContext.init(InitialContext.java:222)
    at javax.naming.InitialContext.<init>(InitialContext.java:178)
    at com.equifax.fms.ejbs.hello.HelloClient.main(HelloClient.java:18)
    This makes me think that the client can't see the deployed EJB on the OC4J.
    How can I fix this problem?
    Thanks
    Nabil
    <HR></BLOCKQUOTE>
    Nabil -
    Your standalone client needs to obtain certain server-dependent properties. You can provide them in your code or grab them via a properties file.
    For Orion - you need essentially the following setup, filling in your own information...
    Define your standalone client class with "main" etc (this is orion specific - should work for 9i AS as well - perhaps there are some differences)
    public class SomeClass {
    try {
    Properties p = new Properties();
    p.setProperty("java.naming.factory.initial",
    "com.evermind.server.ApplicationClientInitialContextFactory");
    p.setProperty("java.naming.security.principal","server_admin_name");
    p.setProperty("java.naming.security.credentials","server_password");
    // THEN you can get your intitial context reference
    InitialContext initial = new InitialContext (p);...........
    Then go about your business.....
    A good book to get is called "Professional Java Server Programming J2EE Edition" - there happens to be a reasonable amount of Orion/OCJ4 centric information since one of the authors is Karl Avedal - one of the principals behind Orion. Go out to java.sun.com and look at some of the J2EE tutorials - unfortunately a lot of it is hidden behind the J2EE Deployer, but you will get a good sense of what goes into outside-the-container standalone clients.
    null

  • 125: VALUE_HOLDER_INSTANTIATION_MISMATCH while calling toplink from ejb

    Hi Folks
    I am calling registerNewObject from from a stateless session ejb.
    The object i wanted to persist is as below
    A--> Collection B ---
    each item in collection B is mapped as one to one mapping to object C.
    When I try to persist it, i get following excecption:
    Exception [TOPLINK-125] (OracleAS TopLink - 10g (9.0.4.9) (Build 060118)): oracle.toplink.exceptions.DescriptorException
    Exception Description: The mapping for the attribute [RPGOperRole] uses indirection, and so must be initialized to a new ValueHolder. Currently the value is: [null].
    anything missing that should be done when calling from ejb

    You need to initialize your variable RPGOperRole in your class to a new ValueHolder(), either in its constructor or variable definition.
    i.e.
    public B() {
    this.RPGOperRole = new ValueHolder();
    or,
    private ValueHolderInterface RPGOperRole = new ValueHolder();

  • Help needed with process to call an external web service from within ABAP

    Hello,
    I have an understanding of how I can provision web service from within SAP so that it can be consumed by external apps.
    Now, I am in need to know the, how I can call an external non-sap web service (let's say a java application) or even a public domain web service for that matter:
    Is there any lay man's guide out there? which will list following step:
    A sample ABAP program calling an external web service
    List of all the configurations needed within SAP to make this happen (calling an external web service).
    Any help will be greatly appreciated.

    Hi Matesh,
    Please use the following command in Google : site:sdn.sap.com abap consuming web service
    There is many samples of your needs on SDN.
    Like this one :
    http://wiki.sdn.sap.com/wiki/display/Snippets/WebServiceconsumerusingABAP-PROXY
    Regards, Gilles.

  • Create EJB and call it from ABAP

    Hi all,
    I have written a stand-alone-Java application, which should be converted into a web application, which has no gui.
    This application should be triggered by a abap-program.
    Following questions, do I have to write a servlet and a ejb or is it possible to call the ejb directly from the abap-program?
    What do I have to do make an outbound call from abap?
    Thank you for your support.
    Kind regards, Patrick.

    Hi.
    You can call the EJB directly from Abap. XI uses this functionality extensively.
    Follow these steps:
    1)  Deply the bean on the java stack.
    2)  You now need to setup a RFC destination in the JCO RFC Provider service in the j2ee visual adminstrator. Point the Repository section to the application server you want to run the Abap reort on. When you do this the j2ee engine will register itself as a possible RFC destination on this application server.You can choose your own program id...
    3) You then need to goto tran sm59 on the app server where the Abap report is going to run and setup a connection of tcp type to the j2ee machine. Specify the same program id you used in step in the technical settings.
    4) Then just use the bean name when you do the rfc call in the abap report.
    Hope this helps if U have not done it yet.

  • Call RFC from EJB code

    Hi,
         I have a scenario where I need to write an EJB from where I need to execute a JCO call to an RFC. This RFC takes an XString as input (this is the input file) and returns a XString from which an XML needs to be generated.
    Can anyone suggest how to go about this?
    Thanks,
    Shiladitya

    JRA is the way to go....
    check my blog on this...
    /people/amol.joshi2/blog/2006/11/27/alerts-from-adapter-modules--the-jra-way

  • Need HTML code to call template from an existing web template

    Hi all,
    Can someone help me with a HTML code which can call another web template from a field of a table.
    I have a web template which includes table as web item.The template when executed displays the data of query view in the form of table.One of the field in the table is Europe.Now my requirement is when i click on that field Europe,it should open up another template which is present in the system.
    Please provide me with a HTML code which can do this.
    Regards,
    Suchitra

    Hi all,
    Can someone help me with a HTML code which can call another web template from a field of a table.
    I have a web template which includes table as web item.The template when executed displays the data of query view in the form of table.One of the field in the table is Europe.Now my requirement is when i click on that field Europe,it should open up another template which is present in the system.
    Please provide me with a HTML code which can do this.
    Regards,
    Suchitra

  • Help needed urgently to get the values from the jsp page.

    hi,
    I am badly stuck into this problem.Please help me and find a solution.
    I am using ms-access and jsp.
    my database structure is as given below:
    m_emp_no | from_date | to_date | approver| status |
    1002 | 22/9/2008 | 23/9/2008|1003 |pending
    1004 | 29/9/2008 | 30/9/2008|1003 |pending
    2044 | 15/9/2008 | 16/9/2008|3076 |pending
    now this is exactly a leave apply scenario where a page is displayed and the user has to fill in the details to apply leave.then the approver has to approve that leaves so even, he should get the details in his account.
    for example here 1003 has to approve leaves for 1002 & 1004.i am able to fetch data from database for the particular approver here is the coding:
    <html>
    <body>
    <h2 align="center"><u><b><span style="background-color: #FFFFFF"><font color="#C0C0C0" face="Comic Sans MS">Leave
    Approval Requests</font></span></b></u></h2>
    <form method="POST" name="f1" action="update.jsp">
    <%
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc:odbc:employee_details");
    PreparedStatement p=null;
    p=con.prepareStatement("select * from emp_leave_application where approver='"+username+"'");
    ResultSet r=p.executeQuery();
    while(r.next())
    %>  <table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
        <tr>
          <td width="100%" bgcolor="#999966"><b><u><%=r.getString(2)%></u></b></td>
        </tr>
      </table>
      <table border="1" width="100%" height="171" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
        <tr>
          <td width="100%" height="165" valign="top">
            <p align="left"><b>User ID</b>        :
    <input type="text" name="id" value="<%=r.getString(1)%>"  size="4   
         <b>status</b>:<%=r.getString(5)%</p>
    <p><b>Leave From</b> : <%=r.getString(2)%></p>
    <p><b>Leave From</b> : <%=r.getString(3)%></p>
    <p><b>Approve</b> : <select  size="1" name="approved">
            <option value="Approved">Approved</option>
            <option value="Cancelled">Cancelled</option>        </select></p>
    <%
    con.close();
    %>
      <table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
              <tr>
                <td width="100%" bgcolor="#999966">
                  <p align="center"><input type="reset" value="Clear" name="B1"> 
                  <input type="submit" value="Submit" name="B2"></td>
              </tr>
            </table>
            </td>
        </tr>
      </table>
    </form>
    </body>
    </html>{code}
    this will display both the rows but when i try to retrieve the values into update.jsp using the code given below it gives me only one value which is the first 1002.
    {code}approved=(String)request.getParameter("approved");
    id=(String)request.getParameter("id");{code}
    but i need both the values to be inserted into the update.jsp only then the approver will be able to approve the leaves individually with respect to the m_emp_no.
    please help me out.
    thanks in advance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    My comments below are all between (((((( and ))))))
    <html>
    <body>
    <h2 align="center"><u><b><span style="background-color: #FFFFFF"><font color="#C0C0C0" face="Comic Sans MS">Leave
    Approval Requests</font></span></b></u></h2>
    <form method="POST" name="f1" action="update.jsp">
    <%
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc:odbc:employee_details");
    PreparedStatement p=null;
    p=con.prepareStatement("select * from emp_leave_application where approver='"+username+"'");
    ResultSet r=p.executeQuery();
    while(r.next())
    %> <table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
    <tr>
    <td width="100%" bgcolor="#999966"><b><u><%=r.getString(2)%></u></b></td>
    </tr>
    </table>
    <table border="1" width="100%" height="171" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
    <tr>
    <td width="100%" height="165" valign="top">
    <p align="left"><b>User ID</b> :
    <input type="text" name="id" value="<%=r.getString(1)%>" size="4   
    ((((((( in the statement above, name="id" should be changed to something like name="id"<%=ii%>
    Where ii is a counter that tells you how many times you have gone through the loop so far.
    The reason for this is that each textfield you generate must have a unique name rather than all have the same name
    such as 'id'. This change will give them names such as id0, id1, id2. Then when you submit the page, you can uniquely
    identify each input textfield.))))))
    <b>status</b>:<%=r.getString(5)%</p>
    <p><b>Leave From</b> : <%=r.getString(2)%></p>
    <p><b>Leave From</b> : <%=r.getString(3)%></p>
    <p><b>Approve</b> : <select size="1" name="approved">
    (((( the above select also has to have a unique name for each time through the loop. Change it to name="approved"<%=ii%>
    <option value="Approved">Approved</option>
    <option value="Cancelled">Cancelled</option> </select></p>
    <%
    con.close();
    %>
    <table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
    <tr>
    <td width="100%" bgcolor="#999966">
    <p align="center"><input type="reset" value="Clear" name="B1">
    <input type="submit" value="Submit" name="B2"></td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    (((((((note you would be better off long term to put your business logic in a servlet and dispatch to the JSP page which will only have the responsiblity to display the data.
    Also, connection pooling is better than the above.

  • Help needed in receiving  two consecutive msges from SIP Ser in UDP server!

    Hi everyone,
    I am Mitul Gogoi,from Assam,North-east part of India.
    I am writing a SIP proxy server,which is simly a UDP server and which will sit between the Client(X-Lite softphone) and Brekeke SIP Server and just receive and send messages.
    Client---------------->My UDP Server-------------------------->SIP Server (This is for requests)
    again,
    SIP Server---------->My UDP Server-------------------------->Client (This is for responses)
    (couldnot draw the arrows together)
    My server will receive any msg coming from Client in port 7000 from Client and My server will send the msg to SIP Server to its IP address and port 5060.So, I just wanted to change the port number to which Client will send msges;i.e. instead of earlier port 5060,it will now send to port 7000.
    The msg sending and receiving scenerio:
    1.The first msg from Client is received by My Server.
    2.My server sends the msg to SIP Server.
    3.My server then waits for response from SIP server.
    4.One msg comes to My server and received successfully. and it closes the socket.
    5.This msg is sent to Client.
    6.Second msg comes from SIP server to My server.But My server is unable to receive this second msg.maybe because My server closes the socket to receive the next msg.
    I am using ResponseHandler Thread in main which will listen to any msges that may come from SIP server to My server.
    My question is :
    Is it not possible to receive two consecutive msg from SIP server ?
    If one msg comes,it then closes the socket.
    My code for sending and receiving :
    udpClSocket = new DatagramSocket();
    packet = new DatagramPacket(buf, buf.length,InetAddress.getByName(server), port);
    udpClSocket.send(packet);//it will send to SIP Server as well as Client,by changing the server and port
    byte resbuf[] = new byte[msgSize];
    packet = new DatagramPacket(resbuf, resbuf.length);
    udpClSocket.receive(packet);//it will receive msg from SIP server only
    packet = null;
    udpClSocket.close();
    The first msg comes to My server successfully,but the second msg is not being received.
    I have tried in so many ways,such as taking two different ports :one for receiving for Client and My server ,and another port for My server and SIP server.
    If anyone can help me in this ,then I will be highly grateful.
    regards,
    Mitul

    Why? Throw all this code away, and use the NIST reference implementation of JAIN-SIP. They've done all the hard work for you. All you have to do to write a stateless proxy is a little mild header processing.
    Thank you ejp for your reply.Mine is a Outbound SIP proxy server,which uses a port other than default 5060 SIP server port.The client will REGISTER SIP server via my server.and moreover,I want to build my own server at least once for learning purpose.
    maybe because My server closes the socket to receive the next msg.
    Why?
    I donot know why.may be I am very new to network programming or did not do much research in networking.But,my code should work;couldn't find out any fault.
    Here is my code:
    package com.ef;
    import java.net.DatagramPacket;
    import java.net.DatagramSocket;
    import java.net.InetAddress;
    import java.util.Date;
    * It sends UDP packets to following destinations-
    * 1. SIP Server
    * 2. SIP UACs
    public class OBUDPClient extends Thread {
         private DatagramSocket udpClSocket;
         private DatagramPacket packet;
         private String server = "192.168.1.2";//IP of Brekeke SIP server
         private int port = 5060;
    //SIP Message Size
         private int msgSize = 2048;
         private byte buf[];
         private boolean serFlag = true;
         private OBMessage m;
         * Send Request to SIP Server
         * @param in_packet
         * @throws Exception
         public OBUDPClient(DatagramPacket in_packet) throws Exception{
              super("Client-"+String.valueOf((new Date()).getTime()));
              this.buf = in_packet.getData();
              m = new OBMessage();
              * Keep track of IP and Port of the source of this packet. Response
              * from SIP Server will be redirected to this IP and Port
              m.setTargetIP(in_packet.getAddress().getHostAddress());
              m.setTargetPort(in_packet.getPort());
              start();
         * Send Request to SIP UAC (). This constructor gets call from OBResponseHandler.java
         * @param server
         * @param port
         * @param buf
         * @throws Exception
         public OBUDPClient(String server, int port, byte buf[]) throws Exception{
              super(String.valueOf((new Date()).getTime()));
              this.server = server;
              this.port = port;
              this.buf = buf;
              serFlag = false;
              start();
         public void run(){
              try{
              System.out.println("OBUDPClient Redirecting packet");
              udpClSocket = new DatagramSocket();
              //Send Request
              packet = new DatagramPacket(buf, buf.length,InetAddress.getByName(server), port);
              udpClSocket.send(packet);
              //Receive Response
              byte resbuf[] = new byte[msgSize];
              packet = new DatagramPacket(resbuf, resbuf.length);
              udpClSocket.receive(packet); //could not receive two consecutive msg from SIP server
              if(serFlag){
              * If request is sent to SIP Server we are interested for the
              * response otherwise not
              System.out.println("<----------------Handle Response----------------->");
         System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++");
         System.out.println("Response from SIP Server: "+new String(packet.getData()).trim());
         System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++");
         //Read SIP reseponse sent by SIP Server
         m.setMessage(new String(packet.getData()).trim());
         //Store the Response message in Queue
         OBMain.q.push(m);
         }catch(Exception ex){
         ex.printStackTrace();
         packet = null;
         udpClSocket.close();
    Note:Everything starts from the Client.First,Client makes a REGISTER request;it is passed through Outbound server to SIP server.Then,SIP server responds with 100 Trying;this is received successfully by my outbound server and sent to Client.Then,again,SIP server responds with 200 OK;this is not received by my outbound server;hence cannot reach Client,as a result of which Registration fails.
    regards,
    mitul

Maybe you are looking for

  • Device Driver Software Not Installed Properly

    Hi I have Reinstalled Windows 7 ultimate 64 bit, after installing all hp drivers I lost WIFI and when checked Device Manager I found Under >Display Drivers >(1)standard VGA Graphics Adapter (ERROR)- when I right click mouse and check under general th

  • HT203254 MacBook Pro: Distorted video or no video issues

    It's too bad these problematic laptops are still floating around. I was unlucky enough to buy one. It lasted 10 hrs before the video died. What an incredible waste and my 3rd "PRO" apple laptop to die out of warranty. Are there any documents on how t

  • Cant burn dvd from fcp to compressor to dvd studio pro

    I have burnt projects in the past from hd but cant seem to create an sp dvd from an combo hd and sd project. I am using the setting best quality 120 minutes

  • Youtube doesn't work - Curve 8520

    I could really use your help. Youtube will not work on the Curve 8520. I have downloaded the free app from the app centre and it will not work either. My phones version is v5.0.0.681. Please reply.

  • Strut Validation for Date

    I need some ideas on how to validate date in a form in the following two situations using Struts. a) Checking whether a particular date is a holiday. b) For a given pair of date (say start date and end date), to validate that the end date is later th