Hi! I just saw the docs for ExternalContext. Seems to be the way to do it. Testing it 
right now.
/Lennart
----- Original Message ----- 
From: Scott M Stark <[EMAIL PROTECTED]>
To: JBoss-User <[EMAIL PROTECTED]>
Sent: Thursday, March 08, 2001 1:14 AM
Subject: Re: [jBoss-User] SV: Ref to external ejb - deployd in non jbosscontainer


> There needs to be an ejipt url handler or object factory bound under ejipt: in
> order for the LinkRef to be resolved. A LnikRef is resolved relative to the
> InitialContext. Are you saying you were able to do:
> 
>     Object obj = new 
>InitialContext("ejipt://lks145:2323/Ecs.Checkout.CheckoutRegisterHome");
> 
> in the mbean? If not, then the LinkRef will not work. If you had to construct
> and InitialContext with other than no properties then you need to setup a federation.
> You could do this using the ExternalContext mbean.
> 
> ----- Original Message -----
> From: Lennart Petersson
> To: JBoss-User
> Sent: Wednesday, March 07, 2001 3:13 PM
> Subject: [jBoss-User] SV: Ref to external ejb - deployd in non jboss container
> 
> 
> Oh, i should have put a message from jboss console when trying to do the lookup. 
>Code looks like this:
> 
>    Object obj = new InitialContext().lookup("java:comp/env/ejb/CheckoutRegister");
>    System.out.println(obj);
> 
> And msg in jboss console is this:
> 
> [UniqueKey] Activated bean UniqueKey with id = se.benefit.util.UniqueKeyPK@4fc7a
> 011
> [UniqueKey] Failed to lookup checkoutregister:ejipt: not bound
> [UniqueKey] TRANSACTION ROLLBACK EXCEPTION:null; nested exception is:
>         javax.ejb.EJBException
> [UniqueKey] javax.naming.NameNotFoundException: ejipt: not bound
> [UniqueKey]     at org.jnp.server.NamingServer.getBinding(NamingServer.java:474)
> 
> [UniqueKey]     at org.jnp.server.NamingServer.getBinding(NamingServer.java:482)
> 
> [UniqueKey]     at org.jnp.server.NamingServer.getObject(NamingServer.java:488)
> [UniqueKey]     at org.jnp.server.NamingServer.lookup(NamingServer.java:254)
> [UniqueKey]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:29
> 5)
> [UniqueKey]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:27
> 9)
> [UniqueKey]     at javax.naming.InitialContext.lookup(Unknown Source)
> [UniqueKey]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:36
> 7)
> [UniqueKey]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:40
> 3)
> [UniqueKey]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:27
> 9)
> [UniqueKey]     at javax.naming.InitialContext.lookup(Unknown Source)
> [UniqueKey]     at se.benefit.util.UniqueKeyBean.getNextKey(UniqueKeyBean.java:2
> 12)
> [UniqueKey]     at se.benefit.util.UniqueKeyBean.getNextKey(UniqueKeyBean.java:1
> 75)
> [UniqueKey]     at se.benefit.util.UniqueKeyBean.getNextKey(UniqueKeyBean.java:1
> 61)
> [UniqueKey]     at java.lang.reflect.Method.invoke(Native Method)
> [UniqueKey]     at org.jboss.ejb.EntityContainer$ContainerInterceptor.invoke(Ent
> ityContainer.java:722)
> [UniqueKey]     at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke
> (EntitySynchronizationInterceptor.java:208)
> [UniqueKey]     at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(Entity
> InstanceInterceptor.java:186)
> [UniqueKey]     at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxIntercept
> orCMT.java:133)
> [UniqueKey]     at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(Tx
> InterceptorCMT.java:378)
> [UniqueKey]     at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCM
> T.java:99)
> [UniqueKey]     at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInte
> rceptor.java:137)
> [UniqueKey]     at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.ja
> va:195)
> [UniqueKey]     at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:323
> )
> [UniqueKey]     at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke
> (JRMPContainerInvoker.java:381)
> [UniqueKey]     at java.lang.reflect.Method.invoke(Native Method)
> [UniqueKey]     at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
> [UniqueKey]     at sun.rmi.transport.Transport$1.run(Unknown Source)
> [UniqueKey]     at java.security.AccessController.doPrivileged(Native Method)
> [UniqueKey]     at sun.rmi.transport.Transport.serviceCall(Unknown Source)
> [UniqueKey]     at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Sou
> rce)
> [UniqueKey]     at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unkn
> own Source)
> [UniqueKey]     at java.lang.Thread.run(Unknown Source)
> 
> /Lennart
> ----- Original Message -----
> From: Lennart Petersson
> To: JBoss-User
> Sent: Thursday, March 08, 2001 12:06 AM
> Subject: Ref to external ejb - deployd in non jboss container
> 
> 
> How is this set up?
> 
> I have a bean which need to call an ejb that is deployed in another ejb server (in 
>this case Ejipt but could/will be Weblogic).
> 
> How am i doing the lookup? I guess i have to use ctx = new InitialContext() to get 
>the context to use when looking up the bound ref
> in jboss, but how am i linked to the other server? When/how is 
>Ecs:Checkout.CheckoutRegisterHome bound in jboss jndi?
> 
> I did a test where i had a mben which during startup made a lookup to this other ejb 
>server and then stored a ref to
> Ecs.Checkout.CheckoutRegisterHome in jboss jndi, which i later on could use through 
>normal env lookup. But the most correct way
> ought to be to use ejb-ref-name and jndi-name descriptions in the xml-files. But i 
>can't get it to work.
> 
> Thanks,
> Lennart
> 
> My jboss.xml looks like this:
> <?xml version="1.0" encoding="UTF-8" ?>
> -  <jboss>
> -    <enterprise-beans>
> -      <entity>
>          <ejb-name>UniqueKey</ejb-name>
>            <jndi-name>ejb/UniqueKey</jndi-name>
> -          <ejb-ref>
>              <ejb-ref-name>ejb/CheckoutRegister</ejb-ref-name>
>              
><jndi-name>ejipt://lks145:2323/Ecs.Checkout.CheckoutRegisterHome</jndi-name>
>        </ejb-ref>
>    </entity>
>  </enterprise-beans>
> </jboss>
> 
> Part of my ejb-jar.xml looks like this:
> <?xml version="1.0" encoding="UTF-8" ?>
> -    <ejb-jar>
>        <display-name />
> -        <enterprise-beans>
> -          <entity>
>              <description>UniqueKey is the implementation of the UniqueKey 
>component.</description>
>              <ejb-name>UniqueKey</ejb-name>
>              <home>se.benefit.util.UniqueKeyHome</home>
>              <remote>se.benefit.util.UniqueKey</remote>
>              <ejb-class>se.benefit.util.UniqueKeyCMP</ejb-class>
>              <persistence-type>Container</persistence-type>
>              <prim-key-class>se.benefit.util.UniqueKeyPK</prim-key-class>
>              <reentrant>True</reentrant>
> -               --- skip ---
> -            <ejb-ref>
>               <ejb-ref-name>ejb/CheckoutRegister</ejb-ref-name>
>               <ejb-ref-type>Entity</ejb-ref-type>
>               <home>CheckoutRegisterHome</home>
>               <remote>CheckoutRegister</remote>
>           </ejb-ref>
>         </entity>
>        --- skip ---
> -  </ejb-jar>
> 
> 
> 
> --
> --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]

Reply via email to