Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 19262 invoked from network); 26 Sep 2006 09:33:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 26 Sep 2006 09:33:16 -0000 Received: (qmail 76742 invoked by uid 500); 26 Sep 2006 09:33:14 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 76353 invoked by uid 500); 26 Sep 2006 09:33:12 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 76342 invoked by uid 99); 26 Sep 2006 09:33:12 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Sep 2006 02:33:12 -0700 Authentication-Results: idunn.apache.osuosl.org smtp.mail=lasantha@opensource.lk; spf=permerror X-ASF-Spam-Status: No, hits=2.0 required=5.0 tests=HTML_MESSAGE Received-SPF: error (idunn.apache.osuosl.org: domain opensource.lk from 209.68.5.17 cause and error) Received: from [209.68.5.17] ([209.68.5.17:2553] helo=relay03.pair.com) by idunn.apache.osuosl.org (ecelerity 2.1.1.8 r(12930)) with ESMTP id B5/D0-06744-3D3F8154 for ; Tue, 26 Sep 2006 02:33:09 -0700 Received: (qmail 79825 invoked from network); 26 Sep 2006 09:33:02 -0000 Received: from unknown (HELO ?192.168.1.227?) (unknown) by unknown with SMTP; 26 Sep 2006 09:33:02 -0000 X-pair-Authenticated: 222.165.180.106 Message-ID: <4518F3C4.4030901@opensource.lk> Date: Tue, 26 Sep 2006 15:02:52 +0530 From: Lasantha Ranaweera User-Agent: Thunderbird 1.5.0.5 (X11/20060728) MIME-Version: 1.0 To: user@geronimo.apache.org Subject: Re: Failure when looking up an EJB consecutively References: <4518BF82.5070801@opensource.lk> In-Reply-To: Content-Type: multipart/mixed; boundary="------------090201050909060005040402" X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N This is a multi-part message in MIME format. --------------090201050909060005040402 Content-Type: multipart/alternative; boundary="------------070202000105080608080202" --------------070202000105080608080202 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi Vimalan, I just tried to re generate your error in my machine with the attached sample application. Check out is it the same scenario as yours. But I couldn't regenerate your problem. It looks the Exception is a network related one. Also I would like to add some comments to this scenario too. 1. The spec says you should narrow, but when using the org.openejb.client.RemoteInitialContextFactory, you never have to. We use dynamic proxies which don't require narrowing. 2. You might be able to escape from this Exception if you take property initialization to the out side of for loop. I would think it would be more practical scenario. Regards, Lasantha Ranaweera Arunanthisivam Vimalathithen wrote: > Hi Lasantha, > > I had a look at your example and it differs in the following. Setting > up the initial context and lookup, narrowing, creation as well as the > remote bean method invocation are all within the same loop, and also > the home object is narrowed using PortableRemoteObject.narrow. I am > providing you with some sample code below. I suggest you modify your > code as below to reproduce this error. (if it works the first time > which I doubt, please run again it will throw up the error). We are > currently testing this on Geronimo 1.1.1. > > for(int i=0;i<1000;i++){ > Properties properties = new Properties(); > > properties.setProperty("java.naming.factory.initial","org.openejb.client.RemoteInitialContextFactory"); > > properties.setProperty("java.naming.provider.url","127.0.0.1:4201 > "); > > properties.setProperty("java.naming.security.principal","system"); > > properties.setProperty("java.naming.security.credentials","manager"); > try { > InitialContext ic = new InitialContext(properties); > Object o = ic.lookup ("SessionTestBean"); > SessionTestRemoteHome sessionTestRemoteHome = > (SessionTestRemoteHome)PortableRemoteObject.narrow(o,SessionTestRemoteHome.class); > SessionTestRemote sessionTestRemote = > sessionTestRemoteHome.create(); > sessionTestRemote.display(); > }catch(NamingException e) { > e.printStackTrace(); > } catch (RemoteException e) { > e.printStackTrace (); > } catch (CreateException e) { > e.printStackTrace(); > } > } > > > On 9/26/06, *Lasantha Ranaweera* > wrote: > > Hi Vimalan, > > I tested this problem with a 2000 consecutive requests in Geronimo > v 1.1.1. But it doesn't happen to me at all. You can test it with > the EJB samples application in > http://cwiki.apache.org/GMOxDOC11/ejb-sample-application.html > replacing following files. We might able to help you if you are > more specific and share your code with us. > > Regards, > Lasantha Ranaweera > > > Arunanthisivam Vimalathithen wrote: >> Hi, >> >> I am having a problem in an application I am trying to port to >> WebSphere community edition which basically uses Geronimo 1.0 >> (This problem exists in the latest version of Geronimo (1.1.1) as >> well). The client I am using looks up the service numerous times >> consecutively and invokes the services. The problem happens when >> this has gone past more than 630 times, the client simply fails >> to look up and produces the following error: >> >> _java.rmi.RemoteException_: Cannot access server: >> /127.0.0.1:_4201_ Exception: ; nested exception is: _ >> java.io.IOException_: Cannot access server: /127.0.0.1:4201 >> _Exception_: _java.net.BindException_ : Address already in use: >> connect >> >> The same error can be produced by looking up and invoking a >> simple hello world EJB in a loop of 700 times. This happens in >> the latest release of Geronimo (sometimes the loop might need to >> be increased to 1000). Any work arounds to this? >> >> Thanks and regards, >> >> Vimalan > > > > --------------070202000105080608080202 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi Vimalan,

