[Jboss-cvs] JBossAS SVN: r56592 - trunk/ejb3/src/main/org/jboss/ejb3

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Sep 5 19:34:00 EDT 2006


Author: bill.burke at jboss.com
Date: 2006-09-05 19:33:57 -0400 (Tue, 05 Sep 2006)
New Revision: 56592

Modified:
   trunk/ejb3/src/main/org/jboss/ejb3/Ejb3AnnotationHandler.java
   trunk/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java
   trunk/ejb3/src/main/org/jboss/ejb3/Ejb3JmxDeployment.java
   trunk/ejb3/src/main/org/jboss/ejb3/MCClientKernelAbstraction.java
   trunk/ejb3/src/main/org/jboss/ejb3/ProxyDeployer.java
   trunk/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java
   trunk/ejb3/src/main/org/jboss/ejb3/SessionContainer.java
Log:
fix E-EJB3 error when default client bind address wasn't being found

Modified: trunk/ejb3/src/main/org/jboss/ejb3/Ejb3AnnotationHandler.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/Ejb3AnnotationHandler.java	2006-09-05 22:52:44 UTC (rev 56591)
+++ trunk/ejb3/src/main/org/jboss/ejb3/Ejb3AnnotationHandler.java	2006-09-05 23:33:57 UTC (rev 56592)
@@ -129,14 +129,12 @@
          {
             StatelessContainer container = getStatelessContainer(ejbIndex);
             container.setJaccContextId(getJaccContextId());
-            container.setDefaultClientBinding(deployment.getDefaultClientBinding());
             containers.add(container);
          }
          else if (ejbType == EJB_TYPE.STATEFUL)
          {
             StatefulContainer container = getStatefulContainer(ejbIndex);
             container.setJaccContextId(getJaccContextId());
-            container.setDefaultClientBinding(deployment.getDefaultClientBinding());
             containers.add(container);
          }
          else if (ejbType == EJB_TYPE.MESSAGE_DRIVEN)
@@ -149,7 +147,6 @@
          {
             ServiceContainer container = getServiceContainer(ejbIndex);
             container.setJaccContextId(getJaccContextId());
-            container.setDefaultClientBinding(deployment.getDefaultClientBinding());
             containers.add(container);
          }
          else if (ejbType == EJB_TYPE.CONSUMER)

Modified: trunk/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java	2006-09-05 22:52:44 UTC (rev 56591)
+++ trunk/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java	2006-09-05 23:33:57 UTC (rev 56592)
@@ -22,17 +22,15 @@
 package org.jboss.ejb3;
 
 import javassist.bytecode.ClassFile;
+import org.hibernate.cfg.EJB3DTDEntityResolver;
 import org.hibernate.ejb.packaging.PersistenceMetadata;
 import org.hibernate.ejb.packaging.PersistenceXmlLoader;
-import org.hibernate.cfg.EJB3DTDEntityResolver;
-import org.jboss.ejb3.entity.PersistenceUnitDeployment;
-import org.jboss.ejb3.remoting.RemoteProxyFactory;
 import org.jboss.ejb3.enc.EjbModuleEjbResolver;
 import org.jboss.ejb3.enc.EjbModulePersistenceUnitResolver;
+import org.jboss.ejb3.entity.PersistenceUnitDeployment;
 import org.jboss.logging.Logger;
 import org.jboss.util.file.ArchiveBrowser;
 import org.jboss.util.file.ClassFileFilter;
-import org.jboss.util.xml.JBossEntityResolver;
 
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
@@ -45,7 +43,11 @@
 import java.io.DataInputStream;
 import java.io.InputStream;
 import java.net.URL;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
 
 /**
  * An EjbModule represents a collection of beans that are deployed as a unit.
@@ -77,9 +79,6 @@
    protected String defaultServiceDomain = "Service Bean";
    protected InitialContext initialContext;
 
-   // This is used to push the default client binding to the ProxyDeployer
-   protected String defaultClientBinding = RemoteProxyFactory.DEFAULT_CLIENT_BINDING;
-
    protected KernelAbstraction kernelAbstraction;
 
    // used for @Management interfaces
@@ -139,11 +138,6 @@
    }
 
 
-   public String getDefaultClientBinding()
-   {
-      return defaultClientBinding;
-   }
-
    /**
     * Returns a partial MBean attribute name of the form
     * ",ear=foo.ear,jar=foo.jar"

Modified: trunk/ejb3/src/main/org/jboss/ejb3/Ejb3JmxDeployment.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/Ejb3JmxDeployment.java	2006-09-05 22:52:44 UTC (rev 56591)
+++ trunk/ejb3/src/main/org/jboss/ejb3/Ejb3JmxDeployment.java	2006-09-05 23:33:57 UTC (rev 56592)
@@ -21,13 +21,10 @@
 */
 package org.jboss.ejb3;
 
-import javax.management.ObjectName;
 import javax.security.jacc.PolicyConfiguration;
 import org.jboss.deployment.DeploymentInfo;
 import org.jboss.ejb3.security.JaccHelper;
 import org.jboss.logging.Logger;
-import org.jboss.mx.util.MBeanProxyExt;
-import org.jboss.remoting.transport.ConnectorMBean;
 
 /**
  * JBoss 4.0 Microkernel specific implementation
@@ -70,21 +67,6 @@
 
    }
 
-   @Override
-   public String getDefaultClientBinding()
-   {
-      try
-      {
-         ObjectName on = new ObjectName("jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3");
-         ConnectorMBean connector = (ConnectorMBean) MBeanProxyExt.create(ConnectorMBean.class, on, deploymentInfo.getServer());
-         return connector.getInvokerLocator();
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-
    public DependencyPolicy createDependencyPolicy()
    {
       return new JmxDependencyPolicy();

Modified: trunk/ejb3/src/main/org/jboss/ejb3/MCClientKernelAbstraction.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/MCClientKernelAbstraction.java	2006-09-05 22:52:44 UTC (rev 56591)
+++ trunk/ejb3/src/main/org/jboss/ejb3/MCClientKernelAbstraction.java	2006-09-05 23:33:57 UTC (rev 56592)
@@ -21,18 +21,15 @@
 */
 package org.jboss.ejb3;
 
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import javax.management.ObjectName;
-
+import org.jboss.ejb3.embedded.resource.RARDeployment;
 import org.jboss.kernel.Kernel;
 import org.jboss.kernel.spi.registry.KernelRegistryEntry;
