Ejb-ref and JNDI lookup problem

Hi,
I use WLS6.1sp2. I created one EntityBean and SessionBean jar files. I tried to
use session bean to refer entity bean, I failed. The details are as following:
In EntityBean's weblogic-ejb-jar.xml, I set:
<jndi-name>cabin.CabinHome</jndi-name>
In sessionbean's ejb-jar.xml
<ejb-ref>
<ejb-ref-name>ejb/CabinHome</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>com.titan.cabin.CabinHome</home>
<remote>com.titan.cabin.Cabin</remote>
</ejb-ref>
In sessionbean's weblogic-ejb-jar.xml
<reference-descriptor>
     <ejb-reference-description>
          <ejb-ref-name>ejb/CabinHome</ejb-ref-name>
          <jndi-name>ejb/CabinHome</jndi-name>
     </ejb-reference-description>
</reference-descriptor>
At sessionbean's client, I use
javax.naming.Context jndiContext = getInitialContext();
Object obj = jndiContext.lookup("java:comp/env/ejb/CabinHome");
When I run client file, I get the following error message:
- with nested exception:
[javax.naming.LinkException:  [Root exception is javax.naming.NameNotFoundException:
Unable to resolve ejb.CabinHome Resolved: '' Unresolved:'ejb' ; remaining name
'CabinHome']; Link Remaining Name: 'ejb/CabinHome']>
javax.naming.LinkException: . Root exception is javax.naming.NameNotFoundException:
Unable to resolve ejb.CabinHome Resolved: '' Unresolved:'ejb' ; remaining name
'CabinHome'
     <<no stack trace available>>
--------------- nested within: ------------------
javax.ejb.EJBException
- with nested exception:
[javax.naming.LinkException:  [Root exception is javax.naming.NameNotFoundException:
Unable to resolve ejb.CabinHome Resolved: '' Unresolved:'ejb' ; remaining name
'CabinHome']; Link Remaining Name: 'ejb/CabinHome']
     at com.titan.travelagent.TravelAgentBean.listCabins(TravelAgentBean.java:45)
     at com.titan.travelagent.TravelAgentBean_a4c3ph_EOImpl.listCabins(TravelAgentBean_a4c3ph_EOImpl.java:37)
     at com.titan.travelagent.TravelAgentBean_a4c3ph_EOImpl_WLSkel.invoke(Unknown
Source)
     at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
     at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:93)
     at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
     at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
     at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
     at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
####<Feb 1, 2002 11:32:40 PM PST> <Info> <Management> <dj> <travelServer> <ExecuteThread:
'14' for queue: 'default'> <system> <> <140009> <Configuration changes for domain
saved to the repository.>
Do you know what's wrong? how to fix this problem?
Thanks in advance.
DJ

