JNDI Lookup for JMS Topic issue.......!

Hi,
          Our application is deployed on two nodes (MS1 and MS2 in a cluster) and I created JMSServer on MS1, JMS ConnectionFactory and Distributed Topic are targeted on both MS1 and MS2 i.e on entire cluster.
          We have the JMS Code in postStart() method of starup class which extends ApplicationLifecycleListener which would create the JMS Subcriber and set the message listener on to it.
          code snippet:
               System.out.println("createSubscriber called");
               subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
               // Lookup for the Topic
               Topic cadTopic = (Topic) ctx.lookup("JMSTopicLog4j");
               System.out.println("Topic is: " + cadTopic.getTopicName());
               // Create JMS Subscriber.
               cadSubscriber = subSession.createSubscriber(cadTopic);
               // Set the listener to Subscriber.
               cadSubscriber.setMessageListener(new CADMessageListener());
               topicConnection.start();
          When I start the cluster (managed Servers MS1 and MS2) for the first time and deploy the application on them (entire cluster) it works well i.e. message listener is active and able to receive messages published by publisher but when I try to stop and start MS2 it gives the following exception during server startup
          javax.naming.NameNotFoundException: Unable to resolve 'JMSTopicLog4j'. Resolved ''
          javax.naming.NameNotFoundException: Unable to resolve 'JMSTopicLog4j'. Resolved ''; remaining name 'JMSTopicLog4j'
          at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1123)
          at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:250)
          at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:171)
          at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:204)
          at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:267)
          at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:362)
          Note: I thought my application context is getting started before JNDI tree is loaded but I could see that it is able to lookup the ConnectionFactory and throws the given exception when it comes to lookup code of JMS Topic.
          is there any configuration issue or am I missing something? Please help me in this regard.
          Thanks in advance.
          Kris.

Very interesting, I mean in the sense that we have the same setup, but instead of topic we are using the queues.
          And our problem is exactly the same,deployment works but after restart same javax.naming.NameNotFoundException happens on server 2.

