Exporting remote object
once we export some remote object ie by extending UnicastRemoteObject or by calling its exportObject method
Does it make any difference that whether the object is heavy (ie some comples GUI) or light ie some wrapper class which starts the server thread?
and what exactly is the defination of marshalling ...and its difference with serialization
thanks in advance
Hi,
As far as RMI is concerned there is no difference in the objects they handle... but it might show problems when u try to update your GUI components over the network...
The process of 'marshalling' means the method of encapsulating the parameters given in the RMI call into a format which can be used to send the required info to the server.. it includes the process of grouping the info to the stubs about the method, the data type of the parameter, the value given in them the Class heirarchy and other details related to the object..
Serialisation is a mechamism which is used in RMI for sending the object state across the servers.. It needn't be used with RMI only.. here the object state is captured ( like value, the class name, and all the attributes ) along with class heirarchy ( if it has parent classe or calls other objects of other classes ) is encapsulated and can be stored using the ObjectOutputStream's writeObject method.
- Bibin.
Similar Messages
-
Communication Error with Host and Remote Object
Hi,
I was executing my RMI program in a Linux Grid Network environment and the communication was no problem and the code did work.
However I have switched to the same code to another network with linux machines and when try to execute the code I get the Error:
java.rmi.ConnectIOException: Exception creating connection to: 136.186.14.96; nested exception is: java.net.NoRouteToHostException: No route to host
136.186.14.96 is the place where the registry is running and Server Object is bound
Client Locate the Registry as below
LocateRegistry.getRegistry("136.186.14.96",1099);
ACTUAL CODE:
+//Pass The Remote Reference+
+try {+
oClient.registry = LocateRegistry.getRegistry(oClient.o_RegistryReference,oClient.i_Port);
oClient.server = (ART_Interface) oClient.registry.lookup("Server_Obj");
oClient.server.clientRegister(oClient.i_ClientID, oClient);
System.out.println("SEQUENCE <1> Client [" iID + "] Request to Register");+
+} catch (Exception e) {+
System.out.println("Client [" oClient.i_ClientID + "]Registration Error: " + e);+
+}+
Client Code Execution....
+#ART_CLIENT <HOST> <PORT> <Client ID> <slavesPerClient>+
java -cp /home/research/mbcooray/network/mercury/GRID/ -Djava.rmi.server.codebase=file:/home/research/mbcooray/network/mercury/GRID/ -Djava.security.policy=/home/research/mbcooray/network/mercury/GRID/Policy.txt ART_Client 136.186.14.96 1099 0 1 &No for multiple instances of clients communicating (Reporting) to Server, wouldn't server have a dedicated port for them?No. A remote object is exported on port X, the client forms an inbound (from the server's point of view) connection to it, an accepted-socket is created, also on X. netstat -an will show you that: X LISTENING and zero or more X ESTABLISHED. A TCP connection consists of the tuple {TCP, client-address, client-port, server-address, server-port}. Here 'server-port' is X, 'client-port' is allocated by the system. So there can exist multiple inbound connections to X, and the server-port number is always X.
For Call backs I guess JVM gets hold of a random free portFor all outbound connections, TCP gets hold of a random free port.
as it is running on a separate thread (I assume)Threads have nothing to do with it.
Is this done by using socketfactory? Forget it. You don't want to do this, for the reasons I have. You probably don't need to do it, and if you do need to do it you should shoot the netadmin instead.
Yes, the server exports the object and binds it in the local registryThat's not the same thing as exporting it on port 1099. You can specify a port number when exporting, or when calling super() if your remote objects extend UnicastRemoteObject. If you are using LocateRegistry.createRegistry(), port 1099 will get reused automatically for all subsequently-exported remote objects unless you are using a socket factory, which you aren't. If you are using a separate Registry you should specify the export port number yourself, and you can't re-use 1099.
The background to this is that firewalls often contain rule configurations about what remote port numbers may be connected to, which corresponds to the reality that Internet services have fixed port numbers, so you can decide e.g. to allow your users to connect to HTTP servers (80,443,8080,8443) and SSH (22) but not for example Telnet (23). However by symmetry they often also allow similar rules for outbound port numbers, which are completely useless as they do not correspond to any reality whatsoever. If you have a netadmin who is enforcing outbound port number rules, just tell him to stop it. -
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 pleaseIt 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. -
Object not exported for Remote object in WSAD
Hi,
I have a few classes that extend and implement java.rmi.remote object. The JAR is placed under WEB-INF/lib of a web application.
I am using WSAD 5.1.1. When I start the server, it gives me the following error.
Can somebody make out anything?? Please help
Error Stack:
[5/3/05 12:07:04:188 IST] 3d410866 Helpers W NMSV0610I: A NamingException is being thrown from a javax.naming.Context implementation. Details follow:
Context implementation: com.ibm.ws.naming.jndicos.CNContextImpl
Context method: rebind
Context name: localhost/nodes/localhost/servers/server1
Root exception is java.rmi.NoSuchObjectException: object not exported
I tried creating the stub and the skeleton classes manually and added them to the JAR file but still I get the same error. The JAR is in the CLASSPATH of the server.
I also tried creating a simple remote object and tried binding it:
Hashtable propertiesMap = new Hashtable();
propertiesMap.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.cosnaming.CNCtxFactory");
propertiesMap.put(Context.PROVIDER_URL, "iiop://localhost:2809" );
Context context= new InitialContext(propertiesMap);
myRemote instance = new myRemote();
context.bind("TestString",instance);
Even this gives :
javax.naming.ConfigurationException: Problem with PortableRemoteObject.toStub(); object not exported or stub not found. Root exception is java.rmi.NoSuchObjectException: object not exported
at sun.rmi.transport.ObjectTable.getStub(ObjectTable.java:115)
at java.rmi.server.RemoteObject.toStub(RemoteObject.java:88)
at com.ibm.rmi.util.JDKBridge.getJRMPStub(JDKBridge.java:129)
at com.ibm.rmi.javax.rmi.PortableRemoteObject.toStub(PortableRemoteObject.java:138)
at javax.rmi.PortableRemoteObject.toStub(PortableRemoteObject.java:105)
at java.lang.reflect.Method.invoke(Native Method)
-samHi,
Not sure if this question is not clear ... Can somebody give me some hints please??
-sam -
Is the Remote Object always a singleton?
Hi,
Using .Net Remoting we can export a Remote Objects in three different ways:
1. Singleton: Same instance of a Server-side object is used by all the clients for all the requests.
2. SingleCall: Whenever a new call is received, a new instance of the Server-side object is created and reference is passed to the client. Therefore, for each call to the server, the client gets a new instance of the object.
3. Client Activation: In this, the Client requests to the server for creating a new instance which can be used for multiple calls. The instance activated by a client is not used by other clients. Client-Activated objects can store state information between method calls for its specific client.
Do we have this options in RMI or the Remote Object must always be a Singleton?
What I'm looking for is a way to create one instance of the Remote Object (in the server side) to each client that connects to a server.
thxDo we have this options in RMI1 and 3 are available. 2 is not.
or the Remote Object must always be a Singleton?No.
What I'm looking for is a way to create one instance of the Remote Object (in the server side) to each client that connects to a server.It's as simple as 'return new MyRemoteObject(...);'.
For example:
public interface Login extends Remote
public Session login(String username, ...) throws RemoteException;
public interface Session extends Remote
// your client API here
public class LoginImpl extends UnicastRemoteObject implements Login
public Session login(String username, ...) throws RemoteException
// validate username etc. If OK return a session.
return new SessionImpl();
public class SessionImpl extends UnicastRemoteObject implements Session
// your client API implementation here, also all the server-side state belonging to that client session
}Note that this is as secure as the login() method. By type safety, nobody can execute Session methods until they have logged in.
I'm deleting your two other threads. -
Premature Garbage Collection of Remote Objects
I have a problem with distributed garbage collection and RMI. In CSPoker we try to support RMI for client-server communication. The client looks up the server through the registry, calls the login method and receives back a Remote Object reference called ServerContext. The client can register Remote even listener Objects with the server.
In both directions we occasionally see:
java.rmi.NoSuchObjectException: no such object in table
The behaviour is completely unpredictable. Some developers never see it, others see it all the time. Even on the same machine, sometimes it failes immediately
and sometimes it fails after a while. One person running the Sun JRE 6 on Windows has this poblem most frequently.
Can this be a bug or do we misinterpret something? The way we see it, as long as the client leases the Remote Object it shouldn't be GCed. All tests are run on localhost so no network partition can occur.
The problem would probably be solved if we hold static references to all Remote Objects in the local JVM. This is not an option because we want the Objects to be GCed once the lease expires.
Here are 2 debugging outputs of server runs with RMI logging enabled:
http://cspoker.pastebin.com/f27a7d6fc
As you can see, the lease requests are coming through but a NoSuchObjectException is thrown and the Object is finalized.
http://cspoker.pastebin.com/f732797d2Thanks for the quick reply.
For instance:
11:56:02,427 DEBUG (org.cspoker.common.api.shared.context.ForwardingRemoteServerContext.java:72) [finalize] - Garbage collecting old context: org.cspoker.server.rmi.export.ExportingServerContext@15a8767
07.11.2008 11:56:02 sun.rmi.server.UnicastServerRef logCall
FEINER: RMI TCP Connection(2)-10.0.4.106: [10.0.4.106: sun.rmi.transport.DGCImpl[0:0:0, 2]: java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease)]
07.11.2008 11:56:03 sun.rmi.transport.Transport serviceCall
FEIN: RMI TCP Connection(2)-10.0.4.106: [10.0.4.106] exception:
java.rmi.NoSuchObjectException: no such object in table
at sun.rmi.transport.Transport.serviceCall(Transport.java:129)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
at java.lang.Thread.run(Thread.java:595)The context Object is exported and returned to the client here :
return (ExternalRemoteServerContext) UnicastRemoteObject.exportObject(context, 0);Then [the object|http://code.google.com/p/cspoker/source/browse/trunk/server/rmi/src/main/java/org/cspoker/server/rmi/export/ExportingServerContext.java?r=1023] that was just exported is GCed.
11:56:02,427 DEBUG (org.cspoker.common.api.shared.context.ForwardingRemoteServerContext.java:72) [finalize] - Garbage collecting old context: org.cspoker.server.rmi.export.ExportingServerContext@15a8767Then a lease request comes in:
FEINER: RMI TCP Connection(2)-10.0.4.106: [10.0.4.106: sun.rmi.transport.DGCImpl[0:0:0, 2]: java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease)]Then the client calls a method on the remote object and the NoSuchObjectException is thrown.
The behaviour is non-deterministic in any case but yes, on the Linux JVM I'm not seeing the problem, somebody on Windows gets it all the time. -
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,
BryanWhile 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 -
Error passing a remote object in a rmi function call
Hi,
I've a problem passing an UnicastRemoteObject extended object in a rmi function call. I get the following error
java.lang.IllegalArgumentException: argument type mismatch
I've 2 Remote Objects: GalaxyRegistration and Station. I want to pass a Station Object as argument in a function from GalaxyRegistration. Does anyone know what the problem is?
Here is the code:
public class GalaxyRegistration
extends UnicastRemoteObject
implements GalaxyRegistrationInterface, Galaxy {
public GalaxyRegistration() throws RemoteException {
public void add(Station station) throws RemoteException {
stations.addElement(station);
System.out.println("Add Station " + station.getName());
public class Station
extends UnicastRemoteObject
implements StationInterface {
SystemInfo system;
public Station(String name, String description, Coordinate position, Profile profile)
throws RemoteException {
system = new SystemInfo(name, description, position, profile);
public class StationServer {
Station station;
public void run() {
// create new Station
System.out.println("Create new Station:");
// register and bind new station
try {
station = new Station(name, descr, location, profile);
System.out.println("Station created ...");
GalaxyRegistrationInterface registry =
(GalaxyRegistrationInterface)
Naming.lookup
("//localhost/GalaxyRegistration");
System.out.println("Registry looked up ...");
// >>>>>>>> NEXT LINE IS THE ERROR LINE <<<<<<<<<<<<<<
registry.add(station);
} catch(Exception e) {
System.out.println(e);
}regardless of any other problems in your code, neither of the objects which you are subclassing from UnicastRemoteObject call the superclass constructor, which is a pretty basic flaw - in this case, it will lead to neither of these objects being exported properly.
-
Hello,
I'm trying to import data van 10XE version to new 11XE version over db_link.
When using the method I run into following error:
ORA-04052: error occurred when looking up remote object SYS.DBMS_UTILITY@<<db_link_name>>
This seems to be a bug in 10.2.0.1 fixed in later 10.2 versions, according to the database general forum. "upgrade to newer version"
But how do i fix this bug in 10XE? Or is the only way around to use the 'old-fashioned' way of exporting data from 10XE to a file, transfer the file and import it in 11XE?
Best regards,
Jan.No, you cannot apply a patch to XE. Basically the XE internal code is the same as for any other edition. That means is there a bug, you have it in XE,too. To get patches you need a licence for metalink/My Oracle Support. But even you would have one, it wouldn't help you, because Oracle does not provide patches for XE.
That's the 'price' you have to pay for this free edition.
Werner -
Rmi and reference to remote object
how I can obtain a reference to a remote object and not its value?
This will happen automatically once it is exported and you return it from the server via an RMI call, e.g. Naming.lookup() or as the result of another remote method.
-
Can a remote service return a remote object?
Hi all,
please consider a business logic for a typical forum service :
public interface ForumManager extends Remote
Forum createNewForum(String Name);
Forum getForum(String Name);
public interface Forum extends Remote
void postNewArticle(String Title, String Content);
Article [] getArticles();
public class Article implements Serializable
There are two interfaces of remote objects: ForumManager and Forum, both of two interfaces are extended from interface Remote. I created two classes implementing these interfaces respectively, and created two stub classes from the implementation with rmic.
As the logic, a ForumManager creates and manages forums on the server. A client can retrieve a remote stub of a forum instance from the manager stub, and post articles to the forum stub. The forum stub then sends the new articles to the real ForumImpl on the server, and the real implementation of Forum on the server then save the articles into disks or DBs. So, you can see, the most important thing is that clients have to be able to get the stub of a forum.
Codes in createForum() of the implementation class of ForumManager is like this:
ForumImpl TheNewForum = new ForumImpl(this.getRef());
// ^ Because ForumImpl is a remote object, without a ref, it can not be marshaled.
ForumTable.put(Name, TheNewForum);
return TheNewForum;
The problem is, the Forum instance my client retrieved from FourmManagerImpl_Stub (gotten from Naming.lookup()) is a ForumImpl, but not a Forum_Stub. So that articles posted to the forum will not be sent to the server, and different clients can not share articles with each other. I found a bunch of documents about RMI, but they did not illustrated how to retrieve a stub of a remote object from another remote object (like a manager). If you know how to cope this problem, please tell me.
Edited by: DBPZ on Apr 2, 2008 3:33 AMwhy does this base class exist?It's really only there to support stubs. The only thing it gives you over Object is the remote equality semantics, and only stubs need that. (It also provides the RemoteReference but only RMI needs that, internally, you don't.)
When should we use RemoteObject instead of UnicastRemoteObject?Never, but if you do, or you use Object (or indeed anything other than UnicastRemoteObject and Activatable), you have to export it yourself as indicated above. -
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,
BrentI 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 -
Remote Object - not able to get the returned value from java method
Hi ,
I am developing one sample flex aplication that connects to the java code and displays the returned value from the
java method in flex client. Here I am able to invoke the java method but not able to collect the returned value.
lastResult is giving null . I am able to see the sysout messages in server console.
I am using flex 3.2 and blazeds server and java 1.5
Here is the code what I have written.
<?xml version="1.0" encoding="utf-8"?><mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#FFFFFF" initialize="initApp()">
<mx:Script><![CDATA[
import mx.controls.Alert;
import mx.binding.utils.ChangeWatcher;
import mx.rpc.events.ResultEvent;
import mx.messaging.*;
import mx.messaging.channels.*
public function initApp():void {
var cs:ChannelSet = new ChannelSet();
var customChannel:Channel = new AMFChannel("my-amf", "http://localhost:8400/blazeds/messagebroker/amf"); cs.addChannel(customChannel);
remoteObj.channelSet = cs;
public function writeToConsole():void { remoteObj.writeToConsole(
"hello from Flash client");
var returnedVal:String = remoteObj.setName().lastResult; Alert.show(returnedVal);
//[Bindable]
// private var returnedVal:String;
]]>
</mx:Script>
<mx:RemoteObject id="remoteObj" destination="sro" />
<mx:Form width="437" height="281">
<mx:FormItem>
</mx:FormItem>
<mx:Button label="Write To Server Console" click="writeToConsole()"/>
</mx:Form>
</mx:WindowedApplication>
Java code
public
public SimpleRemoteObject(){
super(); }
class SimpleRemoteObject {
public void writeToConsole(String msg) { System.out.println("SimpleRemoteObject.write: " + msg); }
public String setName(){ System.
out.println("Name changed in Java");
return "Name changed in Java";
And I have configured destination in remote-config.xml
<destination id="sro">
<properties>
<source>SimpleRemoteObject</source>
<scope>application</scope>
</properties>
</destination>
Please help me .You are not able to get the returned value because if you see the Remote object help you will realise you have to use result="resultfn()" and fault = "faultfn()"
In this you define what you wish to do.
More importantly in the remote object you need to define which method you wish to call using the method class like this
<mx:RemoteObject id="remoteObj" destination="sro" result="r1" fault="f1" >
<Method name="javaMethodName" result="r2" fault="f2"/>
<mx:RemoteObject>
r2 is the function where you get the result back from java and can use it to send the alert. -
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
LukeHi 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. -
PL/SQL: ORA-04052: error occurred when looking up remote object.
Hi All,
I'm getting the following error message while executing a PL/SQL Block.
PL/SQL: ORA-04052: error occurred when looking up remote object UPLDUSER.filestatushistory@FTS
ORA-00604: error occurred at recursive SQL level 1
ORA-03106: fatal two-task communication protocol error
ORA-02063: preceding line from FTSStatement
declare
v_coun number;
begin
select count(*) into v_coun
from updluser.filestatushistory@fts;
end;Back ground of the situation as follows,
My DataBase version 10.2.0.3 DB Name :DB1
Table Owner : UPLDUSER
Table Name : FILESTATUSHISTORY
I have a report user on the same database and I have grant all on the above table to report user
Report User : RPT_FTS
SQL> GRANT ALL ON FILESTATUSHISTORY_V TO RPT_FTS;Now Please find the below database details where I'm getting subjected error.
Database version : 9.2.0.8
DB Name : DB2
User Name : RPT_REPORTS
I Have create a dblink from RPT_REPORTS to RPT_FTS on DB1 and the dblink works fine. But getting the above error while running it.
but When I do the same other 10.2.0.3 db , the above PL/SQL block works fine without any problem.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Now the strange about this is that I have Created a new table on DB1 db like below;
SQL> CREATE TABLE UPLDUSER.ABC AS SELECT * FROM FILESTATUSHISTORY;and retry my code on DB2 (9.2.0.8) after changing the table to ABC and it worked. Now I don't know whats wrong with a original table(FILESTATUSHISTORY).
To over come the problem and a work-a-round method I create a view on the DB1 (RPT_FTS) like the below
SQL> CREATE VIEW FILESTATUSHISTORY AS SELECT * FROM UPLDUSER.FILESTATUSHISTORY;and was able to run the PL/SQL block Remotely.
Just wants To know what whould have been the cause for this .
Cheers
KanchanaHi Kanchana,
Perhaps following link of google search has answer to your query
ORA-04052. The search result contains some useful articles whose URLs I shan't post in the forums.
HTH!
*009*
Maybe you are looking for
-
Syncing Ipod on Vista Buisness N
I have Vista Buisness Edition N. Not the beta, the full version. I tried to update my ipod, but (while I was installing itunes) it told me that the ipod helper could not run. Now I can't update my ipod. It reads it, but I get a messege saying that I
-
Pages 5.1 is unable to save a new file
If I start a new Pages (5.1) document, I cannot save it. Also, if I duplicate a Pages document that I can open and continue to work on, I cannot save this duplicate document either. It does not matter what folder I select, new or existing. I get t
-
Cannot send some pictures from IPhoto '08 using ichat
For some reason I cannot send some pictures in my library over ichat or yahoo messenger? any ideas what happen? never had this problem before
-
I have a new Intex Cloud Fx phone. In this, I go to 'Device in formation' and try to update the device by pressing update now, I get an error message that says 'an error occurred while checking for updates'. Also, it does not respond to the' last upd
-
I have an LC/APC fiber patch cord infrastructure and I want to connect it to Cisco Catalyst 6500 & Cisco Access 3750 Switches. what type of transceiver should be used? I read a note on Cisco website stating the following for Cisco SFP+ transceivers: