Exception: Cannot narrow remote object to ...

Hi,
          in certain circumstances I get an Exception "Cannot narrow remote
          object to <some EJB-Home-Class>".
          My enviroment: weblogic 7.0, solaris, Java 1.3.1, J2EE-application
          (EJBs, Servlets, Database)
          In the init method of an start-up servlet I spawn some threads for a
          scheduler of the application. There are a scheduler core and some
          worker classes.
          The start-up servlet, all the other servlets and the schedulers
          classes are in an web-archive (war-file) in an ear-archiv. Furthermore
          there a some 3rd party archives in the ear-archive, a jndi.properties
          file etc. The manifest file of the war-archive contains a class-path,
          points to the 3rd party archives in the ear-archive.
          The schedulers workers code is simple:
          InitialContext jndiContext = ...getInitialContext();
          Object obj = jndiContext.lookup(<some EJB>);
          - EJBs home interface (for example):
          SyncOrderQueueHome home = (SyncOrderQueueHome)
          javax.rmi.PortableRemoteObject.narrow(obj,
          SyncOrderQueueHome.class);
          - EJBs remote interface:SyncOrderQueue sync = home.create();
          - call some business method
          sync.createOrderQueue();
          In the enviroment described above I get an " Exception: Cannot narrow
          remote object to <package>.SyncOrderQueueHome".
          On the other hand the scheduler and all the workers work fine as a
          standalone application (not in an app-server context) and in Oracles
          app-server (OC4J, v.9.0.3).
          I tried to understand, what for an object I get as the result of the
          JNDI lookup bevore the narrow method fails:
          - in the app-servers context:
          <package>.SyncOrderQueueEJB_4o6qkf_HomeImpl
          - outside the app-server:
          <package>.SyncOrderQueueEJB_4o6qkf_HomeImpl_WLStub
          What happened here? The common servlets use the same functionality and
          work fine. Why I get different objects? Where is the bug?
          Any ideas?
          Thomas
          

I believe the problem is the threads you are starting are not using the
          context classloader of the current thread.
          -- Rob
          [email protected] wrote:
          > Hi,
          >
          > in certain circumstances I get an Exception "Cannot narrow remote
          > object to <some EJB-Home-Class>".
          >
          > My enviroment: weblogic 7.0, solaris, Java 1.3.1, J2EE-application
          > (EJBs, Servlets, Database)
          >
          > In the init method of an start-up servlet I spawn some threads for a
          > scheduler of the application. There are a scheduler core and some
          > worker classes.
          > The start-up servlet, all the other servlets and the schedulers
          > classes are in an web-archive (war-file) in an ear-archiv. Furthermore
          > there a some 3rd party archives in the ear-archive, a jndi.properties
          > file etc. The manifest file of the war-archive contains a class-path,
          > points to the 3rd party archives in the ear-archive.
          >
          > The schedulers workers code is simple:
          >
          > InitialContext jndiContext = ...getInitialContext();
          > Object obj = jndiContext.lookup(<some EJB>);
          >
          > - EJBs home interface (for example):
          > SyncOrderQueueHome home = (SyncOrderQueueHome)
          > javax.rmi.PortableRemoteObject.narrow(obj,
          > SyncOrderQueueHome.class);
          >
          > - EJBs remote interface:SyncOrderQueue sync = home.create();
          >
          > - call some business method
          > sync.createOrderQueue();
          > In the enviroment described above I get an " Exception: Cannot narrow
          > remote object to <package>.SyncOrderQueueHome".
          >
          > On the other hand the scheduler and all the workers work fine as a
          > standalone application (not in an app-server context) and in Oracles
          > app-server (OC4J, v.9.0.3).
          >
          > I tried to understand, what for an object I get as the result of the
          > JNDI lookup bevore the narrow method fails:
          > - in the app-servers context:
          > <package>.SyncOrderQueueEJB_4o6qkf_HomeImpl
          > - outside the app-server:
          > <package>.SyncOrderQueueEJB_4o6qkf_HomeImpl_WLStub
          >
          > What happened here? The common servlets use the same functionality and
          > work fine. Why I get different objects? Where is the bug?
          >
          > Any ideas?
          > Thomas
          