-
-import org.jboss.ejb3.embedded.resource.RARDeployment;
-
 import org.jboss.logging.Logger;
 
+import javax.management.ObjectName;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
 /**
  * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
  */
@@ -46,7 +43,7 @@
    {
       this.kernel = kernel;
    }
-   
+
    public Object invoke(ObjectName objectName, String operationName, Object[] params, String[] signature) throws Exception
    {
       String name = objectName.getCanonicalName();
@@ -56,9 +53,9 @@
          Object target = entry.getTarget();
          if (target instanceof RARDeployment)
          {
-            RARDeployment deployment = (RARDeployment)target;
+            RARDeployment deployment = (RARDeployment) target;
             return deployment.invoke(operationName, params, signature);
-         } 
+         }
          else
          {
             Class[] types = new Class[signature.length];
@@ -72,7 +69,7 @@
       }
       return null;
    }
-   
+
    public Object getAttribute(ObjectName objectName, String attribute) throws Exception
    {
       String name = objectName.getCanonicalName();
@@ -80,14 +77,8 @@
       if (entry != null)
       {
          Object target = entry.getTarget();
-         try
-         {
-            Field field = target.getClass().getField(attribute);
-            return field.get(target);
-         }
-         catch (NoSuchFieldException e)
-         {
-         }
+         Field field = target.getClass().getField(attribute);
+         return field.get(target);
       }
       return null;
    }

Modified: trunk/ejb3/src/main/org/jboss/ejb3/ProxyDeployer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/ProxyDeployer.java	2006-09-05 22:52:44 UTC (rev 56591)
+++ trunk/ejb3/src/main/org/jboss/ejb3/ProxyDeployer.java	2006-09-05 23:33:57 UTC (rev 56592)
@@ -57,7 +57,6 @@
    private Container container;
    private Advisor advisor;
    private ArrayList<ProxyFactory> proxyFactories = new ArrayList<ProxyFactory>();
-   private String defaultClientBinding = RemoteProxyFactory.DEFAULT_CLIENT_BINDING;
    private RemoteBindings remoteBindings;
    private LocalBinding localBinding;
 
@@ -69,11 +68,6 @@
 
    public List<ProxyFactory> getProxyFactories() { return proxyFactories; }
 
-   public void setDefaultClientBinding(String defaultClientBinding)
-   {
-      this.defaultClientBinding = defaultClientBinding;
-   }
-
    public void start() throws Exception
    {
       if (remoteBindings != null)
@@ -140,8 +134,7 @@
                log.debug("there is remote interfaces for " + container.getEjbName());
                String jndiName = ProxyFactoryHelper.getDefaultRemoteJndiName(container);
                log.debug("default remote binding has jndiName of " + jndiName);
-               // todo we need to have a way to define default configuration
-               String uri = defaultClientBinding;
+               String uri = ""; // use the default
                Class factory = null;
                factory = getDefaultRemoteProxyFactory();
                RemoteBinding[] list = {new RemoteBindingImpl(jndiName, "", uri, factory)};

Modified: trunk/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java	2006-09-05 22:52:44 UTC (rev 56591)
+++ trunk/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java	2006-09-05 23:33:57 UTC (rev 56592)
@@ -28,6 +28,7 @@
 import org.jboss.ejb.LocalImpl;
 import org.jboss.ejb.RemoteImpl;
 import org.jboss.logging.Logger;
+import org.jboss.ejb3.remoting.RemoteProxyFactory;
 
 import javax.ejb.Local;
 import javax.ejb.LocalHome;
@@ -421,11 +422,18 @@
    public static String getClientBindUrl(RemoteBinding binding) throws Exception
    {
       String clientBindUrl = binding.clientBindUrl();
-      if (clientBindUrl.length() == 0)
+      if (clientBindUrl.trim().length() == 0)
       {
          ObjectName connectionON = new ObjectName("jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3");
          KernelAbstraction kernelAbstraction = KernelAbstractionFactory.getInstance();
-         clientBindUrl = (String)kernelAbstraction.getAttribute(connectionON, "InvokerLocator");
+         try
+         {
+            clientBindUrl = (String)kernelAbstraction.getAttribute(connectionON, "InvokerLocator");
+         }
+         catch (Exception e)
+         {
+            clientBindUrl = RemoteProxyFactory.DEFAULT_CLIENT_BINDING;
+         }
       }
       
       return clientBindUrl;

Modified: trunk/ejb3/src/main/org/jboss/ejb3/SessionContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/SessionContainer.java	2006-09-05 22:52:44 UTC (rev 56591)
+++ trunk/ejb3/src/main/org/jboss/ejb3/SessionContainer.java	2006-09-05 23:33:57 UTC (rev 56592)
@@ -80,11 +80,6 @@
       proxyDeployer = new ProxyDeployer(this);
    }
 
-   public void setDefaultClientBinding(String binding)
-   {
-      proxyDeployer.setDefaultClientBinding(binding);
-   }
-
    public Class getInvokedBusinessInterface()
    {
       InvokedMethod method = invokedMethod.get();




More information about the jboss-cvs-commits mailing list