Slava,
I took "cabin." out from weblogic-ejb-jar.xml, I got the same error.
DJ
"Slava Imeshev" <[email protected]> wrote:
Hi DJ,
I think you don't need "cabin." in weblogic-ejb-jar.xml :
<jndi-name>cabin.CabinHome</jndi-name>
Regards,
Slava Imeshev
"DJ" <[email protected]> wrote in message
news:[email protected]...
Hi,
I use WLS6.1sp2. I created one EntityBean and SessionBean jar files.I
tried to
use session bean to refer entity bean, I failed. The details are asfollowing:
In EntityBean's weblogic-ejb-jar.xml, I set:
<jndi-name>cabin.CabinHome</jndi-name>
In sessionbean's ejb-jar.xml
<ejb-ref>
<ejb-ref-name>ejb/CabinHome</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>com.titan.cabin.CabinHome</home>
<remote>com.titan.cabin.Cabin</remote>
</ejb-ref>
In sessionbean's weblogic-ejb-jar.xml
<reference-descriptor>
<ejb-reference-description>
<ejb-ref-name>ejb/CabinHome</ejb-ref-name>
<jndi-name>ejb/CabinHome</jndi-name>
</ejb-reference-description>
</reference-descriptor>
At sessionbean's client, I use
javax.naming.Context jndiContext = getInitialContext();
Object obj = jndiContext.lookup("java:comp/env/ejb/CabinHome");
When I run client file, I get the following error message:
- with nested exception:
[javax.naming.LinkException:  [Root exception is
javax.naming.NameNotFoundException:>> Unable to resolve ejb.CabinHome Resolved: '' Unresolved:'ejb' ; remaining>name>> 'CabinHome'; Link Remaining Name: 'ejb/CabinHome']>
javax.naming.LinkException: . Root exception isjavax.naming.NameNotFoundException:
Unable to resolve ejb.CabinHome Resolved: '' Unresolved:'ejb' ; remainingname
'CabinHome'
<<no stack trace available>>
--------------- nested within: ------------------
javax.ejb.EJBException
- with nested exception:
[javax.naming.LinkException:  [Root exception is
javax.naming.NameNotFoundException:>> Unable to resolve ejb.CabinHome Resolved: '' Unresolved:'ejb' ; remaining>name>> 'CabinHome'; Link Remaining Name: 'ejb/CabinHome']
atcom.titan.travelagent.TravelAgentBean.listCabins(TravelAgentBean.java:45)
atcom.titan.travelagent.TravelAgentBean_a4c3ph_EOImpl.listCabins(TravelAgentBe
an_a4c3ph_EOImpl.java:37)
atcom.titan.travelagent.TravelAgentBean_a4c3ph_EOImpl_WLSkel.invoke(Unknown
Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
atweblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java
:93)
atweblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
atweblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:2
2)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
####<Feb 1, 2002 11:32:40 PM PST> <Info> <Management> <dj> <travelServer><ExecuteThread:
'14' for queue: 'default'> <system> <> <140009> <Configuration changesfor
domain
saved to the repository.>
Do you know what's wrong? how to fix this problem?
Thanks in advance.
DJ

Similar Messages

  • Ejb-ref, ejb-link or JNDI lookup

    If I have an application in which one EJB is using another EJB in the SAME application,
    what is the best of way of accessing the other EJB?
    Why would I use ejb-ref / ejb-link instead of just looking it up in the JNDI?
    Just curious.
    Thanks.
    Dan

    ejb-ref/ejb-link were introduced in the ejb spec to allow bean developers to
    develop beans without any knowledge of the environment into which they would
    be deployed. If you can live with hard coded jndi names then that is fine or
    you can use the mechanism define below but using ejb-ref/ejb-link makes your
    beans more reuseable and less dependent on the final environement.
    If both the ejbs are in the same application I would recommend using ejb-ref
    and ejb-link.
    -- Anand
    "Chad McDaniel" <[email protected]> wrote in message
    news:[email protected]..
    "Dan Baumbach" <[email protected]> writes:
    If I have an application in which one EJB is using another EJB in the
    SAME application,
    what is the best of way of accessing the other EJB?
    Why would I use ejb-ref / ejb-link instead of just looking it up in theJNDI?
    >>
    >
    I believe that ejb-ref/link is not useful in most systems and causes
    another level of complexity to maintain. Since EJBs are complex enough
    I think that using the basic JNDI lookup is preferable. Also, this
    frees you to move the beans to a remote server if you ever want to.
    The simplest and most flexible technique, I believe, is to use a
    utility class that handles all EJB lookups for you and use a simple
    EJB and JNDI name mapping that this class can generate the JNDI name
    with a simply manipulation of the bean name. If you ever change the
    reference technique you will then only have one class to modify.
    This is also a good place to cache home references.

  • JWS - EJB JNDI Lookup problem

    Hi,
    I have a client Java application accessing a session EJB in a remote JBoss J2EE server. I'm using JWS 1.2 to deploy my application but when I do a JNDI lookup to get access the the remote's object home interface I get this error:
    "Need to specify class name in environment or system property, or as an applet parameter, or in an application resorce file: java.naming.factory.initial"
    All the jar files are signed and the JNPL file contains <all-permissions/>. This is the code that triggers the exception
    jndiContext = new InitialContext();
    homeRMIReference = jndiContext.lookup(C_SERVICE_NAME);
    Any help would be appreciated.
    Thanks in advance,
    Rafael

    Hi,
    I've finally found the origin of the problem.
    1. JNDI uses a minimum set of properties during initialization phase:
    java.naming.factory.initial
    java.naming.factory.url.pkgs
    java.naming.provider.url
    Therefore these properties must be set in the <resource> topic of the JNLP file. The value of these properties is defined in the jndi.properties file that you can find in jbossjmx.ant.jar (within the jboss/client directory)
    2. You have to add the JBoss files to your bundle. For doing so I've unjared all the .jar files within the jboss/client directory; afterwards I have jared them in a single file "jboss.jar" and I've signed the file. I've added jboss.jar to the <resource> tag within the JNLP file (Note that I've added all the jboss files just to do quick check but usually you will have to add only those files you need (it doesn't make sense to deploy all JBoss files in each client application)
    I hope this helps,
    Rafael

  • EJB 3.0 and jndi lookup (simple question)

    hi all,
    i am newbie on Weblogic Application Server and i have some issues,
    i have weblogic application server 10.0, also i have oracle timesten in-memory database, i have configured datasource and deploy my ejb 3.0 application, but i could not done jndi lookup?
    here is my example:
    1. one stateless session bean :
    import javax.ejb.Remote;
    @Remote
    public interface InsertSubscriber {
         public void insertSubscriber(SubscriberT subscriberT);
    } 2. here is it's implementation :
    @Remote(InsertSubscriber.class)
    @Stateless
    public class InsertSubscriberBean implements InsertSubscriber {
         @PersistenceContext(unitName = "TimesTenDS")
         private EntityManager oracleManager;
         public void insertSubscriber(SubscriberT subscriber)
              try {
                   System.out.println("started");
                   oracleManager.persist(subscriber);
                   System.out.println("end");
              } catch (Exception e) {
                   e.printStackTrace();
    }3 and my test client :
    public class Client {
         public static void main(String[] args) {
              Context ctx = null;
              Hashtable ht = new Hashtable();
              ht.put(Context.INITIAL_CONTEXT_FACTORY,
                        "weblogic.jndi.WLInitialContextFactory");
              ht.put(Context.PROVIDER_URL, "t3://192.9.200.222:7001");
              try {
                   ctx = new InitialContext(ht);
                   InsertSubscriber usagefasade = (InsertSubscriber) ctx
                             .lookup("ejb.InsertSubscriberBean");               
              } catch (NamingException e) {
                   e.printStackTrace();
              } finally {
                   try {
                        ctx.close();
                   } catch (Exception e) {
                        e.printStackTrace();
    }what i did incorrect ???
    i got error like this : Name not fount exception
    when i tried to view jndi tree on weblogic server application console i found this :
         Binding Name:     
    TimestenExampleTimestenExample_jarInsertSubscriberBean_InsertSubscriber     
         Class:     
    test.InsertSubscriberBean_o7jk9u_InsertSubscriberImpl_1000_WLStub     
         Hash Code:     
    286     
         toString Results:     
    weblogic.rmi.internal.CollocatedRemoteRef - hostID: '2929168367193491522S::billing_domain:AdminServer', oid: '286', channel: 'null'what does it mean how i can done lookup to jndi ?
    Regards,
    Paata Lominadze,
    Magticom LTD.
    Georgia.

    Hi All,
    I am using the weblogic cluster with session replication and EJB 2.0 with Local entity beans.
    for fail-over session should be replicated to another server so we can achive the same session if 1st server fails.
    Suppose i m using two managed server(server1,server2) in the cluster.I am storing the object of class ABC into session and object contains the instance of Local-EntityBean home but i put that as a transient.I have also override the readObject and write object method.
    when write object is called on 1st server,readObject method should be called on second server so we will be sure that session is replicating properly.
    pleaase find the code below : -
    public IssuerPageBean() {
    initEJB();
    private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
    stream.defaultReadObject();
    initEJB();
    initializeCommonObject();
    private void writeObject(java.io.ObjectOutputStream stream) throws IOException {
    stream.defaultWriteObject();
    private void initEJB() {
    try {
    ic = new InitialContext();
    issuerHome = (LocalIssuerHome) ic.lookup("java:comp/env/Issuer");
    } catch (NamingException e) {
    e.printStackTrace();
    in my case if i am calling the constructor IssuerPageBean(),it calls the initEJB() method and lookeup the entity local home properly but when readObject method is called on another server only initEJB() method is called directly and getting the exception below :
    WARNING: Error during create -
    javax.naming.NameNotFoundException: remaining name: env/ejb/Client
    at weblogic.j2eeclient.SimpleContext.resolve(Ljavax/naming/Name;Z)Ljavax/naming/Context;(SimpleContext.java:35)
    at weblogic.j2eeclient.SimpleContext.resolve(Ljavax/naming/Name;)Ljavax/naming/Context;(SimpleContext.java:39)
    at weblogic.j2eeclient.SimpleContext.lookup(Ljavax/naming/Name;)Ljava/lang/Object;(SimpleContext.java:57)
    at weblogic.j2eeclient.SimpleContext.lookup(Ljavax/naming/Name;)Ljava/lang/Object;(SimpleContext.java:57)
    at weblogic.j2eeclient.SimpleContext.lookup(Ljava/lang/String;)Ljava/lang/Object;(SimpleContext.java:62)
    at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(Ljava/lang/String;)Ljava/lang/Object;(ReadOnlyCont
    extWrapper.java:45)
    at weblogic.jndi.internal.AbstractURLContext.lookup(Ljava/lang/String;)Ljava/lang/Object;(AbstractURLContext.jav
    a:130)
    at javax.naming.InitialContext.lookup(Ljava/lang/String;)Ljava/lang/Object;(InitialContext.java:347)
    at com.lb.equities.veda.tools.salesvault.jsp.ClientPageBean.initEJB()V(ClientPageBean.java:218)
    at com.lb.equities.veda.tools.salesvault.jsp.ClientPageBean.readObject(Ljava/io/ObjectInputStream;)V(ClientPageB
    ean.java:191)
    at java.lang.LangAccessImpl.readObject(Ljava/lang/Class;Ljava/lang/Object;Ljava/io/ObjectInputStream;)V(Unknown
    Source)
    at java.io.ObjectStreamClass.invokeReadObject(Ljava/lang/Object;Ljava/io/ObjectInputStream;)V(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Ljava/lang/Object;Ljava/io/ObjectStreamClass;)V(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Z)Ljava/lang/Object;(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Z)Ljava/lang/Object;(Unknown Source)
    at java.io.ObjectInputStream.readObject()Ljava/lang/Object;(Unknown Source)
    at java.util.HashMap.readObject(Ljava/io/ObjectInputStream;)V(Unknown Source)
    at java.lang.LangAccessImpl.readObject(Ljava/lang/Class;Ljava/lang/Object;Ljava/io/ObjectInputStream;)V(Unknown
    Source)
    at java.io.ObjectStreamClass.invokeReadObject(Ljava/lang/Object;Ljava/io/ObjectInputStream;)V(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Ljava/lang/Object;Ljava/io/ObjectStreamClass;)V(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Z)Ljava/lang/Object;(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Z)Ljava/lang/Object;(Unknown Source)
    at java.io.ObjectInputStream.defaultReadFields(Ljava/lang/Object;Ljava/io/ObjectStreamClass;)V(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Ljava/lang/Object;Ljava/io/ObjectStreamClass;)V(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Z)Ljava/lang/Object;(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Z)Ljava/lang/Object;(Unknown Source)
    at java.io.ObjectInputStream.readObject()Ljava/lang/Object;(Unknown Source)
    at weblogic.common.internal.ChunkedObjectInputStream.readObject()Ljava/lang/Object;(ChunkedObjectInputStream.jav
    a:120)
    at weblogic.rjvm.MsgAbbrevInputStream.readObject(Ljava/lang/Class;)Ljava/lang/Object;(MsgAbbrevInputStream.java:
    121)
    at weblogic.cluster.replication.ReplicationManager_WLSkel.invoke(ILweblogic/rmi/spi/InboundRequest;Lweblogic/rmi
    /spi/OutboundResponse;Ljava/lang/Object;)Lweblogic/rmi/spi/OutboundResponse;(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(Lweblogic/rmi/extensions/server/RuntimeMethodDescriptor;Lweblogic
    /rmi/spi/InboundRequest;Lweblogic/rmi/spi/OutboundResponse;)V(BasicServerRef.java:492)
    Please help .
    Thanks in Advance.
    Edited by hforever at 03/04/2008 7:28 AM

  • EJB 3.0 JNDI lookup results in Classcast Exception

    Hello everybody,
    I�m experiencing a strange problem when I want to retrieve a stateless session bean from a POJO in my enterprise app. I am using EJB 3.0, running on Glassfish build 33 and JDK 1.5.
    I have successfully deployed my ear file which has the EJB.jar and the war file in it. I�m using JSF 1.2 in the web app and I am able to use all session beans using the injection annotation in my managed beans (this is how it is supposed to be according to the spec.). However, I now need to acces a stateless session bean from a POJO (non-managed or backing bean) which resides also in the war file. I�m using the following code to retrieve the session bean:
    (where IMySessionBean = remote interface and MySessionBean is the implementation)
    try {
    ic = new InitialContext();
    MySessionBean mybean = (MySessionBean )ic.lookup("env/IMySessionBean");
    When casting the object from the lookup into MySessionBean I get a classcast Exception. However, I can see the session bean using the JNDI browser that comes with Glassfish and it�s deployed and available. If mybean is of type Object, I see that the lookup method returns a wrapper of my session bean.
    Here�s what the stacktrace says:
    java.lang.ClassCastException: com.myproject.ejb.interfaces._IMySessionBean_Wrapper
         at ...
    Do I miss something here and there�s more required to obtain a reference to the session bean? I�m pretty much stuck here and any help is greastly appreciated!
    Thanks in advance!
    Cheers,
    Joerg

    Hi Joerg,
    In the session bean client view, the bean implementation class is never used. The client
    only interacts with the local or remote interface.
    Regarding the lookup, the more portable approach is to
    lookup the ejb reference through the component environment of the web application
    rather than doing a direct global lookup. If you have already defined any ejb reference
    injections somewhere in the web app, you can look up the same dependencies via
    java:comp/env. For example, if your managed bean has the following @EJB annotation :
    @EJB(name="mybeanref") IMySessionBean beanRef;
    You can look up the same underlying dependency in your utility class :
    IMySessionBean beanRef = (IMySessionBean) new InitialContext().lookup
    ("java:comp/env/mybeanref");
    Note that the portion of the lookup string after java:comp/env/ comes from the name() attribute
    of @EJB. @EJB name() has the same semantics as the ejb-ref-name in the deployment
    descriptor. You can find more info on these topics in our EJB FAQ :
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html

  • JNDI lookup problem in WAS 5.1

    Hello all,
    I have generated an EAR using XDoclet and MyEclipse. When I deploy this EAR on WAS 5.1, I get the following exception:
    javax.naming.NameNotFoundException: Context: WarHog/nodes/WarHog/servers/server1, name: ejb/TEDIObjectManagerLocal: First component in name TEDIObjectManagerLocal not found.  Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
         at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:85)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
         at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
         at com.ibm.rmi.iiop.CDRInputStream.readBoxedIDLEntity(CDRInputStream.java:2112)
         at com.ibm.rmi.iiop.CDRInputStream.readIDLValue(CDRInputStream.java:2177)
         at com.ibm.rmi.iiop.CDRInputStream.fast_read_value(CDRInputStream.java:1734)
         at com.ibm.rmi.io.IIOPInputStream.readValueType(IIOPInputStream.java:2085)
         at com.ibm.rmi.io.IIOPInputStream.readObjectField(IIOPInputStream.java:2057)
         at com.ibm.rmi.io.IIOPInputStream.inputClassFields(IIOPInputStream.java:1765)
         at com.ibm.rmi.io.IIOPInputStream.inputObjectUsingClassDesc(IIOPInputStream.java:1348)
         at com.ibm.rmi.io.IIOPInputStream.continueSimpleReadObject(IIOPInputStream.java:420)
         at com.ibm.rmi.io.IIOPInputStream.simpleReadObjectLoop(IIOPInputStream.java:404)
         at com.ibm.rmi.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:347)
         at com.ibm.rmi.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:200)
         at com.ibm.rmi.iiop.CDRInputStream.read_value(CDRInputStream.java:1367)
         at com.ibm.rmi.util.ProxyUtil.copyObject(ProxyUtil.java:450)
         at com.ibm.CORBA.iiop.UtilDelegateImpl.copyObject(UtilDelegateImpl.java:789)
         at javax.rmi.CORBA.Util.copyObject(Util.java:333)
         at com.wdc.tedi.interfaces._TransformationEngine_Stub.transform(_TransformationEngine_Stub.java:268)
         at com.wdc.tedi.web.TestHarnessBean.translate(TestHarnessBean.java:42)
         at com.wdc.tedi.web.TestHarnessBean.setDataBlob(TestHarnessBean.java:80)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)First of all, I don't really understand what the error means. Is it that the JNDI lookup failed when one of my beans tried to do a lookup on 'ejb/TEDIObjectManagerLocal'? I believe there's some configuration that went wrong (EJB reference binding or something) when I deployed the EAR. The reason I don't think it's a faulty code is because the EAR runs like a charm when I deploy it on Oracle 10g and Weblogic.
    I am really stuck on this problem and shall appreciate any help that I can get. I can send the code, xdoclet tags and configuration if that might assist someone.
    Thanks
    -ybh6336

    Hello all,
    I'm still stuck on this issue. Following are the entries related to my
    application when I do a 'dumpNameSpace':
       28 (top)/nodes/WarHog/servers/server1/ejb/tedi/TEDIObjectManager
       28
    com.wdc.tedi.interfaces._TEDIObjectManagerHome_Stub
       29 (top)/nodes/WarHog/servers/server1/ejb/tedi/DSValueLookup
       29
    com.wdc.tedi.interfaces._DSValueLookupHome_Stub
       30 (top)/nodes/WarHog/servers/server1/ejb/tedi/TransformationEngine
       30
    com.wdc.tedi.interfaces._TransformationEngineHome_StubObservations:
    - I only see the namespace entries for my Session beans. There's one
    entity bean also which does not show up.
    - I don't see anything for the Local Home interfaces, it shows only the
    Home interfaces.
    As additional information, I'm looking up 'TEDIObjectManagerLocal'
    using 'ejb/TEDIObjectManagerLocal'. I also tried using 'local:ejb/ejb/TEDIObjectManagerLocal' (as Karthyk suggested) and
    'java:comp/env/ejb/TEDIObjectManagerLocal', but that does not work
    either.
    Also, the XDoclet tags that I use to generate the interfaces for
    TEDIObjectManager bean are as follows:
    /* @ejb.bean name="TEDIObjectManager"
    *           display-name="TEDIObjectManager"
    *           description="TEDIObjectManager"
    *           jndi-name="ejb/tedi/TEDIObjectManager"
    *           local-jndi-name="ejb/TEDIObjectManagerLocal"
    *           type="Stateless"
    *           view-type="both"
    * @ejb.util generate="physical"
    * @ejb.ejb-ref ejb-name="TEDIObject"
    * view-type = "local"
    * ref-name = "ejb/TEDIObjectLocal"
    * @oc4j.bean jndi-name="ejb/tedi/TEDIObjectManager"
    */My ejb-jar.xml looks like following for that bean:
    <session >
             <description><![CDATA[TEDIObjectManager]]></description>
             <display-name>TEDIObjectManager</display-name>
             <ejb-name>TEDIObjectManager</ejb-name>
             <home>com.wdc.tedi.interfaces.TEDIObjectManagerHome</home>
             <remote>com.wdc.tedi.interfaces.TEDIObjectManager</remote>
    <local-home>com.wdc.tedi.interfaces.TEDIObjectManagerLocalHome</local-home>
             <local>com.wdc.tedi.interfaces.TEDIObjectManagerLocal</local>
    <ejb-class>com.wdc.tedi.ejb.TEDIObjectManagerSession</ejb-class>
             <session-type>Stateless</session-type>
             <transaction-type>Container</transaction-type>
             <ejb-local-ref >
                <ejb-ref-name>ejb/TEDIObjectLocal</ejb-ref-name>
                <ejb-ref-type>Entity</ejb-ref-type>
    <local-home>com.wdc.tedi.interfaces.TEDIObjectLocalHome</local-home>
                <local>com.wdc.tedi.interfaces.TEDIObjectLocal</local>
                <ejb-link>TEDIObject</ejb-link>
             </ejb-local-ref>
          </session>AND following for the bean that is referencing it:
    <session >
             <description><![CDATA[TransformationEngine]]></description>
             <display-name>TransformationEngine</display-name>
             <ejb-name>TransformationEngine</ejb-name>
             <home>com.wdc.tedi.interfaces.TransformationEngineHome</home>
             <remote>com.wdc.tedi.interfaces.TransformationEngine</remote>
    <local-home>com.wdc.tedi.interfaces.TransformationEngineLocalHome</local-home>
    <local>com.wdc.tedi.interfaces.TransformationEngineLocal</local>
    <ejb-class>com.wdc.tedi.ejb.TransformationEngineSession</ejb-class>
             <session-type>Stateless</session-type>
             <transaction-type>Container</transaction-type>
             <ejb-local-ref >
                <ejb-ref-name>ejb/TEDIObjectManagerLocal</ejb-ref-name>
                <ejb-ref-type>Session</ejb-ref-type>
    <local-home>com.wdc.tedi.interfaces.TEDIObjectManagerLocalHome</local-home>
    <local>com.wdc.tedi.interfaces.TEDIObjectManagerLocal</local>
                <ejb-link>TEDIObjectManager</ejb-link>
             </ejb-local-ref>
          </session>The entries in ibm-ejb-jar-bnd.xmi (generated using MyEclipse) are as
    follows for the two beans:
    <ejbBindings
             xmi:id="Session_bnd_1"
             jndiName="ejb/tedi/TransformationEngine">
             <ejbRefBindings xmi:id="EJBRefBnd_1"
    jndiName="ejb/TEDIObjectManagerLocal">
        <bindingEjbRef href="META-INF/ejb-jar.xml#EJBLocalRef_1"/>
             </ejbRefBindings>
             <enterpriseBean
                xmi:type="ejb:Session"
    href="META-INF/ejb-jar.xml#Session_TransformationEngine" />
          </ejbBindings>
    <ejbBindings
             xmi:id="Session_bnd_3"
             jndiName="ejb/tedi/TEDIObjectManager">
             <ejbRefBindings xmi:id="EJBRefBnd_2"
    jndiName="ejb/TEDIObjectLocal">
        <bindingEjbRef href="META-INF/ejb-jar.xml#EJBLocalRef_2"/>
             </ejbRefBindings>
             <enterpriseBean
                xmi:type="ejb:Session"
    href="META-INF/ejb-jar.xml#Session_TEDIObjectManager" />
          </ejbBindings>I know I'm swamping the post with code, but please let me know if anyone finds something unusual.
    NOTE: When deploying on WAS, in the 'Map EJB references to beans' step, I'm giving the following values for 'TransformationEngine' bean:
    Reference binding: ejb/TEDIObjectManagerLocal
    JNDI Name: ejb/tedi/TEDIObjectManager
    There's one other similar binding that works for 'TEDIObjectManager'
    bean:
    Reference binding: ejb/TEDIObjectLocal
    JNDI Name: ejb/TEDIObject
    Everything in ejb-jar and ibm-ejb-jar-bnd.xmi look similar for this working bean, there is one difference though, I do the lookup on this one using 'java:comp/env/ejb/TEDIObjectLocal', but I've already tried that for the other one.
    Really appreciate your time.
    Thanks
    -yogesh

  • JNDI Lookup Problem (General Problem)

    hi all,
    i am newbie on bea products, but i have some experience on java technologies, how i fount on bea documentations and forums many people has the same problem like this, can anybody help us (me)?
    problem: how is it possible to write simple client for j2ee server application? i found some posts about jndi lookup, and fount about j2ee client, but is there any doc or example how to write this j2ee client ???
    i worked with many application servers and i have no problem with them (JBoss, Sun App Server, IBM Websophere, Oracle AS etc.)
    some people told about jndi tree on Web Logic Server Administration console , i found this tree i my session beans looks like :
    Binding Name:
    TimestenExampleTimestenExample_jarInsertSubscriberBean_InsertSubscriber
    Class:     
    test.InsertSubscriberBean_o7jk9u_InsertSubscriberImpl_1000_WLStub
    why is so strange name for class or binding name ????
    my session bean name is : InsertSubscriber
    and it's implementation : InsertSubscriberBean
    how i can lookup from client ?????
    can anybody show me code snippet ???
    my client looks like :
    import java.util.Hashtable;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NameClassPair;
    import javax.naming.NamingEnumeration;
    import javax.naming.NamingException;
    import org.hibernate.property.Dom4jAccessor.ElementGetter;
    public class Client {
         public static void main(String[] args) {
              Context ctx = null;
              Hashtable ht = new Hashtable();
              ht.put(Context.INITIAL_CONTEXT_FACTORY,
                        "weblogic.jndi.WLInitialContextFactory");
              ht.put(Context.PROVIDER_URL, "t3://192.9.200.222:7001");
              try {
                   ctx = new InitialContext(ht);
                   InsertSubscriber usagefasade = (InsertSubscriber) ctx
                             .lookup("java:comp/InsertSubscriber");
              } catch (NamingException e) {
                   e.printStackTrace();
              } finally {
                   try {
                        ctx.close();
                   } catch (Exception e) {
                        e.printStackTrace();
    }can anybody show me what is there incorrect ????
    oo yes and i have weblogic.jar file into my client classpath.

    Hi,
    Your EJB client looks fine.
    You should use the JNDI name of your ejb while doing the lookup. i.e :
    InsertSubscriber usagefasade = (InsertSubscriber) ctx.lookup("..use JNDI name of EJB...");
    You can use the JNDI name of the EJB that you see in the JNDI tree of weblogic. [don't use Binding Name or Class name]. you can also specify the JNDI name by "jndi-name" attribute in weblogic-ejb-jar.xml.
    for more info:
    http://e-docs.bea.com/wls/docs81/ejb/ejb11.html
    Thanks,
    Qumar Hussain

  • Looking for tips on a OC4J/JNDI lookup problem

    Hello All,
    I am running into a situation where a user I have setup in Oracle Enterprise Manager 10G Instance Level Security is not able to access our JNDI resources. We have tried providing all the roles(including administrators) to this user, but to no success. For some reason it works in standalone though.
    Our exception is fired when deploying the application and the spring configuration tells the app to fetch the jms connection factory from JNDI.
    Caused by: javax.naming.NoPermissionException: Not allowed to look up jms/ConnectionFactory, check the namespace-access tag setting in orion-application.xml for details
    +     at com.evermind.server.rmi.RMIClientConnection.handleLookupResponse(RMIClientConnection.java:873)+
    +     at com.evermind.server.rmi.RMIClientConnection.handleOrmiCommandResponse(RMIClientConnection.java:337)+
    +     at com.evermind.server.rmi.RMIClientConnection.dispatchResponse(RMIClientConnection.java:296)+
    +     at com.evermind.server.rmi.RMIClientConnection.processReceivedCommand(RMIClientConnection.java:278)+
    +     at com.evermind.server.rmi.RMIConnection.handleCommand(RMIConnection.java:152)+
    +     at com.evermind.server.rmi.RMIConnection.listenForOrmiCommands(RMIConnection.java:127)+
    +     at com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:107)+
    +     at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)+
    +     at java.lang.Thread.run(Thread.java:595)+
    +     at com.evermind.server.rmi.RMICall.warningExceptionOriginatesFromTheRemoteServer(RMICall.java:109)+
    +     at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:91)+
    +     at com.evermind.server.rmi.RMIClientConnection.waitForJndiResponse(RMIClientConnection.java:425)+
    +     at com.evermind.server.rmi.RMIClientConnection.lookup(RMIClientConnection.java:233)+
    +     at com.evermind.server.rmi.RMIClient.lookup(RMIClient.java:302)+
    +     at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:56)+
    +     ... 43 more+
    I wonder if there is a specific role that OC4J is looking for to allow the app to use JNDI? One thread I read earlier mentioned granting the user RMI permission. Any tips on where this could be configured?
    Our namespace section of the orion application xml file is below...
         <namespace-access>
              <read-access>
                   <namespace-resource root="">
                        <security-role-mapping name="&lt;jndi-user-role&gt;">
                             <group name="administrators" />
                        </security-role-mapping>
                   </namespace-resource>
              </read-access>
              <write-access>
                   <namespace-resource root="">
                        <security-role-mapping name="&lt;jndi-user-role&gt;">
                             <group name="administrators" />
                        </security-role-mapping>
                   </namespace-resource>
              </write-access>
         </namespace-access>
    Any thoughts or recommendations for isolating and troubleshooting the problem would be highly appreciated.
    Many Thanks in Advance Guys!

    What Mylenium said. Although, perhaps with Forge Freeform and a huge amount of work, you might be able to fake it.

  • EJB 3.0 JNDI lookup gives ClassCastException

    The object returned by the JNDI lookup of a EJB 3.0 Statefull Session Bean is not of the expected type, but rather of an obviously generated Proxy type (ejb_DistributionProcessor_LocalProxy_4h350 instead of expected DistributionProcessor). Does anybody have any idea about what this could be?
    Details:
    We are using annotations @Statefull and @Local and are deploying on a standalone OC4J 10.1.3.1. The beans are presumably loaded correctly since they get listed in Enterprise Managers list of beans for the application. There is also obviously an object at the desired JNDI location, presumably some kind of proxy. Unfortunately the proxy cannot be cast to the original type making the retrieved object useless.
    I can supply more details if necessary, but really don't know what more is relevant.

    Well, I figured it out, it seems I had the classes in both the EJB and the WEB deployment, so when casting it tried to cast X from EJB to X from WEB application and since they reside in different locations they weren't the same file and therefore not castable.

  • OC4J JNDI lookup problem

    I'm developing a simple struts app in JDeveloper where the model component connects to an Oracle database. The webapp works fine when I deploy it... I just want to get it running locally in the embedded OC4J server. I get this stack trace error:
    javax.naming.NameNotFoundException: java:/comp/env not found
    at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:164)
    at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:333)
    at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:120)
    at javax.naming.InitialContext.lookup(InitialContext.java:347)
    at lsqtms.LoginModel.checkLoginAgainstDB(LoginModel.java:34)
    at lsqtms.LoginAction.execute(LoginAction.java:45)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
    at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:649)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
    at java.lang.Thread.run(Thread.java:534)
    Here is my code to access this connection pool:
    Context initContext = new InitialContext();
    Context envContext = (Context) initContext.lookup("java:/comp/env"); //error occurs here
    javax.sql.DataSource ds = (javax.sql.DataSource) envContext.lookup("Oracle");
    Connection conn = ds.getConnection();     // retreive db connection from pool     
    I've tried to edit the OC4J preferences for the DataSource and JNDI and data-sources.xml... no luck...
    I read the OC4J article on datasources and I'm not really sure what I'm doing - I apologize for being a "newbie." How can I fix this so that I can write and debug code locally.
    Thanks
    Doug

    To web.xml add
    <resource-ref>
      <res-ref-name>jdbc/OracleDS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
    </resource-ref>Obtaing Connection with
    InitialContext initialContext = new InitialContext();
        javax.sql.DataSource ds = (javax.sql.DataSource)initialContext.lookup("java:comp/env/jdbc/OracleDS");
    java.sql.Connection conn = ds.getConnection();

  • Websphere JNDI lookup problem

    Hi All
    Two separate webapps, have different names for Datasources, on the same host and port. Both application work fine independently.
    When we deploy both applications on the same app server(websphere), whichever we executes first gets its datasource from JNDI lookup and works fine, but when we try second application it have problem in finding its data source from JNDI lookup. If we start this second application first, it will work fine, but now another will have the same problem in its JNDI lookup.
    Any idea why.
    Thanks
    ....Ranvir

    Hi All
    Two separate webapps, have different names for
    Datasources, on the same host and port. Both
    application work fine independently.
    When we deploy both applications on the same app
    server(websphere), whichever we executes first gets
    its datasource from JNDI lookup and works fine, but
    when we try second application it have problem in
    finding its data source from JNDI lookup. If we start
    this second application first, it will work fine, but
    now another will have the same problem in its JNDI
    lookup.
    Any idea why.
    Thanks
    ....RanvirHi Ranvir,
    Do you mean you try to reach the same datasource with different names or do you try to reach different datasources over the same port?
    If you try the first issue you shouldn't get any trouble. At least it works fine with JBOSS for example.
    But if you try to do the latter in my oppinion you don't have a JNDI problem but a problem with socket binding: the two different databases must be contacted over different ports.
    What do WebSphere's logs tell?
    Best regards
    Andy

  • JPA's EntityManagerFactory jndi lookup problem

    Hi,
    I need to do jndi lookup of EntityManagerFactory from DAO layer. I don't want to inject entitymanagerfactory in a session bean.
    I am using weblogic 10.0 . I could do a jndi lookup for jboss and oracle servers but not for weblogic
    I have tried below code which fails:
    ic.lookup("java:comp/env/EJB30");
    ic.lookup("java:comp/env/persistence/EJB30");
    <?xml version="1.0" encoding="windows-1252" ?>
    <persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
    version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
    <persistence-unit name="EJB30" >
    <jta-data-source>
    jdbc/empDS
    </jta-data-source>
    <class>
    com.Department
    </class>
    <class>
    com.Employee
    </class>
    </persistence-unit>
    </persistence>
    Error is:
    javax.naming.NameNotFoundException: While trying to look up comp/env/EJB30 in /app/ejb/DeptEJB30.jar#empSessionEJBBean.; remaining name 'comp/env/EJB30'
    Regards,
    Prashant

    In your EJB add the annotation @TransactionManagement(TransactionManagementType.BEAN)
    You can use JTA UserTransaction to begin and end transactions, for example
    UserTransaction userTransation = null;
    Context context = null;
    try {
    context = new InitialContext();
    userTransation = (UserTransaction) context.lookup("java:comp/UserTransaction");
    } catch (NamingException e) {
    e.printStackTrace();
    entityManager = entityManagerFactory.createEntityManager();
    userTransation.begin();
    entityManager.find(Department.class, 10);
    userTransation.commit();

  • 11g preview version 3: JNDI Lookup problem when calling PL/SQL webservice

    Hi,
    I am experiencing a problem when calling a PL/SQL Webservice from a BPEL flow.
    When I am trying to test my BPEL flow from the SOA Console I get a "Error doing JNDI lookup on target jdbc/MyDBDS"
    The composite application including the BPEL flow is deployed in one application. "CompositeApp" and the web service in another Application called
    "WebServiceApp".
    Both applications are deployed on the same built in OC4J Application Server
    If I test the webservice in isolation from the SOA console it works. It also seems to be working if the webservice and the and the BPEL flow is in the same project.
    If anyone has any ideas on this one I would be very greatful.
    Thanks in advance

    try creating the MyDBDS connection as an application resource in both applications.

  • Ejb-ref and ejb-local-ref tags

    Hi everyone,
    Can someone please tell me
    1) Is it necessary for me to define ejb-ref or ejb-local-ref tags if I am referering one ejb from other ejb? I mean to say is it mandatory that I should have these deployment descriptor tags?
    2) What is purpose of ejb-link tag ?

    Hi everyone,
    Can someone please tell me
    1) Is it necessary for me to define ejb-ref or
    ejb-local-ref tags if I am referering one ejb from
    other ejb? I mean to say is it mandatory that I should
    have these deployment descriptor tags?Yes, to write portable J2EE components, every time you have a dependency on an ejb, you need to declare an ejb-ref (for a Remote EJB client) or ejb-local-ref (for a Local EJB client). This is true no matter what kind of J2EE component is accessing the ejb (Application Client, JSP, Servlet, or another ejb).
    Think of the ejb-ref or ejb-local-ref as a pointer. It's different from the thing that is pointed to. Instead, it represents a dependency between a client component and a target ejb.
    2) What is purpose of ejb-link tag ?Every ejb-ref or ejb-local-ref must be resolved to unambiguously point to the target ejb. The ejb-link tag is one way to resolve this dependency for the case where the target ejb lives in the same .ear as the referring component. The ejb-link tag is the ejb-name (or <ejb-jar uri>#<ejb-name>) of the target ejb.
    Note that this means ejb-link is the ONLY way to resolve an ejb-local-ref, since by definition Local EJB access can only take place between two ejbs within the same .ear or a web component/ejb that live within the same .ear.
    For ejb-refs, you can use ejb-link if the target ejb is within the same .ear. If not, the ejb specification does not prescribe how the dependency is resolved. It's left up to the J2EE implementation. The most common approach is for the vendor to provide a product-specific runtime .xml element that resolves the ejb-ref by associating it with the global JNDI name of the target EJB. That's the approach used in the J2EE SDK and Sun Java System Application Server.
    Kenneth Saks
    J2EE SDK Team
    SUN Microsystems

  • Jndi lookup problem

    unable to get data from database, but i created datasource
    pls send one example
    with clear steps

    did you add your datasource to the database adapters oc4j-ra.xml or the application servers data-sources.xml?
    The jndi lookup for the datasource is carried out against the application servers list of datasources, so you need to add the entry to C:\OraBPELPM_1\integration\orabpel\system\appserver\oc4j\j2ee\home\config\data-sources.xml

Maybe you are looking for