Similar Messages

  • Java.lang.ClassCastException: Cannot narrow remote object weblogic.rmi.inte

    Hi,
    I am trying to deploy ejb3.0 on weblogic 10 server. I am able to find the JNDI name of the stateless session bean correctly, but getting an exception while narrowing it down. My ejb3.0 client is a standalone java client. I am trying to access the stateless session ejb3.0 bean.Please help me. i have been trying it for many days.
    thanks in advance,
    Sanjeev
    [sanpraka@localhost certEjb]$ java -cp ./:/usr/weblogic/bea/wlserver_10.0/server/lib/weblogic.jar:/usr/weblogic/bea/wlserver_10.0/server/lib/wlclient.jar com.titan.clients.Client
    Object is weblogic.rmi.internal.BasicRemoteRef - hostID: '5337880647112897730S:127.0.0.1:[7001,7001,-1,-1,-1,-1,-1]:wl_server:examplesServer', oid: '302', channel: 'null'
    java.lang.ClassCastException: Cannot narrow remote object weblogic.rmi.internal.BasicRemoteRef - hostID: '5337880647112897730S:127.0.0.1:[7001,7001,-1,-1,-1,-1,-1]:wl_server:examplesServer', oid: '302', channel: 'null' to com.titan.travelagent.TravelAgentRemote
    at weblogic.corba.server.naming.ReferenceHelperImpl.narrow(ReferenceHelperImpl.java:206)
    at weblogic.rmi.extensions.PortableRemoteObject.narrow(PortableRemoteObject.java:88)
    at weblogic.iiop.PortableRemoteObjectDelegateImpl.narrow(PortableRemoteObjectDelegateImpl.java:32)
    at javax.rmi.PortableRemoteObject.narrow(Unknown Source)
    at com.titan.clients.Client.main(Client.java:24)
    [sanpraka@localhost certEjb]$

    We have a similar problem. We have a web application (on server A) that invokes an EJB on a remote server (server B). This works fine, until we deploy another web application to server A at which point the existing web application starts to throw java.lang.ClassCastException when narrowing the remote EJB interface. The exception starts to be thrown at the moment the latter web application is deployed - start is not required.
    The latter web application contains (actually in APP-INF/lib) the old version of the EJB remote interface, that somehow gets to be loaded into the classpath of the existing web application. The solution is to delete the old version of the EJB remote interface from APP-INF/lib of the latter web application (we didn't need it anyway), but it would be interesting to know in which circumstances classes can get mixed between enterprise applications.
    I failed to reproduce the error in simple scenario, so this does not happen always.

  • Cannot narrow remote object error?

    Hello,
    <br><br>
    My application is composed of 2 different package A and B. All deployed in the same server.<br>
    - A implements EJBA<br>
    - B implements EJBB<br>
    EJBA is registred in the JNDI tree as ejb.a<br><br>
    When EJBB runs these line of code :<br>
    Object obj = context.lookup("ejb.a");<br>
    System.out.println("ref:" + obj); // ref : com.coface.util.ejb.tools_<b>cvb9yr</b>_HomeImpl@a64642<br>
    AHome home = (AHome) PortableRemoteObject.narrow(obj, AHome.class);<br>
    Narrow raises :<br>
    java.lang.ClassCastException: Cannot narrow remote object to AHome
    at weblogic.iiop.PortableRemoteObjectDelegateImpl.narrow(PortableRemoteObjectDelegateImpl.java:242)
    at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
    <br><br><br>
    I have no idea what can be wrong and how I can debug this kind of exception.<br>
    I just noticed this odd "cvb9yr" in the looked up instance class. Thought I am not sure how this name is generated.<br>
    Anyone could help me to track down the cause of this exception?<br><br>
    Thanks<br>
    <br>
    Alexandre
    Message was edited by:
    acuenca

    alexandre cuenca <> writes:
    Do you have A's client jar in B's package? You might need this unless
    they are in the same ear. Otherwise it looks like a classloding bug.
    andy
    Hello,
    <br><br>
    My application is composed of 2 different package A and B. All deployed in the same server.<br>
    - A implements EJBA<br>
    - B implements EJBB<br>
    EJBA is registred in the JNDI tree as ejb.a<br><br>
    When EJBB runs these line of code :<br>
    Object obj = context.lookup("ejb.a");<br>
    System.out.println("ref:" + obj); // ref : com.coface.util.ejb.tools_<b>cvb9yr</b>_HomeImpl@a64642<br>
    AHome home = (AHome) PortableRemoteObject.narrow(obj, AHome.class);<br>
    Narrow raises :<br>
    java.lang.ClassCastException: Cannot narrow remote object to AHome
    at weblogic.iiop.PortableRemoteObjectDelegateImpl.narrow(PortableRemoteObjectDelegateImpl.java:242)
    at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
    <br><br><br>
    I have no idea what can be wrong and how I can debug this kind of exception.<br>
    I just noticed this odd "cvb9yr" in the looked up instance class. Thought I am not sure how this name is generated.<br>
    Anyone could help me to track down the cause of this exception?<br><br>
    Thanks<br>
    <br>
    Alexandre
    Message was edited by:
    acuenca--

  • Class Cast Exception in Portable Remote Object

    Hai guys,
    I am new to jsp.I have made a simple j2ee application in which i am getting class cast exception in PortableRemoteObject.narrow function.
    The exception is:
    org.apache.jasper.JasperException
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:297)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:247)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:585)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
    java.security.AccessController.doPrivileged(Native Method)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
    The root cause is :
    java.lang.ClassCastException
         com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
    javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
    org.apache.jsp.registration_jsp._jspService(registration_jsp.java:59)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:105)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:336)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:297)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:247)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:585)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
    java.security.AccessController.doPrivileged(Native Method)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
    The code of the file is :
    <%@ page language="java" import="java.sql.*,pkg.*,javax.ejb.*,javax.naming.*,javax.rmi.PortableRemoteObject,java.rmi.RemoteException" %>
    <html>
    <head>
    <title></title>
    </head>
    <body bgcolor="CCCCFF">
    <h1><center>Welcome to MyBank</center></h1>
    <%
    InitialContext initial = new InitialContext();
    Object objref = initial.lookup("bankDSN");
    pkg.mybankHome vi = (pkg.mybankHome)PortableRemoteObject.narrow(objref,pkg.mybankHome.class);
    %>
    </body>
    </html>
    I have many threads but i was not able to solve this problem.
    It has been 2 to 3 weeks that i am struck in this error.
    Plz help me with this.
    Thanks in advance.
    Edited by: vishal29 on Jul 13, 2008 10:04 PM

    Hai DigitalDreamer,
    Thanks for giving your valuable time to my question.
    I have tried the code you gave me.
    The answer for :
    out.println(objref.getClass().getName());
    that i got is :
    javax.naming.Reference
    And the answer for :
    out.println(objref.getClass().getInterfaces());
    that i got is :
    [Ljava.lang.Class;@213b6e
    Could you please tell me how this can help.
    Actually i am new to jsp.
    Thanks in advance                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Cannot narrow object??

    Hi,
    I previously had the following fragment of code inside a servlet (which worked fine):
    Context ctx = new InitialContext();
    BeanEJB beanEJB = null;
    BeanEJBHome beanHome = null;
    Object obj = ctx.lookup("ejb/BeanEJB");
    beanHome = (BeanEJBHome ) PortableRemoteObject.narrow(obj, BeanEJBHome.class);However, I moved the above code to the run() method of a new thread I created and now the PortableRemoteObject.narrow() call throws a ClassCastException.
    Can anyone help?
    Thank you!

    alexandre cuenca <> writes:
    Do you have A's client jar in B's package? You might need this unless
    they are in the same ear. Otherwise it looks like a classloding bug.
    andy
    Hello,
    <br><br>
    My application is composed of 2 different package A and B. All deployed in the same server.<br>
    - A implements EJBA<br>
    - B implements EJBB<br>
    EJBA is registred in the JNDI tree as ejb.a<br><br>
    When EJBB runs these line of code :<br>
    Object obj = context.lookup("ejb.a");<br>
    System.out.println("ref:" + obj); // ref : com.coface.util.ejb.tools_<b>cvb9yr</b>_HomeImpl@a64642<br>
    AHome home = (AHome) PortableRemoteObject.narrow(obj, AHome.class);<br>
    Narrow raises :<br>
    java.lang.ClassCastException: Cannot narrow remote object to AHome
    at weblogic.iiop.PortableRemoteObjectDelegateImpl.narrow(PortableRemoteObjectDelegateImpl.java:242)
    at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
    <br><br><br>
    I have no idea what can be wrong and how I can debug this kind of exception.<br>
    I just noticed this odd "cvb9yr" in the looked up instance class. Thought I am not sure how this name is generated.<br>
    Anyone could help me to track down the cause of this exception?<br><br>
    Thanks<br>
    <br>
    Alexandre
    Message was edited by:
    acuenca--

  • Interrupting a Thread in a Remote Object?

    HI,
    I am trying to get some thread synchronization to happen between a client and a remote RMI object. Essentially what I am trying to accomplish, is that if I interrupt a call on a blocking method in the remote object, I want the thread to throw the InterruptException. For example, the following code represents what I am trying to accomplish:
    package bca.test.rmi;
    import java.rmi.Naming;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    import java.rmi.server.UnicastRemoteObject;
    public class InterruptThreadApp {
    RemoteBlockingObjectInt remote = null;
    public static void main(String[] args) throws Exception {
    //Create the remote object
    RemoteBlockingObject obj = new RemoteBlockingObject();
    //bind it to the registry
    Naming.rebind("rmi://localhost/blocking", obj);
    //start the client, or the thread which will access the blocking call remotely
    InterruptThreadApp app = new InterruptThreadApp();
    Thread blocking = null;
    //wait for the thread to start
    synchronized ( app ) {
    blocking = app.startClient();
    app.wait();
    Thread.sleep(2000);
    //now interrupt the thread (note: the remote object should be blocking in
    //the blockingMethod().. this should produce an InterruptException?
    blocking.interrupt();
    public Thread startClient() {
    Thread t = new Thread("Client") {
    public void run() {
    try {
    //get a handle to the stub
    remote = (RemoteBlockingObjectInt) Naming.lookup("rmi://localhost/blocking");
    //now make a call to the blocking method, but first wake up the client
    synchronized ( InterruptThreadApp.this ) {
    InterruptThreadApp.this.notify();
    //now make the blocking call
    remote.blockingMethod();
    catch (InterruptedException e) {
    System.out.println("WooHoo! This is what we want! But it never gets thrown :(");
    catch (Exception e) {
    e.printStackTrace();
    t.start();
    return t;
    package bca.test.rmi;
    import java.rmi.server.UnicastRemoteObject;
    import java.rmi.RemoteException;
    import java.rmi.Remote;
    public class RemoteBlockingObject extends UnicastRemoteObject implements RemoteBlockingObjectInt {
    Object obj = new Object();
    public RemoteBlockingObject() throws RemoteException {
    super();
    public void blockingMethod() throws RemoteException, InterruptedException {
    synchronized (obj) {
    System.out.println("About to block.. so we can be interrupted later");
    obj.wait();
    interface RemoteBlockingObjectInt extends Remote {
    public void blockingMethod() throws RemoteException, InterruptedException;
    When I make a call to "remote.blockingMethod()", it blocks in the remote object (buy just "wait" ing). I want to interrupt this thread, by issuing an Thread.interrupt(). When I do so (I call "blocking.interrupt()"), nothing happens... no exception is thrown.. it just silently fails.
    Ok, so I suppose that we can not interrupt a remote thread.. that is fine. But what if I want to interrupt the RMI thread making the remote call? I don't want it to block forever. How can I "cancel" the remote call?
    Ideally, I would like the remote.blockingMethod() call to throw an InterruptException when I issue an "interrupt()" on the blocking thread. Any suggestions on how I might accomplish this?
    Thanks,
    Bryan

    While you can interrupt the RMI call, you cannot stop the active processing. That is, you cannot force a thread to stop (see the Java API documentation on Thread.stop().)
    Since the Client RMI call is a waiting thread, you need another Client thread to do a secondary RMI call. The trick is to have the new RMI endpoint connection thread on the RMI Server interrupt the original RMI endpoint connection thread.
    The only way you can interrupt an RMI call is to have the endpoint connection thread that runs on the RMI Server be aware that the user may wish to interrupt it.
    The best means of interruption is for the endpoint connection thread to use "worker threads". The endpoint connection thread waits for the workers to finish and is interruptible by both the workers and other endpoint connection threads.
    Another means of interruption is for the endpoint connection thread to segment the task into units of work and check for an interruption between those units of work.
    There are two ways I've done RMI call interruption.
    One is for the Client to pass a unique id (UID -- that uniquely identifies the request) to the Server with the original call. When the Client wishes to interrupt the original call, using the separate thread, it does a new RMI call to the Server passing the UID.
    The new endpoint connection thread, using the UID, interrupts the original endpoint connection thread.
    The major problem with this is the unique id. It absolutely, positively must be unique. Otherwise you run the risk of Client_A purging Client_B's request.
    The second method requires callback. If your Client is behind a firewall then RMI callback is near impossible. In such a case you must come up with a way for the Server to call the Client that is secure (the firewall problem.)
    The Client must export a remote object and pass that remote object to the Server with the original call.
    The endpoint connection thread recognizes the remote object and does a call back to the Client passing information that uniquely identifies itself (UID). Since the Server generates the UID, it can guarantee uniqueness.
    The Client callback implementation runs as a separate thread since the Client is in fact an RMI Server itself (when it did the export.) The Client must save the UID. The Client must start a new thread for the interrupt procedure or inform a waiting thread that the Server called back.
    Just like method one, above, when the Client wishes to interrupt the original call, using the separate thread, it does a new RMI call to the Server passing the UID.
    The new endpoint connection thread, using the UID, interrupts the original endpoint connection thread. Simple.
    For an academic example using call back go over to Jini.org. They have an example called "Cancellation" at:
    http://starterkit-examples.jini.org/
    For a professional, open source implementation of both these methods go over to CoopSoft.com. The Tymeac (Java) projects support canceling both waiting and autonomous requests at:
    http://www.coopsoft.com/JavaProduct.html

  • Logical model cannot refer to 'remote objects'?

    Hi
    Using DM 3.3.0.747.
    In the relational model one can drag and drop in a table from another relational model from a separate design.  This shows that table as a linked table and can be refreshed via the 'Synchronize Remote Objects' and allows that table to be referenced from your 'local' tables (i.e. used in foreign keys).
    I tried the same, but for a logical model entity.  This does not work/is not allowed?  What is the expected behaviour?
    We would like to use this for logical models as well.  (So that we may develop/document the logical models separate, but use common/shared entities in the same way possible in relational models.  This will help us a lot in keeping the models smaller and easier to manage and version control.)
    Thank you & Regards

    Hi Ed,
    I presume you had some relationships in the Logical Model that you were expecting to be engineered to Foreign Key relationships in the Relational Model.
    Please can you provide more detail to help resolve your problem. For example:
    Was the problem on an initial engineer from the logical model? Or on a re-engineer?
    Are you using Entity subtyping in your Logical Model?
    Are there any relevant error messages in the log file? (This is normally file datamodeler.log in folder datamodeler\datamodeler\log.)
    David

  • Exception:cannot refresh not managed object

    Hello,
    Under which circumstances does this exception occur? The object I am refreshing is supposed to be managed, but for some reason it is not? When do objects stop being managed and why?

    This exception wll occur if the refresh is being called on an umanaged object. Ensure that:
    - Your object is managed within the EM.
    - you are not calling clear() before the refresh
    - if you are in JEE ensure the object was found in the same transaction, (in a managed EntityManager each transaction is a in new persistence context).
    - You are not changing the object's primary key
    Peter

  • Exporting two remote objects on the same port

    Hi,
    I would like to export two remote objects on the same host, same port and bind them with different service names.
    There is no problem when I do that from the same Java program.
    But when I export and bind an object from a Java program 1, I cannot do the same with the second (and similar) Java program 2. This is the stack trace of my Exception:
    java.rmi.server.ExportException: Port already in use: 50040; nested exception is:
         java.net.BindException: Address already in use: JVM_Bind
         at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:243)
         at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:178)
         at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:382)
         at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:116)
         at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:145)
         at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:129)
         at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:275)
         at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:178)
         at java.rmi.server.UnicastRemoteObject.<init>(UnicastRemoteObject.java:75)Can some one help please

    It should work in any version of Java as long as the server socket factories are null or equal according to Object.equals() or its override in the SSF.equals() method if any. Which needs to be present and needs to take the form:
    public boolean equals(Object object)
      return object != null && object.getClass() == this.getClass();
    }with further tests if the server socket factories have additional state.

  • Accessing remote object after unbind

    I'm working on a server, multi-client application where I want the client to throw an exception whenever the client cannot reach the server. I thought the cases where this may occur were the following:
    -- The RMI registry is no longer running on the server machine.
    -- The server object is no longer present (has become null)
    -- The server object has been removed from the RMI registry through Naming.unbind().
    The final case has caused me the most fits during testing. I've noticed that if a client has a remote reference to the server object, the client can still make method calls on it even if the server object no longer exists within the RMI registry.
    One fix would be to have the client obtain a remote reference to the server object before any remote method call; receiving a NotBoundException if the server object has been removed from the registry.
    Yet is there another way that a client can notice if the server object no longer exists within RMI registry?
    Thanks.

    -- The RMI registry is no longer running on the
    server machine.
    -- The server object is no longer present (has become
    null)This can't happen. Naming.lookup() never return null, they throw NotBoundException instead (even if someone at the server deliberately binds null).
    -- The server object has been removed from the RMI
    registry through Naming.unbind().There is at least one more more case you need to consider:
    -- the remote object has been unexported but left in the Registry (or the client still has a reference from before): this will cause a NoSuchObjectException.
    The final case has caused me the most fits during
    testing. I've noticed that if a client has a remote
    reference to the server object, the client can still
    make method calls on it even if the server object no
    longer exists within the RMI registry.I'm not clear about your objective here. This can certainly happen but if you're just trying to enumerate the possible exceptions this isn't even an exception.

  • Remote object trying to return another remote object and a ClassCastExcepti

    I have a server running with a TreeModel (the tree model implements Remote). I also have the the TreeNodes all linked together on the server. Now, I can get to the TreeModel on the server and the root node of the remote tree model.
    treeModelStub = (treeModelIface)Naming.lookup(url+"remoteTM"); //works
    rootStub = (remoteTreeNodeIface)treeModelStub.getRoot(); //works. The call to getRoot returns Object
    But when I call
    remoteTreeNodeIface aChild = (remoteTreeNodeIface)rootStub.getChildAt(index) //Does not work. "Exception in thread "main" java.lang.ClassCastException
    at remoteTreeNode_Stub.getChildAt(Unknown Source)
    The remote tree node method getChildAt returns TreeNode because the class implements TreeNode:
    public class remoteTreeNode extends UnicastRemoteObject implements rdcaDataIface, Comparable, TreeNode {
    public TreeNode getChildAt(int idx) {
    System.out.println("DEBUG: class is "+this.getClass()); // class is remoteTreeNode
    return (remoteTreeNode)children.get(idx);
    The remote interface is defined as:
    public interface rdcaDataIface extends java.rmi.Remote {
    public TreeNode getChildAt(int idx) throws RemoteException;
    Any ideas why this does not work. Why can a remote object of type Object be returned just fine, but a TreeNode not be returned?
    Thank you for your help,
    Brent

    I have a server running with a TreeModel (the tree
    model implements Remote). I also have the the
    TreeNodes all linked together on the server. Now, I
    can get to the TreeModel on the server and the root
    node of the remote tree model.
    treeModelStub =
    (treeModelIface)Naming.lookup(url+"remoteTM");
    //works
    rootStub =
    (remoteTreeNodeIface)treeModelStub.getRoot();
    //works. The call to getRoot returns Object
    But when I call
    remoteTreeNodeIface aChild =
    (remoteTreeNodeIface)rootStub.getChildAt(index)******************************************
    can only be casted to rdcaDataIface. The returned object is an instanceof the rdcaDataIface_stub, which have nothing to do with TreeNode.
    //Does not work. "Exception in thread "main"
    java.lang.ClassCastException
    at remoteTreeNode_Stub.getChildAt(Unknown
    t(Unknown Source)
    The remote tree node method getChildAt returns
    TreeNode because the class implements TreeNode:
    public class remoteTreeNode extends
    UnicastRemoteObject implements rdcaDataIface,
    Comparable, TreeNode {
    public TreeNode getChildAt(int idx) {
    System.out.println("DEBUG: class is
    lass is "+this.getClass()); // class is
    remoteTreeNode
    return (remoteTreeNode)children.get(idx);
    The remote interface is defined as:
    public interface rdcaDataIface extends java.rmi.Remote
    public TreeNode getChildAt(int idx) throws
    ows RemoteException;
    Any ideas why this does not work. Why can a remote
    object of type Object be returned just fine, but a
    TreeNode not be returned?
    Thank you for your help,
    Brent

  • Two remote objects calls on the same php class

    Hi to all,
           I've encountered a strange issue while developing with remote objects.
    I've a mxml component with an init() method inside which is called by a menu.
    When the init() method is called it makes 7 remote object calls which are bound to some components' dataprovider.
    Among this calls I've got 2 remote object which refer to the same remote class. This because I have to call the class twice and the bind the result to two different combobox. Below you find the code:
    <mx:RemoteObject id="myFile" source="myRemoteClass" destination="amfphp"  showBusyCursor="true" makeObjectsBindable="true" fault="traceFault(event)"/>
    <mx:RemoteObject id="myXls"  source="myRemoteClass" destination="amfphp"  showBusyCursor="true" makeObjectsBindable="true" fault="traceFault(event)"/>
    in the init function I make this calls:
    myFile.listDir("dir_1")
    myXls.listDir("dir_2")
    then in the mxml code I bound the result of myFile to combobox1 and the result of myXls on combobox2.
    The problem arise when I call the myXls' listDir method. When I call it I receive the following error:
    code:
    Client.Error.DeliveryInDoubt
    Message:
    Channel disconnected
    Detail:
    Channel disconnected before an acknowledgement was received
    The strange thing is that not only the myXls object returns this error, but also all the other 6 remote object return the same error above.
    I'm not sure, but I guess that the error could be caused by the two remote object which call the same php remote class. If I comment one of the two calls everything works fine.
    Do you have any suggestion about?
    Thanks!!
    Bye
    Luke

    Hi Jan.
    1) We have the 2 VO, each with 3 rows to fill in data. What I mean is that when i just fill in all the fields for the first row of the first VO, and the value of one of these fields is bigger than 50, then after the exception is thrown and the message is displayed, the fields for the first VO are duplicated and shown in the second VO as if the user had inserted them.
    2) We tried yesterday the validateEntity and a Method and Atributte Validator approaches after reading that white paper with the same results.
    The validation is correctly done using any of the those methods.
    I will try to reproduce this issue with the HR schema.
    Thanks in advance once again.

  • Cannot use Remote Desktop host on Windows 8.1 Pro, termsrv corrupted?

    Hello,
    Few days ago I upgraded my home desktop machine from Windows 8.1 to Windows 8.1 Professional so I can use the Remote Desktop feature.
    I enabled everything needed, checked "Allow computers to connect to this computer" from the Remote Settings, forwarded the port 3389 in my rounter and allowed it in my firewall etc...
    But I still can't connect to this computer from outside my home network or inside it. The error I get trying to connect is this:
    (For some reason i still can't post images in this forum...) So I posted a link below to my original thread with the images
    I'm trying to connect using a laptop running Windows 7 Home Premium.
    After searching around I found out that the service responsible for the RDP is called "TermService", I found it on my services but was unable to start it:
    (For some reason i still can't post images in this forum...) So I posted a link below to my original thread with the images
    Also, notice the description of the service. So I tried to run a System File Checker on the service's DLL (sfc /scanfile=c:\windows\system32\termsrv.dll) and got this log:
    2014-10-05 14:20:41, Info                  CBS    TI: --- Initializing Trusted Installer ---
    2014-10-05 14:20:41, Info                  CBS    TI: Last boot time: 2014-10-05 13:56:05.492
    2014-10-05 14:20:41, Info                  CBS    Starting TrustedInstaller initialization.
    2014-10-05 14:20:41, Info                  CBS    Ending TrustedInstaller initialization.
    2014-10-05 14:20:41, Info                  CBS    Starting the TrustedInstaller main loop.
    2014-10-05 14:20:41, Info                  CBS    TrustedInstaller service starts successfully.
    2014-10-05 14:20:41, Info                  CBS    No startup processing required, TrustedInstaller service was not set as autostart
    2014-10-05 14:20:41, Info                  CBS    Startup processing thread terminated normally
    2014-10-05 14:20:41, Info                  CBS    Starting TiWorker initialization.
    2014-10-05 14:20:41, Info                  CBS    Ending TiWorker initialization.
    2014-10-05 14:20:41, Info                  CBS    Starting the TiWorker main loop.
    2014-10-05 14:20:41, Info                  CBS    TiWorker starts successfully.
    2014-10-05 14:20:41, Info                  CBS    TiWorker: Client requests SFP repair object.
    2014-10-05 14:20:41, Info                  CBS    Universal Time is: 2014-10-05 11:20:41.783
    2014-10-05 14:20:41, Info                  CBS    Loaded Servicing Stack v6.3.9600.17246 with Core: C:\Windows\winsxs\amd64_microsoft-windows-servicingstack_31bf3856ad364e35_6.3.9600.17246_none_fa4ae8e99b1f603c\cbscore.dll
    2014-10-05 14:20:41, Info                  CSI    00000001@2014/10/5:11:20:41.786 WcpInitialize (wcp.dll version 0.0.0.6) called (stack @0x7ffee15c60e5 @0x7ffeeace2e53 @0x7ffeeace24ac @0x7ff69a94d2df @0x7ff69a94dc97
    @0x7fff02912225)
    2014-10-05 14:20:41, Info                  CBS    SQM: Initializing online with Windows opt-in: True
    2014-10-05 14:20:41, Info                  CBS    SQM: Cleaning up report files older than 10 days.
    2014-10-05 14:20:41, Info                  CBS    SQM: Requesting upload of all unsent reports.
    2014-10-05 14:20:41, Info                  CBS    SQM: Queued 0 file(s) for upload with pattern: C:\Windows\servicing\sqm\*_std.sqm, flags: 0x2
    2014-10-05 14:20:41, Info                  CBS    SQM: Queued 0 file(s) for upload with pattern: C:\Windows\servicing\sqm\*_all.sqm, flags: 0x6
    2014-10-05 14:20:41, Info                  CBS    NonStart: Set pending store consistency check.
    2014-10-05 14:20:41, Info                  CSI    00000002@2014/10/5:11:20:41.801 WcpInitialize (wcp.dll version 0.0.0.6) called (stack @0x7ffee15c60e5 @0x7ffef3637fc0 @0x7ffef36380f2 @0x7ff69a94ca25 @0x7ff69a94dcae
    @0x7fff02912225)
    2014-10-05 14:20:41, Info                  CSI    00000003 IAdvancedInstallerAwareStore_ResolvePendingTransactions (call 1) (flags = 00000004, progress = NULL, phase = 0, pdwDisposition = @0x559943db20
    2014-10-05 14:20:41, Info                  CSI    00000004 Creating NT transaction (seq 1), objectname [6]"(null)"
    2014-10-05 14:20:41, Info                  CSI    00000005 Created NT transaction (seq 1) result 0x00000000, handle @0x26c
    2014-10-05 14:20:41, Info                  CSI    00000006 Poqexec successfully registered in [ml:26{13},l:24{12}]"SetupExecute"
    2014-10-05 14:20:41, Info                  CSI    00000007@2014/10/5:11:20:41.999 Beginning NT transaction commit...
    2014-10-05 14:20:41, Info                  CSI    00000008@2014/10/5:11:20:41.999 CSI perf trace:
    CSIPERF:TXCOMMIT;143
    2014-10-05 14:20:42, Info                  CSI    00000009 CSI Store 367642371808 (0x00000055993166e0) initialized
    2014-10-05 14:20:42, Info                  CSI    0000000a [SR] Verifying 1 components
    2014-10-05 14:20:42, Info                  CSI    0000000b [SR] Beginning Verify and Repair transaction
    2014-10-05 14:20:42, Info                  CSI    0000000c [SR] Verify complete
    2014-10-05 14:20:52, Info                  CBS    TiWorker: Client requests SFP repair object.
    2014-10-05 14:20:55, Info                  CBS    TiWorker: Client requests SFP repair object.
    2014-10-05 14:20:55, Info                  CSI    0000000d [SR] Verifying 1 components
    2014-10-05 14:20:55, Info                  CSI    0000000e [SR] Beginning Verify and Repair transaction
    2014-10-05 14:20:55, Info                  CSI    0000000f Hashes for file member \SystemRoot\WinSxS\amd64_microsoft-windows-t..teconnectionmanager_31bf3856ad364e35_6.3.9600.17095_none_7f53b5b72842754a\termsrv.dll
    do not match actual file [l:22{11}]"termsrv.dll" :
      Found: {l:32 b:wutByJu/YxhxLZan2VmIk9CNy/65VNpYphCkpd5tWqQ=} Expected: {l:32 b:cLIGmreRLrSas6vRjUtCy5Ssmcpt4/Y/SIi46qx4qqI=}
    2014-10-05 14:20:55, Info                  CSI    00000010 [SR] Cannot repair member file [l:22{11}]"termsrv.dll" of Microsoft-Windows-TerminalServices-RemoteConnectionManager, Version = 6.3.9600.17095,
    pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, hash mismatch
    2014-10-05 14:20:55, Info                  CSI    00000011 Hashes for file member \SystemRoot\WinSxS\amd64_microsoft-windows-t..teconnectionmanager_31bf3856ad364e35_6.3.9600.17095_none_7f53b5b72842754a\termsrv.dll
    do not match actual file [l:22{11}]"termsrv.dll" :
      Found: {l:32 b:wutByJu/YxhxLZan2VmIk9CNy/65VNpYphCkpd5tWqQ=} Expected: {l:32 b:cLIGmreRLrSas6vRjUtCy5Ssmcpt4/Y/SIi46qx4qqI=}
    2014-10-05 14:20:55, Info                  CSI    00000012 [SR] Cannot repair member file [l:22{11}]"termsrv.dll" of Microsoft-Windows-TerminalServices-RemoteConnectionManager, Version = 6.3.9600.17095,
    pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, hash mismatch
    2014-10-05 14:20:55, Info                  CSI    00000013 [SR] This component was referenced by [l:154{77}]"Package_3_for_KB2959626~31bf3856ad364e35~amd64~~6.3.2.0.2959626-3_neutral_GDR"
    2014-10-05 14:20:55, Info                  CSI    00000014 Hashes for file member \??\C:\Windows\System32\termsrv.dll do not match actual file [l:22{11}]"termsrv.dll" :
      Found: {l:32 b:wutByJu/YxhxLZan2VmIk9CNy/65VNpYphCkpd5tWqQ=} Expected: {l:32 b:cLIGmreRLrSas6vRjUtCy5Ssmcpt4/Y/SIi46qx4qqI=}
    2014-10-05 14:20:55, Info                  CSI    00000015 Hashes for file member \SystemRoot\WinSxS\amd64_microsoft-windows-t..teconnectionmanager_31bf3856ad364e35_6.3.9600.17095_none_7f53b5b72842754a\termsrv.dll
    do not match actual file [l:22{11}]"termsrv.dll" :
      Found: {l:32 b:wutByJu/YxhxLZan2VmIk9CNy/65VNpYphCkpd5tWqQ=} Expected: {l:32 b:cLIGmreRLrSas6vRjUtCy5Ssmcpt4/Y/SIi46qx4qqI=}
    2014-10-05 14:20:55, Info                  CSI    00000016 [SR] Could not reproject corrupted file [ml:520{260},l:46{23}]"\??\C:\Windows\System32"\[l:22{11}]"termsrv.dll"; source file
    in store is also corrupted
    2014-10-05 14:20:55, Info                  CSI    00000017 [SR] Verify complete
    2014-10-05 14:20:55, Info                  CSI    00000018 [SR] Repairing 1 components
    2014-10-05 14:20:55, Info                  CSI    00000019 [SR] Beginning Verify and Repair transaction
    2014-10-05 14:20:55, Info                  CSI    0000001a Hashes for file member \SystemRoot\WinSxS\amd64_microsoft-windows-t..teconnectionmanager_31bf3856ad364e35_6.3.9600.17095_none_7f53b5b72842754a\termsrv.dll
    do not match actual file [l:22{11}]"termsrv.dll" :
      Found: {l:32 b:wutByJu/YxhxLZan2VmIk9CNy/65VNpYphCkpd5tWqQ=} Expected: {l:32 b:cLIGmreRLrSas6vRjUtCy5Ssmcpt4/Y/SIi46qx4qqI=}
    2014-10-05 14:20:55, Info                  CSI    0000001b [SR] Cannot repair member file [l:22{11}]"termsrv.dll" of Microsoft-Windows-TerminalServices-RemoteConnectionManager, Version = 6.3.9600.17095,
    pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, hash mismatch
    2014-10-05 14:20:55, Info                  CSI    0000001c Hashes for file member \SystemRoot\WinSxS\amd64_microsoft-windows-t..teconnectionmanager_31bf3856ad364e35_6.3.9600.17095_none_7f53b5b72842754a\termsrv.dll
    do not match actual file [l:22{11}]"termsrv.dll" :
      Found: {l:32 b:wutByJu/YxhxLZan2VmIk9CNy/65VNpYphCkpd5tWqQ=} Expected: {l:32 b:cLIGmreRLrSas6vRjUtCy5Ssmcpt4/Y/SIi46qx4qqI=}
    2014-10-05 14:20:55, Info                  CSI    0000001d [SR] Cannot repair member file [l:22{11}]"termsrv.dll" of Microsoft-Windows-TerminalServices-RemoteConnectionManager, Version = 6.3.9600.17095,
    pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, hash mismatch
    2014-10-05 14:20:55, Info                  CSI    0000001e [SR] This component was referenced by [l:154{77}]"Package_3_for_KB2959626~31bf3856ad364e35~amd64~~6.3.2.0.2959626-3_neutral_GDR"
    2014-10-05 14:20:55, Info                  CSI    0000001f Hashes for file member \??\C:\Windows\System32\termsrv.dll do not match actual file [l:22{11}]"termsrv.dll" :
      Found: {l:32 b:wutByJu/YxhxLZan2VmIk9CNy/65VNpYphCkpd5tWqQ=} Expected: {l:32 b:cLIGmreRLrSas6vRjUtCy5Ssmcpt4/Y/SIi46qx4qqI=}
    2014-10-05 14:20:55, Info                  CSI    00000020 Hashes for file member \SystemRoot\WinSxS\amd64_microsoft-windows-t..teconnectionmanager_31bf3856ad364e35_6.3.9600.17095_none_7f53b5b72842754a\termsrv.dll
    do not match actual file [l:22{11}]"termsrv.dll" :
      Found: {l:32 b:wutByJu/YxhxLZan2VmIk9CNy/65VNpYphCkpd5tWqQ=} Expected: {l:32 b:cLIGmreRLrSas6vRjUtCy5Ssmcpt4/Y/SIi46qx4qqI=}
    2014-10-05 14:20:55, Info                  CSI    00000021 [SR] Could not reproject corrupted file [ml:520{260},l:46{23}]"\??\C:\Windows\System32"\[l:22{11}]"termsrv.dll"; source file
    in store is also corrupted
    2014-10-05 14:20:55, Info                  CSI    00000022 [SR] Repair complete
    Since it's the first time I use this tool I'm not familiar with this log file, but what I managed to figure out from it is that termsrv.dll is corrupted and windows cannot repair it for some reason.
    My question is:
    How can I repair this file? Is this even the problem preventing me from connecting to this computer via Remote Desktop?
    Here's a link to my original question which contatining the images.
    http://answers.microsoft.com/en-us/windows/forum/windows8_1-system/cannot-use-remote-desktop-host-on-windows-81-pro/e4776239-4d9e-4934-ae2d-b87cc09f7ade

    managed to figure out from it is that termsrv.dll is corrupted and windows cannot repair it for some reason.
    So, the next step supposedly is
    using  DISM.
    Coincidentally I reached that page last night from
    this one, which I thought gave me a better awareness of how much manual repair might be possible.  E.g. maybe the WinSxS isn't quite as fragile as we are being led to believe?  (It's making me feel sort of like how I used to feel about the
    registry when seeing all the caveats about using RegEdit before I got used to that tool.)
    Advanced guidelines for diagnosing and fixing servicing corruption
    http://technet.microsoft.com/en-us/library/ee619779(v=WS.10).aspx 
    Something else that I became aware of yesterday serendipitously is SxStrace.exe.  I have never seen it used but it sounds useful.  E.g. perhaps easier to interpret for supplemental clues than the ProcMon trace that I usually advocate. 
    Or perhaps use both and see in ProcMon when the SxStrace is writing.   E.g. filter with  Operation Is WriteFile.
    However, what I would do first is find out what the state of your system is regarding that module.  E.g. try this Powershell pipeline to list what you have.
    PS C:\windows> dir -R -Fil "termsrv.dll" | sort-object FullName | ft Length, FullName -AutoSize
    Note that I am giving you the whole command line, including prompt to show where the command should be started from.
    C.f. another thread where doing the same diagnostic procedure seems to be finding more a problem with the Windows Update software than with the user's WinSxS cache.
    http://answers.microsoft.com/en-us/windows/forum/windows8_1-windows_store/windows-81-store-error-0x80070002-comprehensive/2b0ed3e1-1835-4517-97dd-0a7abb6ef74c?page=3#LastReply  
    HTH
    Robert Aldwinckle

  • Trying to create a local instance of the remote object

    Hi,
    I have a ClassA on which I need to be able to invoke RMI calls. Problem is the interface which ClassA implements does not throw exceptions. To get around this problem I have created a wrapper class ClassWrap which has a ClassA attribute and calls made to ClassWrap are directed to this ClassA object. A facade type design I think it's called.
    ClassWrap implements Remote so it can be used as a Remote object.
    When I create an instance of ClassWrap and deploy it on a server, my client has no problem communicating with the remote ClassWrap object via a remote stub ClassWrap_Stub.
    Problem is I also want my client to be able to use a local instance of ClassWrap. Whan I try to create an instance of ClassWrap in my client I get a remote Exception ... but !! when I have a ClassWrap_Stub object in my classpath then there is no problem creating a ClassWrap object.
    Any ideas why this happens?

    What you are trying to do should work just fine. Do you have the wrapper class file in your client jar?

  • How does the remote object connect to the correct host

    i have had a small doubt on how the remote reference manages to find the correct host to call the subsequent methods after a sucessful lookup.
    given a rebind or bind to the registry, the registry only stores the alias and the remote reference, now imagine a client calling a lookup on the registry would only get the remote reference, and not in which machine the remote object is found.
    what i wanted to know is how does the client or atleast the remote reference returned by the registry correctly connects to the machine where the remote object is located. i dont think its stored in the stub bcos the stub is a complie time stuff.
    i would be pleased to have a comprehensive answer for this.

    The membership in the group communication framework is always accurate and upto date.Up to date to the moment when you check. Not up to date to the moment when you make the RMI call.
    i could basically chk if this ip is available in the membership list.Complete waste of time. It doesn't matter what you check ahead of time, you are still trying to predict the future.
    And you still have to deal with ConnectException etc from the actual remote method call. And the way you will deal with that in your situation is exactly the same as what you were going to do if your ahead-of-time check failed.
    So just catch the exception(s) and deal with the problem there.

Maybe you are looking for