participate


Enterprise JavaBeans - Remote EJB and RMIIO
This question is answered.

<<   Back to Forum  |   Give us Feedback
This topic has 21 replies on 2 pages.    « Previous | 1 | 2 |
Ristretto
Posts:137
Registered: 08/02/08
Re: Remote EJB and RMIIO   
Mar 30, 2009 12:26 AM (reply 15 of 21)  (In reply to #14 )
 
 
Hi James,

Sure, here is my CorbaRemoteStreamExporter class:

import java.rmi.RemoteException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
import javax.rmi.CORBA.Stub;
import org.omg.CORBA.ORB;
import com.healthmarketscience.rmiio.RemoteStreamServer;
import com.healthmarketscience.rmiio.exporter.RemoteStreamExporter;
 
public class CorbaRemoteStreamExporter extends RemoteStreamExporter {
 
	@Override
	protected Object exportImpl(RemoteStreamServer<?, ?> remoteStreamServer) throws RemoteException {
		PortableRemoteObject.exportObject(remoteStreamServer);
		Stub stub = (Stub)PortableRemoteObject.toStub(remoteStreamServer);
		
		try {
			Context context = new InitialContext();
			ORB orb = (ORB)context.lookup("java:comp/ORB");
			stub.connect(orb);
		}
		catch (NamingException exception) {
			// TODO: handle exception
		}
		
		return lStub;
	}
 
	@Override
	protected void unexportImpl(RemoteStreamServer<?, ?> remoteStreamServer) throws Exception {
		PortableRemoteObject.unexportObject(remoteStreamServer);
	}
}


As for the example that confused me - it is the very first one entitled "The 'server' is reading a file from the 'client'". Instead of calling a method and passing the RemoteInputStream I return it as part of my method call and as such I shouldn't perform the close.
 
Ristretto
Posts:137
Registered: 08/02/08
Re: Remote EJB and RMIIO   
Mar 30, 2009 5:28 AM (reply 16 of 21)  (In reply to #15 )
 
 
[Question Removed]

-- Sorry, I made a stupid mistake. This question wasn't really relevant.

By the way James, thanks for all your help and for making RMIIO publicly available.
 
jtahlborn
Posts:1,745
Registered: 26/01/08
Re: Remote EJB and RMIIO   
Mar 30, 2009 6:52 AM (reply 17 of 21)  (In reply to #15 )
 
 
Ristretto wrote:

As for the example that confused me - it is the very first one entitled "The 'server' is reading a file from the 'client'". Instead of calling a method and passing the RemoteInputStream I return it as part of my method call and as such I shouldn't perform the close.

right, because in your case: the 'client' is reading a file from the 'server'. maybe i should put more examples in which cover more use cases.
 
Ristretto
Posts:137
Registered: 08/02/08
Re: Remote EJB and RMIIO   
Apr 1, 2009 12:52 AM (reply 18 of 21)  (In reply to #17 )
 
 
I think that would be useful. Perhaps a few dealing directly with EJBs and sending a file to and receiving a file from a Remote interface? Feel free to include "my" CorbaRemoteStreamExporter anywhere it might be useful.
 
jtahlborn
Posts:1,745
Registered: 26/01/08
Re: Remote EJB and RMIIO   
Apr 1, 2009 9:22 AM (reply 19 of 21)  (In reply to #18 )
 
 
Ristretto wrote:
I think that would be useful. Perhaps a few dealing directly with EJBs and sending a file to and receiving a file from a Remote interface? Feel free to include "my" CorbaRemoteStreamExporter anywhere it might be useful.

already added a reference to your exporter in the FAQ section for app servers. i also added a another example of the "server" returning a remoteinputstream to the "client" which hopefully spells out the stream management a little more clearly.
 
ConnieZeng
Posts:1
Registered: 4/11/09
Re: Remote EJB and RMIIO   
Apr 11, 2009 2:57 AM (reply 20 of 21)  (In reply to #19 )
 
 
Hi jtahlborn, I have followed your sample exporter codes, however, it throws below exception:

[4/11/09 17:46:13:077 CST] 00000035 SystemErr     R java.rmi.StubNotFoundException: Stub class not found: com.healthmarketscience.rmiio.RemoteInputStreamServer_Stub; nested exception is: 
	java.lang.ClassNotFoundException: com.healthmarketscience.rmiio.RemoteInputStreamServer_Stub
[4/11/09 17:46:13:312 CST] 00000035 SystemErr     R 	at sun.rmi.server.Util.createStub(Util.java:292)
[4/11/09 17:46:13:687 CST] 00000035 SystemErr     R 	at sun.rmi.server.Util.createProxy(Util.java:140)
[4/11/09 17:46:13:859 CST] 00000035 SystemErr     R 	at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:184)
[4/11/09 17:46:13:968 CST] 00000035 SystemErr     R 	at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:306)
[4/11/09 17:46:14:046 CST] 00000035 SystemErr     R 	at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:233)
[4/11/09 17:46:14:280 CST] 00000035 SystemErr     R 	at com.ibm.rmi.javax.rmi.PortableRemoteObject.exportObject(PortableRemoteObject.java:126)
[4/11/09 17:46:14:280 CST] 00000035 SystemErr     R 	at javax.rmi.PortableRemoteObject.exportObject(PortableRemoteObject.java:106)
[4/11/09 17:46:14:405 CST] 00000035 SystemErr     R 	at connie.remote.RMIIOPRemoteStreamExporter.exportImpl(RMIIOPRemoteStreamExporter.java:22)
[4/11/09 17:46:14:687 CST] 00000035 SystemErr     R 	at com.healthmarketscience.rmiio.exporter.RemoteStreamExporter.export(RemoteStreamExporter.java:121)
[4/11/09 17:46:14:687 CST] 00000035 SystemErr     R 	at servlet.FileUploadServlet.doPost(FileUploadServlet.java:165)


I'm running IBM Rational Software Architect v 7.0.0.2.

Any idea?

Thanks
 
jtahlborn
Posts:1,745
Registered: 26/01/08
Re: Remote EJB and RMIIO   
Apr 11, 2009 8:14 AM (reply 21 of 21)  (In reply to #20 )
 
 
glassfish uses dynamic stub generation, so the exporter alone will be sufficient. however, you must be using a platform which expects statically generated stubs. you should checkout the RMI IIOP Guide as well as the example corba code in the RMIIO project (which may include the necessary stubs already).
 
This topic has 21 replies on 2 pages.    « Previous | 1 | 2 |
Back to Forum
 
Read the Developer Forums Code of Conduct

Click to email this message Email this Topic

Edit this Topic
  
 
 
Forums Statistics
    Users Online : 28
  • Guests : 129

About Sun forums
  • Oracle Forums is a large collection of user generated discussions. It is here to help you ask questions, find answers, and participate in discussions.

    Check out our guide on Getting started with Oracle Forums for a full walkthrough of how to best leverage the benefits of this community.

Powered by Jive Forums