You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by az...@apache.org on 2009/06/24 11:11:57 UTC

svn commit: r787950 - /webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/rpc/receivers/ejb/EJBUtil.java

Author: azeez
Date: Wed Jun 24 09:11:57 2009
New Revision: 787950

URL: http://svn.apache.org/viewvc?rev=787950&view=rev
Log:
When the EJB server is stopped, and restarted, on the first invocation, there is an error that is caused due to cached references. Calling the method the second time clears this.

Modified:
    webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/rpc/receivers/ejb/EJBUtil.java

Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/rpc/receivers/ejb/EJBUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/rpc/receivers/ejb/EJBUtil.java?rev=787950&r1=787949&r2=787950&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/rpc/receivers/ejb/EJBUtil.java (original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/rpc/receivers/ejb/EJBUtil.java Wed Jun 24 09:11:57 2009
@@ -27,6 +27,7 @@
 
 import javax.naming.Context;
 import javax.naming.InitialContext;
+import javax.naming.NamingException;
 import java.lang.reflect.Method;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
@@ -210,7 +211,7 @@
          * @throws AxisFault If fals
          */
         private Object getEJBHome(AxisService service, String beanJndiName) throws AxisFault {
-            Object ejbHome;
+            Object ejbHome = null;
 
             // Set up an InitialContext and use it get the beanJndiName from JNDI
             try {
@@ -262,12 +263,17 @@
                 if (context == null)
                     throw new AxisFault("cannot create initial context");
 
-                ejbHome = getEJBHome(context, beanJndiName);
+                try {
+                    ejbHome = getEJBHome(context, beanJndiName);
+                } catch (Exception e) {
+                    ejbHome = getEJBHome(context, beanJndiName); // Retry for the 2nd time to overcome issues related to cahing
+                } 
 
                 if (ejbHome == null)
                     throw new AxisFault("cannot find jndi home");
             }
             catch (Exception exception) {
+
                 throw AxisFault.makeFault(exception);
             }