I just tried to re generate your error in my machine with the attached sample application. Check out is it the same scenario as yours. But I couldn't regenerate your problem. It looks the Exception is a network related one. Also I would like to add some comments to this scenario too.

1. The spec says you should narrow, but when using the org.openejb.client.RemoteInitialContextFactory, you never have to.  We use dynamic proxies which don't require narrowing.
2. You might be able to escape from this Exception if you take property initialization to the out side of for loop.  I would think it would be more practical scenario.

Regards,
Lasantha Ranaweera

Arunanthisivam Vimalathithen wrote:
Hi Lasantha,
 
I had a look at your example and it differs in the following. Setting up the initial context and lookup, narrowing, creation as well as the remote bean method invocation are all within the same loop, and also the home object is narrowed using PortableRemoteObject.narrow. I am providing you with some sample code below. I suggest you modify your code as below to reproduce this error. (if it works the first time which I doubt, please run again it will throw up the error). We are currently testing this on Geronimo 1.1.1.
 
     for(int i=0;i<1000;i++){
     Properties properties = new Properties();
     properties.setProperty("java.naming.factory.initial","org.openejb.client.RemoteInitialContextFactory");
        properties.setProperty("java.naming.provider.url","127.0.0.1:4201");
        properties.setProperty("java.naming.security.principal","system");
        properties.setProperty("java.naming.security.credentials","manager");
        try {
            InitialContext ic = new InitialContext(properties);
            Object o = ic.lookup ("SessionTestBean");
            SessionTestRemoteHome sessionTestRemoteHome =  (SessionTestRemoteHome)PortableRemoteObject.narrow(o,SessionTestRemoteHome.class);
            SessionTestRemote sessionTestRemote = sessionTestRemoteHome.create();
            sessionTestRemote.display();
        }catch(NamingException e) {
            e.printStackTrace();
        } catch (RemoteException e) {
            e.printStackTrace ();
        } catch (CreateException e) {
            e.printStackTrace();
        }
     }


On 9/26/06, Lasantha Ranaweera <lasantha@opensource.lk> wrote:
Hi Vimalan,

I tested this problem with a 2000 consecutive requests in Geronimo v 1.1.1. But it doesn't happen to me at all. You can test it with the EJB samples application in http://cwiki.apache.org/GMOxDOC11/ejb-sample-application.html replacing following files. We might able to help you if you are more specific and share your code with us.

Regards,
Lasantha Ranaweera


Arunanthisivam Vimalathithen wrote:
Hi,
 
I am having a problem in an application I am trying to port to WebSphere community edition which basically uses Geronimo 1.0 (This problem exists in the latest version of Geronimo (1.1.1) as well). The client I am using looks up the service numerous times consecutively and invokes the services. The problem happens when this has gone past more than 630 times, the client simply fails to look up and produces the following error:
 
java.rmi.RemoteException: Cannot access server: /127.0.0.1:4201 Exception: ; nested exception is: java.io.IOException: Cannot access server: /127.0.0.1:4201 Exception: java.net.BindException : Address already in use: connect
 
The same error can be produced by looking up and invoking a simple hello world EJB in a loop of 700 times. This happens in the latest release of Geronimo (sometimes the loop might need to be increased to 1000). Any work arounds to this?
 
Thanks and regards,
 
Vimalan





--------------070202000105080608080202-- --------------090201050909060005040402 Content-Type: text/x-java; name="MainUI.java" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="MainUI.java" package org.apache.geronimo.samples.bank.client; import java.awt.Dimension; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Hashtable; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JTextField; import org.apache.geronimo.samples.bank.ejb.BankManagerFacade; import org.apache.geronimo.samples.bank.ejb.BankManagerFacadeHome; import org.apache.geronimo.samples.bank.util.PropertyLoader; /** * * @author Lasantha Ranaweera * */ public class MainUI extends JFrame implements ActionListener{ JLabel lblAccountNumber; JLabel lblBalance; JTextField txtAccountNumber; JTextField txtBalance; JButton btnView; JButton btnUpdate; BankManagerFacade bankManager = null; private static final String FACTORY_INITIAL = "java.naming.factory.initial"; private static final String PROVIDER_URL = "java.naming.provider.url"; private static final String SECURITY_PRINCIPAL = "java.naming.security.principal"; private static final String SECURITY_CREDENTIALS = "java.naming.security.credentials"; private static final String JNDI_BANK_MANAGER = "jndi.bankManager"; private static String CLIENT_PROP_FILE = "bank_client.properties"; public MainUI(){ super("Banking Remote Application"); this.setSize(300,190); this.getContentPane().setLayout(null); lblAccountNumber = new JLabel("Account Number"); lblBalance = new JLabel("Balance"); txtAccountNumber = new JTextField(); txtBalance = new JTextField(); btnView = new JButton("View"); btnView.addActionListener(this); btnUpdate = new JButton("Update"); btnUpdate.addActionListener(this); lblAccountNumber.setBounds(10,10,150,40); lblBalance.setBounds(10,60,150,40); txtAccountNumber.setBounds(180,10,100,40); txtBalance.setBounds(180,60,100,40); btnView.setBounds(10,110,130,40); btnUpdate.setBounds(150,110,130,40); this.getContentPane().add(lblAccountNumber); this.getContentPane().add(lblBalance); this.getContentPane().add(txtAccountNumber); this.getContentPane().add(txtBalance); this.getContentPane().add(btnView); this.getContentPane().add(btnUpdate); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); this.setLocation((d.width-this.getWidth())/2, (d.height-this.getHeight())/2); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setResizable(false); this.setVisible(true); try { connect(); } catch (Exception e) { JOptionPane.showMessageDialog(this,"Initialization Failed !!"); e.printStackTrace(); } } private void connect() throws Exception { PropertyLoader propLoader = PropertyLoader.getInstance(CLIENT_PROP_FILE); for(int i=0;i<2000;i++){ Hashtable env = new Hashtable(); env.put(FACTORY_INITIAL,propLoader.getValue(FACTORY_INITIAL)); env.put(PROVIDER_URL,propLoader.getValue(PROVIDER_URL)); env.put(SECURITY_PRINCIPAL,propLoader.getValue(SECURITY_PRINCIPAL)); env.put(SECURITY_CREDENTIALS,propLoader.getValue(SECURITY_CREDENTIALS)); javax.naming.InitialContext initialContext = new javax.naming.InitialContext(env); Object objRef = initialContext.lookup(propLoader.getValue(JNDI_BANK_MANAGER)); BankManagerFacadeHome bankManagerHome = (BankManagerFacadeHome)javax.rmi.PortableRemoteObject.narrow(objRef, BankManagerFacadeHome.class); bankManager = bankManagerHome.create(); System.out.println("Create "+i); } } /** * @param args */ public static void main(String[] args) throws Exception { new MainUI(); } public void actionPerformed(ActionEvent e) { if(e.getSource() == btnView){ try { String account = txtAccountNumber.getText(); Double balance = new Double(0); for(int i=0;i<2000;i++){ balance = bankManager.getAccountBalance(account); } if(balance != null){ txtBalance.setText(balance.toString()); }else{ JOptionPane.showMessageDialog(this,"Account Number Not Found !!"); } } catch (Exception e1) { JOptionPane.showMessageDialog(this,"Remote Exception !!"); e1.printStackTrace(); } }else if(e.getSource()== btnUpdate){ try { String account = txtAccountNumber.getText(); String newBalance = txtBalance.getText(); bankManager.changeAccountBalance(account,new Double(newBalance)); txtBalance.setText(""); } catch (NumberFormatException e1) { JOptionPane.showMessageDialog(this,"Invalid Number Format !!"); e1.printStackTrace(); } catch (Exception e1) { JOptionPane.showMessageDialog(this,"Remote Exception !!"); e1.printStackTrace(); } } } } --------------090201050909060005040402--