Similar Messages

  • Error while passing ODI variable in JNDI Url for JMS Queue XML

    Hi,
    Facing a weird problem while passing ODI variable in JNDI Url for JMS Queue XML.
    Below is the JNDI Url configured under ODI Topology:
    JNDI Url: t3://<host_location>?d=#TEST.SCHEMA_FILE&s=<schema_name>&JMS_DESTINATION=jms/<queue_name>
    where,
    #TEST.SCHEMA_FILE --> ODI variable storing xsd name and location
    Issue Description:
    If we restart ODI server then for the first run of any ODI interface using JMS Queue XML, it is unable to get the value for ODI variable present in JNDI Url (d=#TEST.SCHEMA_FILE).
    It throws error message saying: No XSD found
    Temporary Resolution:
    As a temporary fix if we hard-code and pass the value in that ODI variable as shown below, it will successfully go through.
    eg: JNDI Url: t3://<host_location>?d=C:\XSD\test.xsd&s=<schema_name>&JMS_DESTINATION=jms/<queue_name>
    Reverting it back to variable later will have no issues and subsequent run will succeed.
    But again anytime later if server is restarted then first run will have this issue.
    Want to have permanent fix for it.
    Any one having idea on it please share. Appreciate your help!

    What ODI version are you using? It could be related to the bug in the older version as described in support note Doc ID 1290326.1

  • Problem in Jndi lookup for  ITaskService

    HI,
    I am trying to initiate oracle bpm Human task programatically by using Java remotely.
    for this I am using following JNDI lookup for ITaskService.
    Hashtable ht = new
                  Hashtable<IWorkflowServiceClientConstants.CONNECTION_PROPERTY,java.lang.String>();
              ht.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_INITIAL_CONTEXT_FACTORY, 
                     "weblogic.jndi.WLInitialContextFactory");
              ht.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_PROVIDER_URL, "t3://localhost:7001");
              ht.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_SECURITY_PRINCIPAL, "username"); 
              ht.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_SECURITY_CREDENTIALS, "password");
              Context ctx  = new InitialContext(ht);
    ITaskService taskService = (ITaskQueryService)ctx.lookup("ejb/bpel/services/workflow/TaskServiceBean");
    taskService.initiateTask(task);
    It the right approach or not.
    Please help.

    To access human workflow api remotely try using the following code :
    Map properties = new HashMap();
      properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_PROVIDER_URL, "t3://localhost:8001");
      properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_SECURITY_CREDENTIALS, "welcome1");
      properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_SECURITY_PRINCIPAL, "weblogic");
    IWorkflowServiceClient wfSvcClient =
      WorkflowServiceClientFactory.getWorkflowServiceClient(WorkflowServiceClientFactory.REMOTE_CLIENT, properties, null);
      //Get the task query service
      ITaskQueryService querySvc = wfSvcClient.getTaskQueryService();
      //Login as weblogic
      IWorkflowContext ctx = querySvc.authenticate("weblogic","welcome1".toCharArray(),null);
    after getting the workflow context, you can call any method like query task list. perform actions etc. just see the api doc.
    Regards,
    Anshul

  • Support for JMS Topic in SAP PI 7.11

    Hi,
    As per SAP Note 856346, JMS Topics are not supported in SAP PI (Question 2.1). However the Note is valid for SAP PI 7.1 and there is no mention for SAP PI 7.11
    So can anybody please confirm if SAP PI7.11 supports JMS Topics?
    Thanks,
    Pankaj.

    Hi,
    There seems to be a lot of confusion between what is documented and what is available in actual. I did a search in help.sap.com for JMS Topic and got some information under PI7.11
    http://help.sap.com/saphelp_nwpi711/helpdata/en/46/31558a9f1214dfe10000000a155369/frameset.htm
    I hope that someone from SAP confirms the actual working. I dont want to raise an OSS for this
    Thanks,
    Pankaj.

  • JNDI lookup for UserTransaction

              Hi all,
              in Weblogic, in a typical scenario, do a client provide exactly
              one JNDI lookup for the UserTransaction object (interface) or do
              the client have to provide a JNDI lookup for each transaction?
              In some EJB implementations, a JNDI lookup for UserTransaction
              returns always the same reference. For example, in JOnAS, you can
              have one static reference which is set when the client starts.
              Then, more threads can simultaneously use the same static
              UserTransaction reference without any conflict, since the
              implementation of UserTransaction recognizes, which thread invoked
              a particular method.
              In other words, can I make an assumption that two different JNDI
              lookups for UserTransaction returns different references or not?
              Thanks a lot,
              Marek Prochazka
              Distributed Systems Research Group
              Department of Software Engineering
              Charles University, Faculty of Mathematics and Physics
              Malostranske namesti 25, 118 00 Prague 1, Czech Republic
              phone: +420-2-2191 4236
              http://nenya.ms.mff.cuni.cz/thegroup/
              

    Actually, UserTransaction is a singleton and it's not a transaction. It's just
              very mis-named.
              It should be called UserTransactionManager or UserInterfaceToJTA.
              The actual transaction is javax.transaction.Transaction.
              -- Rob
              Cameron Purdy wrote:
              > Within a transaction, it is different instances? For example, if you call
              > it two times one right after another?
              >
              > A transaction is a unit of work. I understand why the transaction object
              > changes from transaction to transaction, since a single transaction object
              > (UserTransaction) represents exactly one transaction. Why would it be a
              > singleton? It is not a transaction manager.
              >
              > Peace,
              >
              > --
              > Cameron Purdy
              > Tangosol, Inc.
              > http://www.tangosol.com
              > +1.617.623.5782
              > WebLogic Consulting Available
              >
              > "Sarita" <[email protected]> wrote in message
              > news:[email protected]...
              > >
              > > Hi Priscilla--
              > >
              > > This is not the behavior that I'm seeing, and I'm perplexed.
              > > Every time I request a UserTransaction from JNDI, I receive a
              > > a different instance. Should the value immediately returned by JNDI be
              > the singleton
              > > instance? If not, then how do I retrieve the singleton instance?
              > >
              > > I would like a session bean to start a transaction, and then call a method
              > on another
              > > session bean (which should operate under the same transaction). How does
              > the second
              > > session bean grab the correct transaction object? Is that possible?
              > >
              > > Thanks In Advance,
              > > Sarita
              > >
              > > "Priscilla Fung" <[email protected]> wrote:
              > > >
              > > >Hi Marek,
              > > >
              > > >In Weblogic 6.0, JNDI lookup of UserTransaction returns a reference to
              > the
              > > >singleton
              > > >Transaction Manager instance, which is thread-safe and can be used from
              > > >multiple
              > > >threads for transaction demarcations etc.
              > > >
              > > >-- Priscilla Fung, BEA Systems, Inc.
              > > >
              > > >"Marek Prochazka" <[email protected]> wrote:
              > > >>
              > > >>Hi all,
              > > >>
              > > >>in Weblogic, in a typical scenario, do a client provide exactly
              > > >>one JNDI lookup for the UserTransaction object (interface) or do
              > > >>the client have to provide a JNDI lookup for each transaction?
              > > >>
              > > >>In some EJB implementations, a JNDI lookup for UserTransaction
              > > >>returns always the same reference. For example, in JOnAS, you can
              > > >>have one static reference which is set when the client starts.
              > > >>Then, more threads can simultaneously use the same static
              > > >>UserTransaction reference without any conflict, since the
              > > >>implementation of UserTransaction recognizes, which thread invoked
              > > >>a particular method.
              > > >>
              > > >>In other words, can I make an assumption that two different JNDI
              > > >>lookups for UserTransaction returns different references or not?
              > > >>
              > > >>Thanks a lot,
              > > >>Marek Prochazka
              > > >>--------------------------------------------------------------
              > > >> Distributed Systems Research Group
              > > >> Department of Software Engineering
              > > >> Charles University, Faculty of Mathematics and Physics
              > > >> Malostranske namesti 25, 118 00 Prague 1, Czech Republic
              > > >> phone: +420-2-2191 4236
              > > >> http://nenya.ms.mff.cuni.cz/thegroup/
              > > >>--------------------------------------------------------------
              > > >>
              > > >
              > >
              

  • JNDI lookup for weblogic.management.MBeanHome

    Tried to do JNDI lookup for MBeanHome. It could resolve
    weblogic.management, but not MBeanHome.
    Any idea? Thank you
    T. Pei
    PS
    The statement and the error message:
    MBeanHome mBeanHome = (MBeanHome) initialContext.lookup
    ("weblogic.management.MBeanHome.JNDI_NAME.MyServer");
    javax.naming.NameNotFoundException:
    Unable to resolve weblogic.management.MBeanHome.JNDI_NAME.MyServer
    Resolved: 'weblogic.management'
    Unresolved:'MBeanHome' ; remaining name 'JNDI_NAME.MyServer'

    I answered this in my last post, but to clarify your attempt below.
    you can access MBeanHome through JNDI in any of three ways that I
    currently know...
    MBeanHome mBeanHome =
    (MBeanHome)ctx.lookup("weblogic.management.adminhome");
    MBeanHome mBeanHome =
    (MBeanHome)ctx.lookup(MBeanHome.ADMIN_JNDI_NAME);
    MBeanHome mBeanHome =
    (MBeanHome)ctx.lookup(MBeanHome.JNDI_NAME+"."+yourservername);
    typically yourservername = "myserver"
    when I print MBeanHome.ADMIN_JNDI_NAME I get
    "weblogic.management.adminhome"
    when I print MBeanHome.JNDI_NAME I get
    "weblogic.management.home"
    so using MBeanHome.JNDI_NAME+"."+yourservername is the same as
    "weblogic.management.home.myserver", if the server you are trying to access
    is called myserver.
    may be more information than you want.
    "T. Pei" <[email protected]> wrote in message
    news:3a7a1562$[email protected]..
    >
    Tried to do JNDI lookup for MBeanHome. It could resolve
    weblogic.management, but not MBeanHome.
    Any idea? Thank you
    T. Pei
    PS
    The statement and the error message:
    MBeanHome mBeanHome = (MBeanHome) initialContext.lookup
    ("weblogic.management.MBeanHome.JNDI_NAME.MyServer");
    javax.naming.NameNotFoundException:
    Unable to resolve weblogic.management.MBeanHome.JNDI_NAME.MyServer
    Resolved: 'weblogic.management'
    Unresolved:'MBeanHome' ; remaining name 'JNDI_NAME.MyServer'

  • JNDI lookup for Crystal Reports at runtime

    How to run a rpt to fetch data from database connection defined in Tomcat's JNDI resources ? We are using JDBC(JNDI) Data source while designing the report in the Crystal Report designer and we want to use 'Connection Name' at runtime for jndi lookup to Tomcats JNDI resources.

    Hi,
    Thanks, this helped in resolving the JNDI lookup problem. But we are not having an issue in connecting to DS as it fails with error "Unsupported JNDI Object".
    Tried suggestions on this link: "http://www.theserverside.com/discussions/thread.tss?thread_id=37430", but no luck.
    Here are the configuration files:
    context.xml:
    <Context>
    <Resource name="jdbc/remedy" auth="Container" type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@10.76.85.68:1521:dtv" maxActive="20" maxIdle="10" maxWait="-1" />
    </Context>
    web.xml:
    <resource-ref>
              <description>DB Connection</description>
              <res-ref-name>jdbc/remedy</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <res-auth>Container</res-auth>
    </resource-ref>
    Log:
    2009-10-30 06:38:05,804 DEBUG [com.crystaldecisions.reports.formatter.a.c] - Export Supervisor: number of destination exporters:1
    2009-10-30 06:38:05,804 DEBUG [com.crystaldecisions.reports.formatter.a.c] - Export Supervisor: number of format exporters:4
    2009-10-30 06:38:05,865 INFO [com.businessobjects.reports.sdk.JRCCommunicationAdapter] - JRCAgent1 received request: fetchReportPageRequest
    2009-10-30 06:38:05,865 INFO [com.businessobjects.reports.sdk.JRCCommunicationAdapter] - JRCAgent1 attempting to acquire license
    2009-10-30 06:38:05,865 INFO [com.businessobjects.reports.sdk.JRCCommunicationAdapter] - JRCAgent1 successfully acquired license
    2009-10-30 06:38:05,867 DEBUG [com.businessobjects.reports.sdk.JRCCommunicationAdapter] - Requesting page 1
    2009-10-30 06:38:05,879 INFO [com.crystaldecisions.reports.queryengine.driverImpl] - Logon: Connecting to database using local JNDI server ...
    2009-10-30 06:38:05,888 DEBUG [com.crystaldecisions.reports.reportdefinition.datainterface] - Failed to open connection (Connection:  databaseType=JDBC (JNDI)  serverName=jdbc:oracle:thin:@10.76.85.68:1521:dtv  state=closed  databaseDriverName=crdb_jdbc.dll).
    com.crystaldecisions.reports.queryengine.al: Unsupported JNDI Object (remedy)
         at com.crystaldecisions.reports.queryengine.driverImpl.o.if(Unknown Source)
         at com.crystaldecisions.reports.queryengine.av.new(Unknown Source)
         at com.crystaldecisions.reports.queryengine.av.byte(Unknown Source)
         at com.crystaldecisions.reports.reportdefinition.datainterface.b.a(Unknown Source)
         at com.crystaldecisions.reports.reportdefinition.datainterface.b.a(Unknown Source)
         at com.crystaldecisions.reports.reportdefinition.datainterface.b.a(Unknown Source)
         at com.crystaldecisions.reports.reportdefinition.datainterface.b.if(Unknown Source)
         at com.crystaldecisions.reports.reportdefinition.datainterface.j.a(Unknown Source)
         at com.businessobjects.reports.sdk.b.i.if(Unknown Source)
         at com.businessobjects.reports.sdk.b.i.a(Unknown Source)
         at com.businessobjects.reports.sdk.b.i.byte(Unknown Source)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
         at com.crystaldecisions.proxy.remoteagent.y.a(Unknown Source)
         at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.cf.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.ReportSource.getPage(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.AdvancedReportSource.getPage(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.NonDCPAdvancedReportSource.getPage(Unknown Source)
         at com.crystaldecisions.report.web.event.ac.a(Unknown Source)
         at com.crystaldecisions.report.web.event.ac.a(Unknown Source)
         at com.crystaldecisions.report.web.event.b2.a(Unknown Source)
         at com.crystaldecisions.report.web.event.b7.broadcast(Unknown Source)
         at com.crystaldecisions.report.web.event.av.a(Unknown Source)
         at com.crystaldecisions.report.web.WorkflowController.do(Unknown Source)
    Edited by: MuralidharS on Oct 30, 2009 8:46 AM

  • Manual JNDI lookup for EJB3 between different Application Server Instances

    Hi all,
    i have spent quite some time looking into this problem and searching the net but i just can't figure out for the life of me what i am doing wrong so i hope someone here can give me a clue or a good resource where i can look it up myself.
    I am currently doing some interoperability tests concerning EJB calls between Glassfish and Weblogic 10. In my test setup i have an EJB deployed in a jar file on one server and a servlet in a war file deployed on the other. The objective is to try to look up and call the EJB from the servlet. As there seem to be some issues with injection in Weblogic 10 i set that one aside for now (i have opened a case at BEA support for this) but i would like to do a plain old JNDI lookup to obtain the EJB.
    The online tutorials and FAQs i have read so far all state that this can be done the same way as it works for EJB2.x, at least if i understood them correctly. The interessting thing is, when i deploy an EJB2.x bean i can look it up without problems, but when i try to do the same with the EJB3 bean the name cannot be found. On the other hand when listing all contents of the JNDI tree in Glassfish from a stand alone application i can see entries for both EJBs of the type java.naming.Reference (in Weblogic i can also see entries for both, but the ones for EJB3 are of some weird internal weblogic types, which i put down as a weblogic problem for now).
    The lookup code for the servlet running in weblogic looks like this:
    Properties env = new Properties();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    env.put(Context.PROVIDER_URL, "corbaname:iiop:1.2@localhost:3700");
    Object myEjb = new InitialContext(env).lookup("JNDINameDisplayedByContextListing");
    I know that the preferred way would be to have the corbaname put into weblogic.xml/sun-web.xml and just use an InitialContext without an environment to perform the lookup but i wanted to get rid of any additional indirections to pinpoint the source my problem and it should work this way, too. As i said, it works when i target an EJB2.x bean but not with the EJB3 one, so i guess i am doing something wrong there. The jar file contains the interface of the bean annotated with @Remote and the implementation of the interface annotated with @Stateless, i also tried setting the mappedName attribute for the bean and use that name as JNDI name, but that also fails. In addition i added an ejb-jar.xml to the jars META-INF containing the following:
    <?xml version="1.0" encoding="UTF-8"?>
    <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
         version="3.0">
         <enterprise-beans>
              <session>
                   <ejb-name>SecurityTest3EJB</ejb-name>
                   <ejb-class>
                        testcase.ejb.SecurityTestBean
                   </ejb-class>
                   <session-type>Stateless</session-type>
                   <transaction-type>Container</transaction-type>
    </session>
    </enterprise-beans>
    But the ejb-name specified there does not show up in a context listing, so i would guess that means the file is ignored or only accessible from within the same application server (note, there is no indication of any problems in the Glassfish log when deploying the jar file).
    This might be just a stupid mistake by me, but i just can't figure it out at the moment, so any advice will be greatly appriciated.
    Thanks, Chris

    I think i stumbled across something now. From some posts it seems to me that the EJB3 spec does not require EJBs to be accessible from a remote location, since this can be achieved by using the @RemoteHome annotation and performing a EJB2.x compliant look up. Is that correct?

  • Problems with JNDI lookup for java:comp/env/ejb

    Hi all,
    I'm using OC4J 9.0.3 and I have problems when looking up for the local
    EJB context.
    I have a SLSB which refers to another SLSB via a JNDI mapping like
    shown below. Both services are deployed within one EAR file.
    (snippets of ejb-jar.xml and orion-ejb-jar.xml)
    <ejb-jar>
    <enterprise-beans>
    <session>
    <ejb-name>ServiceABean</ejb-name>
    <home>com.coi.ServiceAHome</home>
    <remote>com.coi.ServiceA</remote>
    <ejb-class>com.coi.ServiceABean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    <ejb-ref>
    <ejb-ref-name>ejb/some/sub/packages/ServiceB</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>com.coi.ServiceBHome</home>
    <remote>com.coi.ServiceB</remote>
    </ejb-ref>
    </session>
    </enterprise-beans>
    </ejb-jar>
    <orion-ejb-jar>
    <enterprise-beans>
    <session-deployment location="global/some/sub/packages/ServiceA" name="ServiceABean">
    <ejb-ref-mapping name="ejb/some/sub/packages/ServiceB" location="global/some/sub/packages/ServiceB" />
    </session-deployment>
    </enterprise-beans>
    </orion-ejb-jar>
    The ApplicationInitialContextFactory will be used (prepared by the container),
    so the lookup for ServiceB within a method of ServiceA should work as follows:
    public class ServiceABean implements SessionBean
    public void someMethod()
    InitialContext con = new InitialContext(); // will be of class ApplicationContext
    Context localEjbContext = (Context)con.lookup( "java:comp/env/ejb" );
    ServiceBHome serviceBHome = (ServiceBHome) PortableRemoteObject.narrow(
    localEjbContext.lookup( "some/sub/packages/ServiceB" ),
    ServiceBHome.class );
    The problem is now, that the lookup for "java:comp/env/ejb" doesn't work
    and throws a NameNotFoundException.
    To figure out what's actually happening during lookup I debugged a little bit and
    tried a few things:
    1. A lookup for "java:comp" works fine. It returns an instance of class FlatMapContext
    which consists of a hash map which itself contains an entry for "env".
    2. So a lookup for "env" on that FlatMapContext also works and returns an instance of SubContext.
    3. A lookup for "ejb" using this SubContext causes a NameNotFoundException
    with message "java:comp/env/ejb not found".
    4. A lookup like con.lookup( "java:comp/env" ) throws also a NameNotFoundException
    with message "java:comp/env not found (not inside a J2EE module, for instance a Web-App,
    EJB, or Application-Client)".
    Does anyone know something about this?
    Regards
    --thomas

    Hi Debu,
    Great! 9.0.4 will be released in june/july this year, right? Sorry for my ironical reaction, but does that mean, that I don't have any chance to get my whole stuff running in 9.0.3? I cannot believe that. Isn't there a wordaround I could apply? A setting or whatever to substitute the daft FlatCtx by something else that is implemented according to the spec?
    Regards
    --thomas

  • JAVA client JNDI lookup for EJB session in cluster in WLS 5.1

    The documentation says :
              to obtain a Context for JNDI lookup do the following :
              Hashtable ht = new Hashtable();
              ht.put(Context.INITIAL_CONTEXT_FACTORY,
              "weblogic.jndi.WLInitialContextFactory");
              ht.put(Context.PROVIDER_URL, "t3://mycluster:7001");
              try {
              Context ctx = new InitialContext(ht);
              // Do the client's work
              catch (NamingException ne) {
              // A failure occurred
              finally {
              try {ctx.close();}
              catch (Exception e) {
              // a failure occurred
              where "mycluster" is the DNS name of my cluster. My DNS server (Windows 200
              DNS server) use round robin
              to call alernatively all the wls server node in "mycluster" and it's OK. The
              two servers of my cluster
              are called alternatively for my EJB session stateless.
              Now I unplug one of the two nodes of my cluster and the remaining server is
              called only 2 times
              and not after.
              Questions :
              -is the load balancing between the nodes of mycluster only rely on DNS or
              is there an internal
              mecanism in EJB sub to try one server then an other ?
              - do I need to obtain a new reference on JNDI Context for each call ?
              Thank's a lot.
              Farid Bellameche.
              

              I too have the same problem. My scenario is :
              I have the web tier architecture away from cluster. All ejbs are in cluster
              running in two seperate machines. We have a factory class running in
              webtier(we use servlet in this tier) which obtains home interface only once
              and stores it for future reference. When ever we need the remoteobject stub,
              we ask the factory class and which in turn uses the stored home interface to
              get the same.
              In the webtier, I list all the servers in the cluster as a part of url as
              mentioned by you.
              I started the web tier as well as Object tier cluster. I could see the
              request coming in both the machines in the cluster for the ejb. But When I
              bring one the server in the cluster,
              1. Web tier throws an exception saying that it could not connect
              to server using t3.
              2. The other machine which is running the server, also says
              'failed to create socket to : -32323234324 sever name
              using protocol t3.
              It looks like I am able to get load balance. But I am not able to get the
              fail over to be working.
              In the weblogic-ejb-jar.xml, I added the following.
              <clustering-descriptor>
              <home-is-clusterable>true</home-is-clusterable>
              <home-load-algorithm>round-robin</home-load-algorithm>
              </clustering-descriptor>
              I compiled and added the .jar file. So the jar file now has replica aware
              stubs.
              Could any one of you help me for why the fail over is not working?
              Suersh
              "Giri Alwar" <[email protected]> wrote in message
              news:[email protected]...
              > Farid,
              > (1) Yes, the stub has the logic to perform load-balancing and
              fail-over.
              > (2) In almost all cases, no. You can get the context once, store it
              and
              > use it thereafter. Please refer to
              > http://www.weblogic.com/docs51/cluster/concepts.html#1025061 for more
              info.
              >
              > A couple of notes on your situation. From what you are describing, your
              > Windows DNS server is setup to serve only one IP from the cluster (using
              > round-robin) as opposed to a list of all IP's in the cluster. Hence, the
              > initial context you obtain is tied to a single server in the cluster (the
              > one returned by the DNS). The weblogic implementation on the client side
              has
              > no idea of the existence of the other servers in the cluster. This is not
              a
              > cluster aware context. To obtain a cluster aware context, either list all
              > the IP's in the URL like t3://server1,server2,server3:7001 or have
              > "mycluster" return a list of all servers in the cluster.
              >
              > Giri
              >
              >
              > "Farid Bellameche" <[email protected]> wrote in message
              > news:[email protected]...
              > > The documentation says :
              > >
              > > to obtain a Context for JNDI lookup do the following :
              > > Hashtable ht = new Hashtable();
              > > ht.put(Context.INITIAL_CONTEXT_FACTORY,
              > > "weblogic.jndi.WLInitialContextFactory");
              > > ht.put(Context.PROVIDER_URL, "t3://mycluster:7001");
              > > try {
              > > Context ctx = new InitialContext(ht);
              > > // Do the client's work
              > > }
              > > catch (NamingException ne) {
              > > // A failure occurred
              > > }
              > > finally {
              > > try {ctx.close();}
              > > catch (Exception e) {
              > > // a failure occurred
              > > }
              > > }
              > >
              > > where "mycluster" is the DNS name of my cluster. My DNS server (Windows
              > 200
              > > DNS server) use round robin
              > > to call alernatively all the wls server node in "mycluster" and it's OK.
              > The
              > > two servers of my cluster
              > > are called alternatively for my EJB session stateless.
              > > Now I unplug one of the two nodes of my cluster and the remaining server
              > is
              > > called only 2 times
              > > and not after.
              > >
              > > Questions :
              > > -is the load balancing between the nodes of mycluster only rely on DNS
              > or
              > > is there an internal
              > > mecanism in EJB sub to try one server then an other ?
              > >
              > > - do I need to obtain a new reference on JNDI Context for each call ?
              > >
              > >
              > > Thank's a lot.
              > >
              > > Farid Bellameche.
              > >
              > >
              > >
              > >
              >
              >
              

  • JNDI Lookup for EJB3 (Bean to Bean)

    Hi Forum,
    i've search the whole internet and two books but I could not find an answer that pleased me.
    I want to get a reference to an EJB3 by JNDI Lookup. With container managed dependency injection everything works fine but I have to do a little more generic way, thats why I want to work with JNDI Lookup.
    I have the following situation:
    At first I have a stateless bean
    @Local
    public interface Job {
         * run the job
         * @return true if the job executed without errors
        public boolean run(SchedulerConfig schedulerConfig ,JobContext context);
    @Local
    public interface AConcreteJobLocal extends Job {   
    //no more declarations
    @Stateless
    @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
    public class AConcreteJobBean implements AConcreteJobLocal {
    //implemented methods goes here | removed for better overview in the post
    } This is a typical declaration for a bunch of jobs I have. Every concrete job has it's own bean if it necessary in some way for you to know.
    So now I wanted to write a bean which returns me an bean instance via a JNDI lookup
    @Stateless
    public class JobJNDILookupBean implements JobJNDILookupLocal {
        Logger logger = Logger.getLogger(JobJNDILookupBean.class.getName());
        public Job getJobBeanFromJNDIName(String jndiName) {
            Job job = null;
            try {
                Context c = new InitialContext();
                job = (Job) c.lookup("jndiName");
            } catch (NamingException ex) {
                Logger.getLogger(JobJNDILookupBean.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IllegalArgumentException ex) {
                logger.log(Level.SEVERE, "Bean not found", ex);
            return job;
    }When I call this method I always get a NameNotFoundException
    javax.naming.NameNotFoundException: JNDI_NAME_GOES_HERE not found
            at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
            at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
            at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
            at com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:111)
            at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
            at javax.naming.InitialContext.lookup(InitialContext.java:351)
            at com.vw.ais.dcl.timer.engine.JobJNDILookup.getJobBeanFromJNDIName(JobJNDILookup.java:46)
            at com.vw.ais.dcl.timer.engine.EngineBean.init(EngineBean.java:221)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1067)
            at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176)
            at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2895)
            at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3986)
            at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:197)
            at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:83)
            at $Proxy713.init(Unknown Source)
            at com.vw.ais.dcl.timer.SchedulerBean.runEngine(SchedulerBean.java:192)
            at com.vw.ais.dcl.timer.SchedulerBean.handleIncomingByTimer(SchedulerBean.java:171)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1067)
            at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176)
            at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2895)
            at com.sun.ejb.containers.BaseContainer.callEJBTimeout(BaseContainer.java:2824)
            at com.sun.ejb.containers.EJBTimerService.deliverTimeout(EJBTimerService.java:1401)
            at com.sun.ejb.containers.EJBTimerService.access$100(EJBTimerService.java:99)
            at com.sun.ejb.containers.EJBTimerService$TaskExpiredWork.run(EJBTimerService.java:1952)
            at com.sun.ejb.containers.EJBTimerService$TaskExpiredWork.service(EJBTimerService.java:1948)
            at com.sun.ejb.containers.util.WorkAdapter.doWork(WorkAdapter.java:75)
            at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)I've tried I guess all combinations for the JNDI_NAME
    java:/comp/env/ejb/AConcreteJob
    java:/comp/env/ejb/AConcreteJobLocal
    java:/comp/env/ejb/AConcreteJobBean
    java:/comp/env/AConcreteJob
    java:/comp/env/full.package.and.Class.name
    this all without java:/comp/env
    etc.
    The only way it worked was when I added a annotation to the JobJNDILookupBean in this way
    @Stateless
    *@EJB(name="ejb/AConcreteJob",beanInterface=A.Interface.location)*
    public class JobJNDILookupBean implements JobJNDILookupLocal {
    }But this is not what I want to do. Thats why my question. How can I lookup a bean without annotate it in the bean which want to look it up???
    In other words whats wrong here
    @Stateless
    public class JobJNDILookupBean implements JobJNDILookupLocal {
        Logger logger = Logger.getLogger(JobJNDILookupBean.class.getName());
        public Job getJobBeanFromJNDIName(String someJndiName) {
            Job job = null;
            try {
                Context c = new InitialContext();
                job = (Job) c.lookup("someJndiName");
            } catch (NamingException ex) {
                Logger.getLogger(JobJNDILookupBean.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IllegalArgumentException ex) {
                logger.log(Level.SEVERE, "Bean not found", ex);
            return job;
    }I hope you understand my question and more than this I hope some has the answer.

    Hi Zsom,
    Zsom wrote:
    One thing you need to keep in mind is that beans aren't instantiated every time you make a call to your EJB. You're right! But because the fact the beans are all stateless it doesn't matter. I don't want to get a new EJB at a lookup. If I get a reference to a bean which was used a million times before it is absolutely ok
    Zsom wrote:
    You might be gaining some time because the container can create new beans more quickly, but you are also looking up the beans before each call, which in the long run will be even more expensive.Mhm, I don't know if I understand you. Maybe I explain my process a little bit. I have a lot of different jobs in my application (JobDoThis, JobDoThat, JobFoo, JobBar). Every job has a own bean which keeps the business logic. Furthermore I have an job engine which is able to execute jobs which are configured to run and this engine can solve some dependencies (If JobFoo fails don't execute JobBar , and so on). When I build my engine I want to get a reference to a jobBean by jndi lookup which keeps the business logic and then call some method on it. This means that the lookup will only be called when I build a new engine. And because this doesn't happen so often performance is not so important. Furthermore if all jobs all configured to run the application needs sometimes more than 12 hours (depended from the amount of data) for one run (Start to End -> the application has a little script character), that's why performance as I said already is not so important.
    Zsom wrote:
    But it would be worth making some test, because to me it seems a bit like bad design.Yes it could be, but this was my first thought to instantiate a bean (or get a reference to an existing one) dynamically. I don't like this hard coded dependency injection. I mean it's great If you know at compiletime which beans you need. But because we don't know which beans we need it's a big overhead to inject them all by container and then use only 40 percent of the injected bean because for example only 40 of 100 jobs shall run.
    If there is another approach to get a reference dynamically which is better than this then I will try, no problem, but unfortunally I don't see another.

  • Doing a jndi lookup() for an EJB deployed on Glassfish v3

    Hello.
    I have deployed a Stateful Sesion EJB on a Glassfish v3 AppServer.
    It is running under 'localhost' on my laptop pc.
    I am also running a stand-alone java application on the same pc... it attempts to get a remote connection from the client-app to the Glassfish Server and then do a jndi lookup() to get a reference to my EJB.
    here is the client source code:
    public class LookupTest {
    static Properties props = null;
    public static void main(String[] args) {
    try {
    props = new Properties();
    props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
         props.put(Context.PROVIDER_URL, "iiop://localhost:3700");
         Context ctx = new InitialContext(props);
         System.out.println( "the context is: " + ctx);
         System.out.println( "the environment contains: " + ctx.getEnvironment() );
         System.out.println( " ");
         // do a lookup.
         Object elementObj = ctx.lookup("SerialContextProvider");
         System.out.println(elementObj);
    } catch (NamingException e) {
    e.printStackTrace();
    When I run this app, there are no Errors or Exceptions. It appears that the connection succeeds. But there are no EJB references in the context that is created. The only item that seems to be present in the context is an item named "SerialContextProvider", as noted in the return value from a list("") method invocation. Why can i not see the EJB within the context? Is my code wrong ??
    Thanks,
    Andy Jerpe
    Edited by: user1169567 on Nov 28, 2010 12:12 PM

    Ok, but the communication seems to be OK over the wire because if I use netstat -a I can see the ESTABLISHED connection with the server in the right RMI port.
    TCP PORTAL35:1581 caapiranga:12405 ESTABLISHED
    and then when I stop the instance in the OAS, the client shows an exception telling that the connection was lost.
    An curious thing is that the ons.log doesn't log this connection ;/

  • How to write the jndi lookup for ejb using oc4j server in jdeveloper

    Hi All,
    i am new to the JDeveloper. i want to develop the session bean in JDeveloper using the OC4J server. how to write the jndi lookup in cllient. what are the xml files need to deploy the application. where can i mention the JNDI name in xml file. so please provide the information as soon as possible.
    regards
    ram

    There is quite in-depth information in the Enterprise JavaBeans Developer's Guide.
    Section 2 (Understanding EJB Application Development) explains the xml files needed and Section 29 (Accessing an EJB from a Client) explains how to do a JNDI lookup.
    Hope this helps.

  • Getting jndi name for jms queue via jmx?

    All,
    I'm trying to write a utility that will do a 9.2-style message export against 8.1 I think I have it all figured out except that I don't know how to get the jndi name of a queue or topic via jmx. I'm using jmx to find queues and subscriptions that have messages waiting, then trying to connect to them to siphon off the messages. I can't just browse jndi for any queue I find because I also want to access the durable subscriptions, for which I need the client and subscriptions ids. Is there a way to map from the jms destination runtime mbean to the jndi name? The getDestination() method isn't supported (throws an exception.)
    thanks

    Hi John,
    You can get destination JNDI names by looking up their value in the JMX configuration mbeans rather than the runtime mbeans. The client-id and subscription-name are available on the JMSDurableSubscriberRuntime mbean.
    Regards,
    Tom

  • JNDI lookup() for a Resource Adapter fails

    Hi guys,
    I've deployed a Resource Adapter on Weblogic (v10.3.4). It's JNDI name is: jca/HelloAdapter
    Moreover, in the Outbound Connection Pools tag, I've created a javax.resource.cci.ConnectionFactory entry with JNDI name: eis/HelloAdapter.
    I want to write a simple Java test to lookup my Resource adapter. The code I am using is the following:
          Hashtable<String, String> properties = new Hashtable<String, String>();
          properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
          properties.put(Context.PROVIDER_URL, "t3://localhost:8001");
          properties.put(Context.SECURITY_PRINCIPAL, "weblogic");
          properties.put(Context.SECURITY_CREDENTIALS, "weblogic1");
          Context ctx = null;
          try {
              ctx = new InitialContext(properties);
              javax.resource.cci.ConnectionFactory cf =
                (javax.resource.cci.ConnectionFactory) ctx.lookup("jca/HelloAdapter");
          } catch (NamingException e) {
              e.printStackTrace();
          }I get the following exception:
    javax.naming.NameNotFoundException: No Object found:  jca/HelloAdapter|null
         at weblogic.connector.deploy.JNDIHandler.lookupObject(JNDIHandler.java:881)
         at weblogic.connector.deploy.JNDIHandler.getObjectInstance(JNDIHandler.java:843)
         at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
         at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:424)
         at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:411)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)Any ideas please ? Thank you for your time
    Regards,
    George

    Sorry guys,
    I suppose my thread subject is out of the scope of the specific list.
    Sorry for the inconvenience

Maybe you are looking for