Bind remote object to JNDI tree

I want to create a JNDI tree in the same JVM with remote object, and then I have two problem:
1> Should I bind remote object or its stub to the JNDI tree?
2> How to look up the JNDI tree to get the binded stub from the client side? (Suppose server ip is 192.168.99.42)
I hope a gentleman would give me a piece of code, so i would be much clearer. Thanks a lot!

Hi,
Refer http://java.sun.com/products/jndi/tutorial/objects/storing/remote.html
-amol

Similar Messages

  • How to bind an object to JNDI tree in iAS?

    Hi all,
    When I try to bind a string object to jndi tree, the following exception
    occurs:
    javax.naming.NamingException: Unable to get object instance from reference.
    Roo
    t exception is javax.naming.NamingException: Can't bind instance of class
    java.lang.String
    at com.netscape.server.jndi.RootContext.bindCtx(Unknown Source)
    at com.netscape.server.jndi.RootContext.rebind(Unknown Source)
    at com.netscape.server.jndi.RootContext.rebind(Unknown Source)
    at javax.naming.InitialContext.rebind(InitialContext.java:385)
    at jsp.APPS.bmx.test2._jspService(test2.java:76)
    at jsp.APPS.bmx.test2.service(test2.java:42)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at
    com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    The code fragment is:
    Context ctx = new InitialContext();
    String str = "hell,every one!";
    ctx.rebind("abc", str);
    Can anyone give some help? Thanks in advance.
    Johnson

    To bind an object into the JNDI tree check the documentation here:
    http://e-docs.bea.com/wls/docs81/jndi/jndi.html#475702
    If this is to be used by all your applications that you deploy on the server check out the startup/shutdown class documentation here:
    http://edocs.bea.com/wls/docs81/ConsoleHelp/startup_shutdown.html
    Cheers
    IV

  • Unable to bind object in JNDI tree.

    While I try to bind a simple object in JNDI tree I get the following error.
    I have not used any cluster .
    Server : Web Logic 8.1 SP 6
    Jdk version 1.4.2 comes along with bea weblogic 8.1 sp 6
    Javax.naming.communicationException[
    Root exception is java.rmi.unmarshalException:
    Error unmarshalling arguments; nested exception is :
    Java.lang.ClassNotFoundException: com.examples.person : This error could indicate that a compound was deployed on a cluster member but not other members of that cluster. Make sure that any component deployed on a server that is part of a cluster is also deployed on a server that is part of a cluster is also deployed on all other member of that cluster.

    Is this somehow being called from the parameterless constructor?
    You sometimes have to wrap bits of code with in designer checks to stop em running.
    In c# that would be:
    if (!DesignerProperties.GetIsInDesignMode(this))
    // do your stuff only at runtime
    Please don't forget to upvote posts which you like and mark those which answer your question.
    My latest Technet article - Dynamic XAML

  • Javax.naming.NameAlreadyBoundException: Failed to bind remote object

    I am getting an error while deploying wli-ejbs.ear file. This ear uses oracle thin drivers to connect to database. But while deploying i am receiving an error as below. Can anyone please help me to solve this problem?
    Deployer:149033]preparing application wli-ejbs on managed2_cvf01
    [Deployer:149033]preparing application wli-ejbs on managed1_cvf01
    [Deployer:149033]prepared application wli-ejbs on managed1_cvf01
    [Deployer:149033]prepared application wli-ejbs on managed2_cvf01
    [Deployer:149033]activating application wli-ejbs on managed1_cvf01
    [Deployer:149033]activating application wli-ejbs on managed2_cvf01
    [Deployer:149034]An exception occurred for task [Deployer:149026]Deploy application wli-ejbs on cvf01_cluster.: weblogic.management.DeploymentException:
    Exception:weblogic.management.ApplicationException: activate failed for calendar/oracle
    Module: calendar/oracle Error: Exception activating module: EJBModule(calendar/oracle,status=PREPARED)
    Unable to deploy EJB: RemoteCalendarBean from calendar/oracle:
    [EJB:011008]Unable to bind EJB Home Interface to the JNDI name: RemoteCalendarBean.
    javax.naming.NameAlreadyBoundException: Failed to bind remote object (ClusterableRemoteRef(704752282736664516S:172.24.206.163:[7003,7003,7004,7004,7003,7004,-1,0,0]:172.24.206.163:7003,172.24.206.163:7003:cvf01:managed1_cvf01 null)/948 [com.bea.wli.calendar.api.BusinessCalendarHome+javax.ejb.EJBHome+weblogic.ejb20.interfaces.RemoteHome]) to replica aware stub at RemoteCalendarBean(ClusterableRemoteRef(704752282736664516S:172.24.206.163:[7003,7003,7004,7004,7003,7004,-1,0,0]:172.24.206.163:7003,172.24.206.163:7003:cvf01:managed1_cvf01 [704752282736664516S:172.24.206.163:[7003,7003,7004,7004,7003,7004,-1,0,0]:172.24.206.163:7003,172.24.206.163:7003:cvf01:managed1_cvf01/944, -8505871579836432025S:172.24.206.163:[7005,7005,7006,7006,7005,7006,-1,0,0]:172.24.206.163:7003,172.24.206.163:7003:cvf01:managed2_cvf01/1008])/944 [com.bea.wli.calendar.api.BusinessCalendarHome+javax.ejb.EJBHome+weblogic.ejb20.interfaces.RemoteHome]); remaining name ''
    at weblogic.rmi.cluster.ClusterableRemoteObject.onBind(ClusterableRemoteObject.java:177)
    at weblogic.jndi.internal.BasicNamingNode.bindHere(BasicNamingNode.java:347)
    at weblogic.jndi.internal.ServerNamingNode.bindHere(ServerNamingNode.java:124)
    at weblogic.jndi.internal.BasicNamingNode.bind(BasicNamingNode.java:291)
    at weblogic.jndi.internal.WLEventContextImpl.bind(WLEventContextImpl.java:279)
    at weblogic.jndi.internal.WLContextImpl.bind(WLContextImpl.java:386)
    at weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.activate(ClientDrivenBeanInfoImpl.java:1141)
    at weblogic.ejb20.deployer.EJBDeployer.activate(EJBDeployer.java:1385)
    at weblogic.ejb20.deployer.EJBModule.activate(EJBModule.java:631)
    at weblogic.j2ee.J2EEApplicationContainer.activateModule(J2EEApplicationContainer.java:3315)
    at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2194)
    at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2167)
    at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.activateContainer(SlaveDeployer.java:2503)
    at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(SlaveDeployer.java:2421)
    at weblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeployer.java:2138)
    at weblogic.management.deploy.slave.SlaveDeployer.commitUpdate(SlaveDeployer.java:676)
    at weblogic.drs.internal.SlaveCallbackHandler$2.execute(SlaveCallbackHandler.java:35)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)

    run the sync.bat file as mentioned in the instructions...
    or through EBCC(select sampleportal-project dir, app name "sampleportal")...
    good luck
    Vijay
    "ellen" <[email protected]> wrote:
    >
    I installed sampleportal and did all the changes according to the documents,
    when
    the server started, there is this error:
    Unable to deploy EJB: CatalogWebService from catalogwe.jar:
    Unable to bind EJB Home Interface to the JNDI name: sampleportal.BEA_commerce.CatalogWebService.
    The error was: javax.naming.nameAlreadyBoundException: Failed to bind remote
    object...to
    replica aware stub at CatalogWebService; remaining name'sampleportal.BEA_commerce'
    After the server started with the above error, I tried to run the app, here
    is what
    occured:
    PortalPersistenceManager: portal'sampleportal/sampleportal' not found.
    Has anybody seen this before?
    Ellen

  • Unable to register object in JNDI tree

    While I try to bind a simple object in JNDI tree I get the following error.
    I have not used any cluster .
    Server : Web Logic 8.1 SP 6
    Javax.naming.communicationException[
    Root exception is java.rmi.unmarshalException:
    Error unmarshalling arguments; nested exception is :
    Java.lang.ClassNotFoundException: com.examples.person : This error could indicate that a compound was deployed on a cluster member but not other members of that cluster. Make sure that any component deployed on a server that is part of a cluster is also deployed on a server that is part of a cluster is also deployed on all other member of that cluster.
    -------------------------------

    Is this somehow being called from the parameterless constructor?
    You sometimes have to wrap bits of code with in designer checks to stop em running.
    In c# that would be:
    if (!DesignerProperties.GetIsInDesignMode(this))
    // do your stuff only at runtime
    Please don't forget to upvote posts which you like and mark those which answer your question.
    My latest Technet article - Dynamic XAML

  • Bind a huge object to jndi tree in sun one 7

    Hi we are loading all the master tables in to objects at the app server startup (SUN ONE 7) and then binding the whole object to the jndi tree. All the tables data in text files comes to about 5 MB and the serilized object with data to about 8 MB. But when the app server tries to bind the object the app server process consumes over 500MB of ram and gives OutOfmemoryError as the total ram is 512MB. why is it consuming so much memory. It does bind an object of about 5 MB but when trying to lookup subsequent to the first lookup it fails. Is this a bug or what??? the same thing works perfectly with Weblogic and Websphere and also Weblogic is very efficient in memory consumption and response time is amazing. For a 5 MB object the lookup takes about 5Secs in Weblogic and about 15Mins in Sun One. We might have to drop the Sun One App Srv and go for Weblogic though we dont want. Kindly provide some guidance. Thanks in advance.

    Hi,
    Refer http://java.sun.com/products/jndi/tutorial/objects/storing/remote.html
    -amol

  • Bind RMI object to JNDI

    InitialContext ctx = new InitialContext ();
    ctx.rebind ("wwlhp", remoteObject);Does the JNDI tree and remoteObject reside in the same JVM?
    Can i use JNDI without J2EE platform?
    Can some one give me a piece of code illustrating rebinding in server side and looking up in client side.

    import javax.naming.*;
    import java.util.*;
    public class Server{
    public static void main(String[]args){
    try{
    Hashtable env=new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.rmi.registry.RegistryContextFactory");
    env.put(Context.PROVIDER_URL,"rmi://servername");
    Context ctx=new InitialContext(env);
    //create an instance of remote object
    RemoteIF i=new RemoteImpl();
    ctx.rebind("common name",ri);
    }catch(Exception ex){}
    The client needs to create a context as well, as above, the lookup
    RemoteIF ri=(RemoteIF)ctx.lookup("common name");
    The Stub classes must be available to the client as well
    start rmiregistry
    start the server
    off you go with the client

  • Call to a remote object in the same JVM

    Hi,
    I want to implement a logging mechanism in my system. I'm planning to
    write an rmi object and make it a start up class.
    I wud like to know whether the calls to this start up class made by the
    ejb instances and from the servlet engine in the same JVM, wud be rmi calls
    or wud they be simple method calls.
    Does weblogic detect the calls from the objects of the same jvm and
    optimise them, or wud they be rmi calls only.
    btw, i'm using weblogic 5.1
    thx,
    Manohar

    Try:
    initialNamingContext.rebind("single",
    weblogic.rmi.server.UnicastRemoteObjcet.exportObject(obj)
    "M. Manohar" wrote:
    Hi Eduardo,
    thx for ur reply.
    I wud like to know how to make this "binding a stub".
    wat i'm using is binding an object only.
    Instantiating an object which implements the remote interface and binding
    it to the JNDI tree by,
    initialNamingContext.rebind("single", obj);
    and ofcourse defining it as a start up class in the weblogic.properties
    file.
    Can u pls explain how to do "binding a stub"
    thx,
    Manohar
    Eduardo Ceballos wrote in message <[email protected]>...
    Presuming that the start up class binds itself into the jndi tree, then itonly depends on what you bind: binding a stub results in the RMI runtime
    overhead; binding the object itself, results in the simpler function call
    overhead.
    "M. Manohar" wrote:
    Hi,
    I want to implement a logging mechanism in my system. I'm planning to
    write an rmi object and make it a start up class.
    I wud like to know whether the calls to this start up class made by the
    ejb instances and from the servlet engine in the same JVM, wud be rmi
    calls
    or wud they be simple method calls.
    Does weblogic detect the calls from the objects of the same jvm and
    optimise them, or wud they be rmi calls only.
    btw, i'm using weblogic 5.1
    thx,
    Manohar

  • Jndi tree different in different servers in a cluster?

    I bind a Properties object in jndi tree and it comes up fine in one node
    i.e. I can see it in the jndi tree on one Server.
    But I cannot see it in another Server in the cluster. Any idea why this
    behaviour?
    the code looks like this:
    Hashtable h = new Hashtable();
    h.put(Context.INITIAL_CONTEXT_FACTORY, JNDITags.JNDI_FACTORY);
    h.put(WLContext.CREATE_INTERMEDIATE_CONTEXTS, new
    Boolean(true));
    if (user != null) {
    h.put(Context.SECURITY_PRINCIPAL, user);
    if (pwd == null)
    pwd = "";
    h.put(Context.SECURITY_CREDENTIALS, pwd);
    InitialContext ic = new InitialContext(h);
    Context ctx = ic.createSubcontext( "yy");
    ctx.bind( "lp", props );
    ctx.close();
    ic.close();
    Komal

    If you are trying to do the lookup "at startup time for server 2", the JNDI
    replication may not be complete yet. We had a similar problem trying to deploy
    MDBs against JMS destinations on remote servers...
    komal mangtani wrote:
    Can't a bind an object on 1 server and do a lookup on other server ?
    Like in my case, when 1st server starts, it binds the object to the jndi
    tree in its startup class.
    Then the second server comes up and does a lookup on the same object in its
    own startup class.
    Isn't the jndi tree, suppose to get replicated to another server?
    Komal.
    komal mangtani wrote:
    I bind a Properties object in jndi tree and it comes up fine in one node
    i.e. I can see it in the jndi tree on one Server.
    But I cannot see it in another Server in the cluster. Any idea why this
    behaviour?
    the code looks like this:
    Hashtable h = new Hashtable();
    h.put(Context.INITIAL_CONTEXT_FACTORY, JNDITags.JNDI_FACTORY);
    h.put(WLContext.CREATE_INTERMEDIATE_CONTEXTS, new
    Boolean(true));
    if (user != null) {
    h.put(Context.SECURITY_PRINCIPAL, user);
    if (pwd == null)
    pwd = "";
    h.put(Context.SECURITY_CREDENTIALS, pwd);
    InitialContext ic = new InitialContext(h);
    Context ctx = ic.createSubcontext( "yy");
    ctx.bind( "lp", props );
    ctx.close();
    ic.close();
    Komal

  • Can a single JNDI tree be shared by multiple, non-clustered servers?

    We have a situation involving multiple, but non-clustered, WebLogic servers,
    say Server 1 and Server 2. A client needs to access an EJB which happens to
    be located only on Server 2. We would prefer that the client not need to
    know the exact location of the EJB, but use the naming service hosted by a
    designated server (Server 1) to locate the EJB.
    At a minimum, this would require that both servers bind their respective
    EJB's into a common, shared JNDI naming tree hosted by Server 1.
    Is this possible?
    John Armstrong
    WebLink Wireless, Inc.
    [email protected]

    hi,
    I have not tried this, althoug with the webogic rmi and weblogic jndi
    implementation I would guess this is straightforward.
    Binding remote objects in WL JNDI binds the stubs only, not the object
    itself. The worst case scenario here would be for you to implement proxies
    and bind them in JNDI, although I would guess that binding the home object
    should give you the required functionality.
    Just try it, rebind the home object on a different server than the one the
    bean is deployed on and test. My guess is that it will work.
    (I repeat : I have not tested this my self, this is just a suggestion)
    Regards,
    Anders M.
    John N. Armstrong <[email protected]> skrev i
    meldingsnyheter:3a93faba$[email protected]..
    We have a situation involving multiple, but non-clustered, WebLogicservers,
    say Server 1 and Server 2. A client needs to access an EJB which happensto
    be located only on Server 2. We would prefer that the client not need to
    know the exact location of the EJB, but use the naming service hosted by a
    designated server (Server 1) to locate the EJB.
    At a minimum, this would require that both servers bind their respective
    EJB's into a common, shared JNDI naming tree hosted by Server 1.
    Is this possible?
    John Armstrong
    WebLink Wireless, Inc.
    [email protected]

  • ClassCastException at Remote object although remote interface is implemented

    Hi,
    I want to access a remote object via T3 (on WebLogic 10) but I am
    getting a ClassCastException in the client. The exception is thrown if
    the generic "Remote" object is casted into a concrete remote interface.
    The following works ok (client side, get remote object via JNDI):
    Hashtable hashTable = new Hashtable();
    hashTable.put(Context.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");
    hashTable.put(Context.PROVIDER_URL, "t3://localhost:7001);
    ic = new InitialContext(hashTable);
    Remote r = (Remote) ic.lookup("...jndi bind name...");
    But this cast fails:
    IMyRemoteIntf i = (IMintRemoteIntf) r;
    The ClassCastException has the classname of the class which implements
    the remote interface - the lookup should be ok therefore. With
    r.getClass().getInterfaces() I have verified that the remote object
    actually implements the appropriate interface. I suppose it is a class
    loader issue then and added some debug output.
    Class loader parent chain of IMyRemoteIntf:
    weblogic.utils.classloaders.ChangeAwareClassLoader@1715ee2
    -> weblogic.utils.classloaders.GenericClassLoader@123ade0
    -> weblogic.utils.classloaders.FilteringClassLoader@1312cf9
    -> weblogic.utils.classloaders.GenericClassLoader@159ea8e
    -> java.net.URLClassLoader@82d37
    -> sun.misc.Launcher$AppClassLoader@e39a3e
    -> sun.misc.Launcher$ExtClassLoader@a39137
    Class loader parent chain of IMyRemoteIntf as reported by r.getInterfaces():
    sun.misc.Launcher$AppClassLoader@e39a3e
    -> sun.misc.Launcher$ExtClassLoader@a39137
    IMyRemoteIntf is in a jar file in WEB-INF/lib of my web application. I
    tried prefer-web-inf-classes = true in weblogic.xml as well as
    prefer-application-packages in weblogic-application.xml (with the
    respective package of the interface).
    Any ideas? I don't know what more I can try. I can access the same
    server with this t3 URL just fine from outside of the WebLogic server.
    Regards
    Werner

    I meant an issue about multi-connections. Although the socket is shared by all of the connections, each connection in RMI might correspond to a separated thread, I guess. Since the socket is shared by all rmi clients, the RMI channel would be a blocking connection. I am not sure if the RMI in JDK1.4 or above also use the nonblocking new I/O technique. Thanks.

  • Binding RMI-IIOP Remote Object in RMI Registry through JNDI

    hi friends
    I am writing RMI-IIOP Remote Object, both server program, and client program
    are java programs. Through JNDI (with cosnaming name service), my program is working.
    But what i want is, I want to use JNDI (with rmi registry name service) for my RMI-IIOP Remote Object ( and not RMI -JRMP Remote Object). Both my server
    program and client programs are java(and not corba)
    I am not getting this, while starting server its showing some error
    Is it not possible to bind rmi-iiop remote object in rmi registry through jndi, why

    because you are supposed to use the COSNaming service with IIOP. Even if you could bind an IIOP remote object into an RMIRegistry the clients wouldn't be able to use it because the RMI Registry doesn't do the extra processing that the COSNaming service does with IIOP references.

  • Binding huge object to the jndi tree.

    Hi we are loading all the master tables in to objects at the app server startup (SUN ONE 7) and then binding the whole object to the jndi tree. All the tables data in text files comes to about 5 MB and the serilized object with data to about 8 MB. But when the app server tries to bind the object the app server process consumes over 500MB of ram and gives OutOfmemoryError as the total ram is 512MB. why is it consuming so much memory. It does bind an object of about 5 MB but when trying to lookup subsequent to the first lookup it fails. Is this a bug or what??? the same thing works perfectly with Weblogic and Websphere and also Weblogic is very efficient in memory consumption and response time is amazing. For a 5 MB object the lookup takes about 5Secs in Weblogic and about 15Mins in Sun One. We might have to drop the Sun One App Srv and go for Weblogic though we dont want. This same thing is working with about 4MB object in Sun One but takes about 45 Mins to 1 Hour to finish the serialization etc for jndi .Kindly provide some guidance.Thanks in advance.

    True. At the end I configured the value as a "server property". The cool thing about configuring the jndi tree is that it is replicated in a cluster.
    Obviously the values that I inserted affected all the applications, like the url of our SOA server.

  • Clustered Remote Object Bound To JNDI

    Hello,
              I'd like to know if Weblogic 5.1 (service pack 10) supports
              clusterable remote objects.
              What I am trying to do is to implement a remote object that extends
              UnicastRemoteObject interface and bind it to JNDI. When the client
              needs the services, it will lookup that object in JNDI and call its
              methods remotely.
              What happens to my test implementation is that it all works well when
              I run Weblogic locally, but if it is run on the remote server, it
              gives me the exception to the extend that the stub for my remote
              object is not found (although it is in the classpath). I understand
              that this is because I should be using weblogic.rmic instead of
              regular rmic, is that right?
              Thanks,
              Eugene Kononov.
              

    Hello,
              I'd like to know if Weblogic 5.1 (service pack 10) supports
              clusterable remote objects.
              What I am trying to do is to implement a remote object that extends
              UnicastRemoteObject interface and bind it to JNDI. When the client
              needs the services, it will lookup that object in JNDI and call its
              methods remotely.
              What happens to my test implementation is that it all works well when
              I run Weblogic locally, but if it is run on the remote server, it
              gives me the exception to the extend that the stub for my remote
              object is not found (although it is in the classpath). I understand
              that this is because I should be using weblogic.rmic instead of
              regular rmic, is that right?
              Thanks,
              Eugene Kononov.
              

  • Trouble in storing and retrieving RMI object in Weblogic 7 JNDI tree.

    I have created a simple server (BankImpl), implementing a RMI interface
    called Bank. A stub class (BankImpl_Stub.class) is generated from BankImpl
    class using
    "rmic -v1.2". Then I bind an instance of the BankImpl class to the JNDI tree
    in Weblogic
    server 7 under the name of "PeopleBank".
    After the binding, I can see the stub class in the JNDI tree, but with a
    different name: BankImpl_WLStub.class). when a
    client program is trying to lookup the stub associated with "PeopleBank", it
    failed with a puzzling message:
    java.io.NotSerializableException: BankImpl_WLStub
    Why a stub of a RMI object is not serializable? Does Weblogic needs a
    different rmic to generate RMI stubs?
    Thanks,
    Lian

    I have created a simple server (BankImpl), implementing a RMI interface
    called Bank. A stub class (BankImpl_Stub.class) is generated from BankImpl
    class using
    "rmic -v1.2". Then I bind an instance of the BankImpl class to the JNDI tree
    in Weblogic
    server 7 under the name of "PeopleBank".
    After the binding, I can see the stub class in the JNDI tree, but with a
    different name: BankImpl_WLStub.class). when a
    client program is trying to lookup the stub associated with "PeopleBank", it
    failed with a puzzling message:
    java.io.NotSerializableException: BankImpl_WLStub
    Why a stub of a RMI object is not serializable? Does Weblogic needs a
    different rmic to generate RMI stubs?
    Thanks,
    Lian

Maybe you are looking for