User: reverbel
Date: 01/08/17 14:34:40
Modified: iiop/src/main/org/jboss/ejb/plugins/iiop/server
IIOPContainerInvoker.java
Log:
Now we register EJBHomes on the local (in-VM) CORBA naming server.
Revision Changes Path
1.3 +30 -19
contrib/iiop/src/main/org/jboss/ejb/plugins/iiop/server/IIOPContainerInvoker.java
Index: IIOPContainerInvoker.java
===================================================================
RCS file:
/cvsroot/jboss/contrib/iiop/src/main/org/jboss/ejb/plugins/iiop/server/IIOPContainerInvoker.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- IIOPContainerInvoker.java 2001/08/17 14:52:15 1.2
+++ IIOPContainerInvoker.java 2001/08/17 21:34:40 1.3
@@ -103,7 +103,7 @@
* CORBA reference for the corresponding <code>EJBObject</code>.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Francisco Reverbel</a>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class IIOPContainerInvoker
extends Servant
@@ -398,23 +398,31 @@
System.err.println("EJBHome reference for " + jndiName + ":");
System.err.println(orb.object_to_string((org.omg.CORBA.Object)ejbHome));
+ Context initialContext = null;
try {
// Bind the bean home in the JNDI initial context
- Context context = new InitialContext();
- rebind(context, jndiName, ejbHome);
+ initialContext = new InitialContext();
+ rebind(initialContext, jndiName, ejbHome);
System.err.println("Bound " + container.getBeanMetaData().getEjbName()
+ " to " + jndiName);
}
- catch (Exception e) {
- throw new ServerException(
- "Could not bind either home or invoker in JNDI", e);
+ catch (NamingException e) {
+ throw new ServerException("Could not bind EJBHome in JNDI", e);
}
+ NamingContextExt corbaContext = null;
+ try {
+ // Obtain local (in-VM) CORBA naming context
+ corbaContext = NamingContextExtHelper.narrow((org.omg.CORBA.Object)
+ initialContext.lookup("java:/JBossCorbaNaming"));
+ }
+ catch (NamingException e) {
+ throw new ServerException("Cannot lookup java:/JBossCorbaNaming: ",
+ e);
+ }
try {
- // Register bean home in the CORBA name service
- NamingContextExt rootContext = NamingContextExtHelper.narrow(
- orb.resolve_initial_references("NameService"));
- rebind(rootContext, jndiName, (org.omg.CORBA.Object)ejbHome);
+ // Register bean home in local CORBA naming context
+ rebind(corbaContext, jndiName, (org.omg.CORBA.Object)ejbHome);
}
catch (Exception e) {
throw new ServerException(
@@ -432,17 +440,20 @@
// try block so that if one fails the following ones will be
// executed anyway
try {
-
- // Unbind the bean home from JNDI initial context
- Context ctx = new InitialContext();
- ctx.unbind(jndiName);
- // Unregister bean home from CORBA name service
- NamingContext rootContext = NamingContextHelper.narrow(
- orb.resolve_initial_references("NameService"));
+ // Unbind bean home from the JNDI initial context
+ Context initialContext = new InitialContext();
+ initialContext.unbind(jndiName);
+
+ // Obtain local (in-VM) CORBA naming context
+ NamingContextExt corbaContext =
+ NamingContextExtHelper.narrow((org.omg.CORBA.Object)
+ initialContext.lookup("java:/JBossCorbaNaming"));
+
+ // Unregister bean home from local CORBA naming context
NameComponent[] name = new NameComponent[1];
name[0] = new NameComponent(jndiName, "");
- rootContext.unbind(name);
+ corbaContext.unbind(name);
// Deactivate the EJBHome
homePOA.deactivate_object(jndiName.getBytes());
@@ -646,7 +657,7 @@
* any non-existent intermediate contexts along the way.
*/
public static void rebind(NamingContextExt ctx,
- String strName, org.omg.CORBA.Object obj)
+ String strName, org.omg.CORBA.Object obj)
throws Exception
{
NameComponent[] name = ctx.to_name(strName);
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development