JavaFX & RMI / Async Examples?
Hi All,
I'd like to know if there are any examples of client/server communication via JavaFX. In particular, are there any mobile (client) examples?
Cheers.
hi Andrew,
I did use jndi or web service to make remote calls, some code snippets are here:
http://forums.sun.com/thread.jspa?threadID=5378188&tstart=0
Hope it helps,
Cheers.
Similar Messages
-
RMI Hello Example under Windows
I'm trying out the Sun RMI Hello World example to find out more about RMI
http://java.sun.com/j2se/1.5.0/docs/guide/rmi/hello/hello-world.html
I'm using JDK1.6, under WinXP.
I've compiled the classes, then tried to run the Server using start java example.hello.Server (I've added a CLASSPATH env var pointing to the root of my class files.)
When the Server starts I get
Server exception: java.rmi.ConnectException: Connection refused to host: 192.168
.1.5; nested exception is:
java.net.ConnectException: Connection refused: connect
java.rmi.ConnectException: Connection refused to host: 192.168.1.5; nested excep
tion is:
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
at sun.rmi.server.UnicastRef.newCall(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
at example.hello.Server.main(Server.java:61)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown S
ource)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown S
ource)
... 6 more
My ip address is 192.168.1.5
I think this is some sort of networking security problem and I would be grateful for some pointers on solving this ?jtahlborn wrote:
do you have an rmiregistry running? the server is trying (and failing) to connect to a registry. i believe those examples refer to starting the rmi registry before running the example code.I didn't do that. Thanks for the help.
In a real application I assume you start the registry service in some way when the server is started if it isn't already running ? -
Errors compiling the rmi-iiop example.
Hello,
I have WebLogic Server 5.1, jdk1.3, Inprise's Visibroker for Java 4.0
and Visibroker for C++ 4.0 all on Windows NT.
I am following the steps on the index.html page in the
examples/rmi_iiop/hello directory in my weblogic directory. The errors
occur at step 5 of the section "Build the client".
The errors are output by the java compiler. They are:
examples\rmi_iiop\hello\_HelloWorld_Stub.java:17:
examples.rmi_iiop.hello._HelloWorld_Stub should be declared abstract; it
does not define bind() in examples.rmiiiop.hello._HelloWorld_Stub
public class HelloWorldStub extends javax.rmi.CORBA.Stub implements
HelloWorld {
^
examples\rmi_iiop\hello\HelloImpl.java:12:
examples.rmi_iiop.hello.HelloImpl should be declared abstract; it does
not define isa(java.lang.String) in examples.rmi_iiop.hello.HelloImpl
public class HelloImpl implements HelloWorld {
Are there issues with jdk1.3? Or have I misapplied some steps?
Any help would be greatly appreciated.
David Hallam
[email protected]The problem you are having is that the compiler is picking up another copy of HelloWorld... see if you can run the compiler with verbose turned on and find where it is getting the interface from... or try using javap...So, here is the output when I compile in verbose mode:
D:\weblogic>javac -verbose -d %WL_HOME%\myserver\corbaclient
examples\rmi_iiop\h
ello\*.java
[parsing started examples\rmi_iiop\hello\_HelloWorldStub.java]
[parsing completed 160ms]
[parsing started examples\rmi_iiop\hello\HelloClient.java]
[parsing completed 30ms]
[parsing started examples\rmi_iiop\hello\HelloImpl.java]
[parsing completed 0ms]
[parsing started examples\rmi_iiop\hello\HelloWorld.java]
[parsing completed 10ms]
[parsing started examples\rmi_iiop\hello\HelloWorldHelper.java]
[parsing completed 0ms]
[parsing started examples\rmi_iiop\hello\HelloWorldHolder.java]
[parsing completed 0ms]
[parsing started examples\rmi_iiop\hello\HelloWorldOperations.java]
[parsing completed 0ms]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/ObjectImpl.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Object.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Object.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/IDLEntity.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/Serializable.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/Delegate.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/String.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/ObjectInputStream.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/ObjectOutputStream.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NameComponent.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContextHelper.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContext.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/ORB.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/rmi/RemoteException.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Exception.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Any.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/TypeCode.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/InputStream.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/OutputStream.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/Streamable.class)]
[checking examples.rmi_iiop.hello._HelloWorldStub]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/ApplicationException.cl
ass)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Throwable.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/MARSHAL.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/SystemException.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/RuntimeException.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/RemarshalException.clas
s)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/InputStream.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/IOException.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/OutputStream.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Error.class)]
[wrote
D:\weblogic\myserver\corbaclient\examples\rmi_iiop\hello\_HelloWorldStub.
class]
[checking examples.rmi_iiop.hello.HelloWorld]
[wrote
D:\weblogic\myserver\corbaclient\examples\rmi_iiop\hello\HelloWorld.class
[checking examples.rmi_iiop.hello.HelloWorldOperations]
[wrote
D:\weblogic\myserver\corbaclient\examples\rmi_iiop\hello\HelloWorldOperat
ions.class]
[checking examples.rmi_iiop.hello.HelloClient]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/System.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/PrintStream.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/FilterOutputStream.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContextOperations.clas
s)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/BAD_PARAM.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContextPackage/NotFoun
d.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/UserException.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContextPackage/CannotP
roceed.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContextPackage/Invalid
Name.class)]
[wrote
D:\weblogic\myserver\corbaclient\examples\rmi_iiop\hello\HelloClient.clas
s]
[checking examples.rmi_iiop.hello.HelloImpl]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Policy.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/SetOverrideType.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/DomainManager.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Context.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/NVList.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/NamedValue.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/ExceptionList.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/ContextList.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Request.class)]
examples\rmi_iiop\hello\HelloImpl.java:12:
examples.rmi_iiop.hello.HelloImpl sho
uld be declared abstract; it does not define isa(java.lang.String) in
examples
.rmi_iiop.hello.HelloImpl
public class HelloImpl implements HelloWorld {
^
[loading D:\jdk1.3\jre\lib\rt.jar(javax/naming/Context.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(javax/naming/InitialContext.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(javax/naming/Name.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Comparable.class)]
[checking examples.rmi_iiop.hello.HelloWorldHelper]
[checking examples.rmi_iiop.hello.HelloWorldHolder]
[total 1301ms]
1 error -
RMI-IIOP Example for Java SE 6
Hi.
Can someone provide me an example (link or code) of how to write an RMI-IIOP remote object, bind it to jndi (glassfish) and then call it from within the glassfish application server (I'm calling from an EJB).
The guide available at http://java.sun.com/javase/6/docs/technotes/guides/rmi-iiop/tutorial.html is unfortunately not helpful because it the code there does not work when binding the remote object in glassfish JNDI (using empty InitialContext constructor) as opposed to the orbd daemon that is described in the guide.
Am I not allowed to bind RMI-IIOP objects in glassfish application server JNDI, i.e. do I have to use orbd?
Do you have to generate stubs for the remote objects in Java SE6? The tutorial says to do it but the exception I get on glassfish application server is not from the _<interface-name>Stub.java but rather from <interface-name>_DynamicStub.java.
Any help is greatly appreciated!Are you trying to create an RMI-IIOP server inside an
Application Server (Glassfish)?I'm not really sure about how it all works but I don't think so. I am exporting my Remote objects (using PortableRemoteObject) from a standalone Java SE client app. Relating this to normal RMI I had assumed that this automatically started an RMI-IIOP server on an anonomous port, although I now see that the javadoc says that the export method only "Makes a server object ready to receive remote calls.", whatever that means. So if calling the export method doesn't start an RMI-IIOP server then I'm guessing I would have to start one, and then yes, if possible, I would like to do it in glassfish and avoid starting up more applications.
I am guessing I am missing something fundamental here..
The tutorial uses the JNDI Registry (tnameserv). (and
it works fine)Is that what is automatically started when glassfish application server is started?
Have you looked into using a Portable Object Adapter?No, I have not. I want to keep it as simple and close to regular RMI though, so if possible I would like to avoid POA. -
JavaFx + rmi server problem
I have a problem not with code but with the way how rmi is working. I have such a classes for Server side which is RmiServer.java RmiInterface.java and UNode.java (this one is for supporting linked lists on server side) and my client side looks like main.fx, list.fx RmiClient.java and RmiInterface.java. The problem is that server files and client files are suppose to be in the same directory. Im using netbeans and I can not create an fx project with two main classes. So what i was trying to do is to create two projects one for server and second for client + fx script. But then I get the error about paths. And I can not copy those files because If i do so they immediately appear in second project. So guys do you have any idea how can I solve this problem. If it is helpful I can attach java files. Because what I understood is the server side is suppose to run all the time and different clients get connected to it so it can not be in the same project.
P.S. When I was checking the rmi without connecting it to javafx it was working properly.
Sorry for my English:P
Edited by: ZIelonyWpaletki on Oct 21, 2009 1:11 PMSometimes you are starting the RMI Registry with the correct classpath, or in the correct directory, and sometimes you aren't.
-
Re: Errors compiling the rmi-iiop example.
As I said, apparently, you are trying to compile the IDL client in java using the RMI client classes. THere are two problems with this:
1-- you must compile the rmi class definitions into a directory that can be easily excluded from the class path at the time you compile the idl definitions.
2-- the idl definitions and the resulting classes are useless wrt the rmi definitions and wls, so the resulting classes must be compiled into directories other than those used by wls and the rmi clients.
Another way to look at this is as follows:
To compile the rmi definitions, you do:
set ORIGINALCLASSPATH=CLASSPATH
set CLASSPATH=../fooclasses;$CLASSPATH
javac -d ../fooclasses rmi/FooImpl.java
Then,
-- you compile the jrmp classes as:
rmic -d ../jrmpclasses rmi.FooImpl
-- you compile the weblogic classes as:
java weblogic.rmic -d ../wlsclasses rmi.FooImpl
that is, you are allowed to compile from the same implementation class so long as it is compliant
-- you compile the rmi-iiop classes as:
java weblogic.rmic -iiop -d ../rmiiiopclasses rmi.FooImpl
that is, as with jrmp and wls, the rmi-iiop classes share the same base type definitions and implementation.
However, the idl classes are another matter. To compile the idl classes, you must generate the idl, generate the java files and generate the idl class files into another, separate directory, one which does not include any of ../fooclasses, ../jrmpclasses, ../wlsclasses or ../rmiiiopclasses
directories.
That is,
java weblogic.rmic -idlDirtecory ../idl ...
set CLASSPATH=ORIGINALCLASSPATH
set CLASSPATH=../idlclasses;CLASSPATH
cd ../idl
idl2java rmi/Foo.idl
javac -d ../idl rmi/*.java
Hope this helps...
"Hallam, David [CAR:5e10:EXCH]" wrote:
The problem you are having is that the compiler is picking up another copy of HelloWorld... see if you can run the compiler with verbose turned on and find where it is getting the interface from... or try using javap...So, here is the output when I compile in verbose mode:
D:\weblogic>javac -verbose -d %WL_HOME%\myserver\corbaclient
examples\rmi_iiop\h
ello\*.java
[parsing started examples\rmi_iiop\hello\_HelloWorldStub.java]
[parsing completed 160ms]
[parsing started examples\rmi_iiop\hello\HelloClient.java]
[parsing completed 30ms]
[parsing started examples\rmi_iiop\hello\HelloImpl.java]
[parsing completed 0ms]
[parsing started examples\rmi_iiop\hello\HelloWorld.java]
[parsing completed 10ms]
[parsing started examples\rmi_iiop\hello\HelloWorldHelper.java]
[parsing completed 0ms]
[parsing started examples\rmi_iiop\hello\HelloWorldHolder.java]
[parsing completed 0ms]
[parsing started examples\rmi_iiop\hello\HelloWorldOperations.java]
[parsing completed 0ms]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/ObjectImpl.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Object.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Object.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/IDLEntity.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/Serializable.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/Delegate.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/String.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/ObjectInputStream.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/ObjectOutputStream.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NameComponent.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContextHelper.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContext.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/ORB.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/rmi/RemoteException.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Exception.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Any.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/TypeCode.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/InputStream.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/OutputStream.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/Streamable.class)]
[checking examples.rmi_iiop.hello._HelloWorldStub]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/ApplicationException.cl
ass)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Throwable.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/MARSHAL.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/SystemException.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/RuntimeException.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/RemarshalException.clas
s)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/InputStream.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/IOException.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/OutputStream.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Error.class)]
[wrote
D:\weblogic\myserver\corbaclient\examples\rmi_iiop\hello\_HelloWorldStub.
class]
[checking examples.rmi_iiop.hello.HelloWorld]
[wrote
D:\weblogic\myserver\corbaclient\examples\rmi_iiop\hello\HelloWorld.class
[checking examples.rmi_iiop.hello.HelloWorldOperations]
[wrote
D:\weblogic\myserver\corbaclient\examples\rmi_iiop\hello\HelloWorldOperat
ions.class]
[checking examples.rmi_iiop.hello.HelloClient]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/System.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/PrintStream.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/FilterOutputStream.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContextOperations.clas
s)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/BAD_PARAM.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContextPackage/NotFoun
d.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/UserException.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContextPackage/CannotP
roceed.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContextPackage/Invalid
Name.class)]
[wrote
D:\weblogic\myserver\corbaclient\examples\rmi_iiop\hello\HelloClient.clas
s]
[checking examples.rmi_iiop.hello.HelloImpl]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Policy.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/SetOverrideType.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/DomainManager.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Context.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/NVList.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/NamedValue.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/ExceptionList.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/ContextList.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Request.class)]
examples\rmi_iiop\hello\HelloImpl.java:12:
examples.rmi_iiop.hello.HelloImpl sho
uld be declared abstract; it does not define isa(java.lang.String) in
examples
.rmi_iiop.hello.HelloImpl
public class HelloImpl implements HelloWorld {
^
[loading D:\jdk1.3\jre\lib\rt.jar(javax/naming/Context.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(javax/naming/InitialContext.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(javax/naming/Name.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Comparable.class)]
[checking examples.rmi_iiop.hello.HelloWorldHelper]
[checking examples.rmi_iiop.hello.HelloWorldHolder]
[total 1301ms]
1 error[att1.html]test
"Hallam, David [CAR:5e10:EXCH]" wrote:
Eduardo,
These directions worked perfectly, thank-you. One point though, this is
COMPLETELY different to the directions on the index.html page in the
examples directory.
Regards,
David Hallam.
Eduardo Ceballos wrote:
As I said, apparently, you are trying to compile the IDL client in
java using the RMI client classes. THere are two problems with this:
1-- you must compile the rmi class definitions into a directory that
can be easily excluded from the class path at the time you compile the
idl definitions.
2-- the idl definitions and the resulting classes are useless wrt the
rmi definitions and wls, so the resulting classes must be compiled
into directories other than those used by wls and the rmi clients.
Another way to look at this is as follows:
To compile the rmi definitions, you do:
set ORIGINALCLASSPATH=CLASSPATH
set CLASSPATH=../fooclasses;$CLASSPATH
javac -d ../fooclasses rmi/FooImpl.java
Then,
-- you compile the jrmp classes as:
rmic -d ../jrmpclasses rmi.FooImpl
-- you compile the weblogic classes as:
java weblogic.rmic -d ../wlsclasses rmi.FooImpl
that is, you are allowed to compile from the same implementation class
so long as it is compliant
-- you compile the rmi-iiop classes as:
java weblogic.rmic -iiop -d ../rmiiiopclasses rmi.FooImpl
that is, as with jrmp and wls, the rmi-iiop classes share the same
base type definitions and implementation.
However, the idl classes are another matter. To compile the idl
classes, you must generate the idl, generate the java files and
generate the idl class files into another, separate directory, one
which does not include any of ../fooclasses, ../jrmpclasses,
../wlsclasses or ../rmiiiopclasses directories.
That is,
java weblogic.rmic -idlDirtecory ../idl ...
set CLASSPATH=ORIGINALCLASSPATH
set CLASSPATH=../idlclasses;CLASSPATH
cd ../idl
idl2java rmi/Foo.idl
javac -d ../idl rmi/*.java
Hope this helps...
"Hallam, David [CAR:5e10:EXCH]" wrote:
The problem you are having is that the compiler is picking upanother copy of HelloWorld... see if you can run the compiler with
verbose turned on and find where it is getting the interface from...
or try using javap...
So, here is the output when I compile in verbose mode:
D:\weblogic>javac -verbose -d %WL_HOME%\myserver\corbaclient
examples\rmi_iiop\h
ello\*.java
[parsing started examples\rmi_iiop\hello\_HelloWorldStub.java]
[parsing completed 160ms]
[parsing started examples\rmi_iiop\hello\HelloClient.java]
[parsing completed 30ms]
[parsing started examples\rmi_iiop\hello\HelloImpl.java]
[parsing completed 0ms]
[parsing started examples\rmi_iiop\hello\HelloWorld.java]
[parsing completed 10ms]
[parsing started examples\rmi_iiop\hello\HelloWorldHelper.java]
[parsing completed 0ms]
[parsing started examples\rmi_iiop\hello\HelloWorldHolder.java]
[parsing completed 0ms]
[parsing started examples\rmi_iiop\hello\HelloWorldOperations.java]
[parsing completed 0ms]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/ObjectImpl.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Object.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Object.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/IDLEntity.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/Serializable.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/Delegate.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/String.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/ObjectInputStream.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/ObjectOutputStream.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NameComponent.class)]
[loading
D:\jdk1.
\jre\lib\rt.jar(org/omg/CosNaming/NamingContextHelper.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContext.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/ORB.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/rmi/RemoteException.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Exception.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Any.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/TypeCode.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/InputStream.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/OutputStream.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/Streamable.class)]
[checking examples.rmi_iiop.hello._HelloWorldStub]
[loading
D:\jdk1.
\jre\lib\rt.jar(org/omg/CORBA/portable/ApplicationException.cl
ass)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Throwable.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/MARSHAL.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/SystemException.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/RuntimeException.class)]
[loading
D:\jdk1.
\jre\lib\rt.jar(org/omg/CORBA/portable/RemarshalException.clas
s)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/InputStream.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/IOException.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/OutputStream.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Error.class)]
[wrote
D:\web
ogic\myserver\corbaclient\examples\rmi_iiop\hello\_HelloWorldStub.
class]
[checking examples.rmi_iiop.hello.HelloWorld]
[wrote
D:\web
ogic\myserver\corbaclient\examples\rmi_iiop\hello\HelloWorld.class
[checking examples.rmi_iiop.hello.HelloWorldOperations]
[wrote
D:\web
ogic\myserver\corbaclient\examples\rmi_iiop\hello\HelloWorldOperat
ions.class]
[checking examples.rmi_iiop.hello.HelloClient]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/System.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/PrintStream.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/io/FilterOutputStream.class)]
[loading
D:\jdk1.
\jre\lib\rt.jar(org/omg/CosNaming/NamingContextOperations.clas
s)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/BAD_PARAM.class)]
[loading
D:\jdk1.
\jre\lib\rt.jar(org/omg/CosNaming/NamingContextPackage/NotFoun
d.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/UserException.class)]
[loading
D:\jdk1.
\jre\lib\rt.jar(org/omg/CosNaming/NamingContextPackage/CannotP
roceed.class)]
[loading
D:\jdk1.
\jre\lib\rt.jar(org/omg/CosNaming/NamingContextPackage/Invalid
Name.class)]
[wrote
D:\web
ogic\myserver\corbaclient\examples\rmi_iiop\hello\HelloClient.clas
s]
[checking examples.rmi_iiop.hello.HelloImpl]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Policy.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/SetOverrideType.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/DomainManager.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Context.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/NVList.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/NamedValue.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/ExceptionList.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/ContextList.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Request.class)]
examples\rmi_iiop\hello\HelloImpl.java:12:
examples.rmi_iiop.hello.HelloImpl sho
uld be declared abstract; it does not define isa(java.lang.String)
in
examples
.rmi_iiop.hello.HelloImpl
public class HelloImpl implements HelloWorld {
^
[loading D:\jdk1.3\jre\lib\rt.jar(javax/naming/Context.class)]
[loading
D:\jdk1.3\jre\lib\rt.jar(javax/naming/InitialContext.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(javax/naming/Name.class)]
[loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Comparable.class)]
[checking examples.rmi_iiop.hello.HelloWorldHelper]
[checking examples.rmi_iiop.hello.HelloWorldHolder]
[total 1301ms]
1 error
Developer Relations Engineer
BEA Support -
Trying to find some examples of using JDK 1.5 and the SslRMIServerSocketFactory, SslRMIClientSocketFactory.
Anyone help?If you check out the java.rmi.server.RMISocketFactory class, it has a static setSocketFactory(RMISocketFactory) method. However, neither of the SSLRMI Socket Factory classes are actually a RMISocketFactory as that requires implementation of both the RMIClientSocketFactory and RMIServerSocketFactory interfaces. What you could do is create your own class that extends RMISocketFactory. This is an abstract class and has two abstract methods. Simply wrap the SSLRMI Socket Factory classes in your own class and return whatever Socket they would return. That should do it.
I have not done this myself with the new SSL RMI socket factories, but I have done something similar and that works great. -
Hi,
how can I invocate remote methods from my JavaFX application to a web server?
I know that there's an article about, at http://java.sun.com/developer/technicalArticles/scripting/javafxpart2/ but link doesn't work...
Anyone can help me???
Thanks in advance ;)You can also look at [Flaming RIA framework|http://exadel.com/web/portal/flamingo] . You won't have to work with any HTTP, request/response API. Flamingo hides all the complexity connecting JavaFX to server-side.
-
Help!!!I can not pass the Logger example of Rmi-iiOP
I am using the j2sdk1.4.0 and j2sdkee1.3.1 as back ground.And use Win2000
I try the rmi-iiop example given by Sun.But it doesn't work.
Firstly , compile Logger.java LoggerHome.java LogMessage.java LoggerEJB.java to class
javac -classpath "c:\j2sdkee1.3.1\lib\j2ee.jar;c:\wytestejb\" Logger.java LoggerHome.java LogMessage.java LoggerEJB.java
that was ok.
Then I draw idl from that just like
rmic -idl -noValueMethods -classpath "c:\j2sdkee1.3.1\lib\j2ee.jar;c:\wytestejb\" Logger LoggerHome
then I got Logger.idl LoggerHome.idl javax\ejb\...idl java\lang\...idl
After that I create one directory named client.copying all idl file into it,I transfered idl to java using
idlj -i C:\j2sdk1.4.0\lib -i c:\wytestejb\client -i C:\j2sdkee1.3.1\lib -emitAll -fclient Logger.idl
idlj -i C:\j2sdk1.4.0\lib -i c:\wytestejb\client -i C:\j2sdkee1.3.1\lib -emitAll -fclient LoggerHome.idl
Then I got *.java such as Logger.java LoggerHome.java .....java java\lang\***.class javax\ejb\****.class
I put the LogClient.java in this directory and compile *.java like
C:\wytestejb\client>javac -classpath "c:\j2sdkee1.3.1\lib\j2ee.jar;c:\wytestejb\
client;c:\j2sdk1.4.0\lib;c:\j2sdk1.4.0\bin" *.java
And I got
c:\wytestejb\client\java\lang\_Exception.java:23: cannot resolve symbol
symbol : method _read (org.omg.CORBA.portable.InputStream)
location: class java.lang.Throwable
super._read (istream);
^
c:\wytestejb\client\java\lang\_Exception.java:28: cannot resolve symbol
symbol : method _write (org.omg.CORBA.portable.OutputStream)
location: class java.lang.Throwable
super._write (ostream);
^
LogClient.java:20: cannot resolve symbol
symbol : method println (java.lang.String)
location: interface java.io.PrintStream
System.out.println("Looking for: " + loggerHomeURL);
^
LogClient.java:38: cannot resolve symbol
symbol : method println (java.lang.String)
location: interface java.io.PrintStream
System.out.println("Logging...");
^
LogClient.java:47: cannot resolve symbol
symbol : method println (java.lang.String)
location: interface java.io.PrintStream
System.out.println("Done");
^
LogClient.java:59: cannot resolve symbol
symbol : method println (java.lang.String)
location: interface java.io.PrintStream
System.out.println("Args: corbaname URL of LoggerHome");
^
LogClient.java:66: cannot resolve symbol
symbol : method printStackTrace ()
location: class java.lang.Throwable
t.printStackTrace();
^
7 errors
C:\wytestejb\client>By the way
My java file is as
Logger.java
The file Logger.java is the enterprise bean's remote interface, and as such, it extends EJBObject . A remote interface provides the remote client view of an EJB object and defines the business methods callable by a remote client.
//Code Example 1: Logger.java
package ejbinterop;
import javax.ejb.EJBObject;
import java.rmi.RemoteException;
* Accepts simple String log messages and prints
* them on the server.
public interface Logger extends EJBObject
* Logs the given message on the server with
* the current server time.
void logString(String message) throws RemoteException;
LoggerHome.java
The file LoggerHome.java extends EJBHome . The EJBHome interface must be extended by all EJB component's remote home interfaces. A home interface defines the methods that allow a remote client to create, find, and remove EJB objects, as well as home business methods that are not specific to an EJB instance.
//Code Example 2: LoggerHome.java
package ejbinterop;
import java.rmi.RemoteException;
import javax.ejb.EJBHome;
import javax.ejb.CreateException;
public interface LoggerHome extends EJBHome
Logger create() throws RemoteException, CreateException;
LoggerEJB.java
The file LoggerEJB.java contains the code for a session bean. A session bean is an enterprise bean that is created by a client and that usually exists only for the duration of a single client-server session. A session bean performs operations such as calculations or accessing a database for the client. In this example, the enterprise bean accepts simple String log messages from the client and prints them on the server.
//LoggerEJB.java
package ejbinterop;
import javax.ejb.*;
import java.util.*;
import java.rmi.*;
import java.io.*;
* Accepts simple String log messages and prints
* them on the server.
public class LoggerEJB implements SessionBean {
public LoggerEJB() {}
public void ejbCreate() {}
public void ejbRemove() {}
public void ejbActivate() {}
public void ejbPassivate() {}
public void setSessionContext(SessionContext sc) {}
* Logs the given message on the server with
* the current server time.
public void logString(String message) {
LogMessage msg = new LogMessage(message);
System.out.println(msg);
LogMessage.java
The file LogMessage.java takes the current date and time, creates a formatted String showing the message, and prints the message to the server.
//LogMessage.java
package ejbinterop;
import java.io.Serializable;
import java.util.Date;
import java.text.*;
* Simple message class that handles pretty
* printing of log messages.
public class LogMessage implements Serializable
private String message;
private long datetime;
* Constructor taking the message. This will
* take the current date and time.
public LogMessage(String msg) {
message = msg;
datetime = (new Date()).getTime();
* Creates a formatted String showing the message.
public String toString() {
StringBuffer sbuf = new StringBuffer();
DateFormat dformat
= DateFormat.getDateTimeInstance(DateFormat.MEDIUM,
DateFormat.LONG);
FieldPosition fpos = new
FieldPosition(DateFormat.DATE_FIELD);
dformat.format(new Date(datetime), sbuf, fpos);
sbuf.append(": ");
sbuf.append(message);
return sbuf.toString();
//Code Example: LogClient.java
package ejbinterop;
import java.rmi.RemoteException;
import javax.rmi.*;
import java.io.*;
import javax.naming.*;
import javax.ejb.*;
* Simple Java RMI-IIOP client that uses an EJB component.
public class LogClient
* Given a corbaname URL for a LoggerHome,
* log a simple String message on the server.
public static void run(String loggerHomeURL)
throws CreateException, RemoveException,
RemoteException, NamingException
System.out.println("Looking for: " + loggerHomeURL);
// Create an InitialContext. This will use the
// CosNaming provider we will specify at runtime.
InitialContext ic = new InitialContext();
// Lookup the LoggerHome in the naming context
// pointed to by the corbaname URL
Object homeObj = ic.lookup(loggerHomeURL);
// Perform a safe downcast
LoggerHome home
= (LoggerHome)PortableRemoteObject.narrow(homeObj,
LoggerHome.class);
// Create a Logger EJB reference
Logger logger = home.create();
System.out.println("Logging...");
// Log our message
logger.logString("Message from a Java RMI-IIOP client");
// Tell the application server we won't use this
// EJB reference anymore
logger.remove();
System.out.println("Done");
* Simple main method to check arguments and handle
* exceptions.
public static void main(String args[])
try {
if (args.length != 1) {
System.out.println("Args: corbaname URL of LoggerHome");
System.exit(1);
LogClient.run(args[0]);
} catch (Throwable t) {
t.printStackTrace();
System.exit(1); -
SimpleAgent doesn't show up in JConsole in RMX RMI demo
I am going through the JMX tutorial at http://java.sun.com/developer/technicalArticles/J2SE/jmx.html. The local console works fine but when I try the RMI Connector example, SimpleAgent does not show up in the list of MBeans (only JMImplementation, java.lang, and java.util.logging).
The SimpleAgent class doesn't throw any errors when it tries to register.
Any suggestions?
How do I debug such problems. Is there an RMI log somewhere that can be turned on?Thanks for replying java_dm.
You are right to some extent. I have investigated further and found out that the behaviour is like how you describe it, but only when I implement a corresponding interface, which is required when StandardMBean is being extended. When I don't use an interface, a "get"-method will be available both as attribute and operation, but again, this way I won't be able to customize parameter name, and they will show up as p0, p1, etc.
What is the reason for this behaviour, and how can I expose it both as attribute and operation, which is possible when I don't use it with an interface?
Thanks for answering -
Hello!
I have runned th calculator RMI example in the tutorial.
But it seems to work only when i run both the server and the client on the same machine.
I get this error message when i try to connect the client to the server on a separate machin:
RemoteException
java.rmi.ConnectException: Connection refused to host: 127.0.1.1; nested exception is:
java.net.ConnectException: Connection refused: connect
Does anybody have a short RMI code example that works when connecting the client to the server on a different machine?From lookup.That's one answer to three questions. I wouldn't have asked the other two if I didn't think they were relevant. But if you're getting a connection refused to 127.0.0.1 when doing a lookup(), obviously you are looking up the Registry in 127.0.0.1 instead of the host where the server and registry actually are.
-
Problems with RMI tutorials using Tomcat 4.1.24
Hi
I have some problem when I try the rmi Hello example tutorial (http://java.sun.com/j2se/1.4.2/docs/guide/rmi/getstart.doc.html)
When I start rmi server as follows:
java -Djava.rmi.server.useCodebaseOnly=true -Djava.security.policy=file:E:\Rmi\Hello\mysrc\bin\policy.policy -Djav
a.rmi.server.codebase=http://127.0.0.1/classes/ examples.hello.HelloImpl
I got the following errors:
HelloImpl err: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
at java.security.AccessController.checkPermission(AccessController.java:401)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
at java.lang.SecurityManager.checkConnect(SecurityManager.java:1044)
at java.net.Socket.connect(Socket.java:420)
at java.net.Socket.connect(Socket.java:376)
at java.net.Socket.<init>(Socket.java:291)
at java.net.Socket.<init>(Socket.java:119)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:562)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:313)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
at examples.hello.HelloImpl.main(HelloImpl.java:67)
I have granted all permission in the policy file. I have put all the classes in a subfolder call classes just after the Root directoy Can someone enlighten me. Thanks.i don't know if it helps but i had the following problem:
an rmi-component software plus a servlet contacting the system.
and rmi from the servlet in tomcat did not seem to work ...
java.rmi.MarshalException: error marshalling arguments; nested exception is:
java.net.SocketException: Software caused connection abort: socket write error
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at net.metamagix.essence.Agents.DataAgentI_Stub.storeObjects(Unknown Source)
at net.metamagix.essence.CAgents.ParameterSaviour.save(ParameterSaviour.java:1556)
finaly i changed back to tomcat 4.0.x but it still was not any better, when i found out that most of the problems resulted from pathnames...
tomcat 4.1.24 had a problem with pathnames getting too long (2k on win 2000) and tomcat 4.0 produced errors because of the blank in it's path name "Tomcat 4.0" so i made a new installation with C:\Tomcat4 as home directory and - what a surprise - things turned out fine and rmi worked. -
Hi,
I have a question on using EJB / or RMI servers with CORBA clients using
RMI-IIOP transport, which in theory should work, but in practice has few
glitches.
Basically, I have implemented a very simple server, StockTreader, which
looks up for a symbol and returns a 'Stock' object. In the first example, I
simplified the 'Stock' object to be a mere java.lang.String, so that lookup
would simply return the 'synbol'.
Then I have implemented the above, as an RMI-IIOP server (case 1) and a
CORBA server (case 2) with respective clients, and the pair of
client-servers work fine as long as they are CORBA-to-CORBA and RMI-to-RMI.
But the problem arises when I tried using the RMI server (via IIOP) with the
CORBA client, when the client tries to narrow the object ref obtained from
the naming service into the CORBA idl defined type (StockTrader) it ends up
with a class cast exception.
This is what I did to achieve the above results:
[1] Define an RMI interface StockTrader.java (extending java.rmi.Remote)
with the method,
public String lookup( String symbol) throws RMIException;
[2] Implement the StorckTrader interface (on a PortableRemoteObject derived
class, to make it IIOP compliant), and then the server to register the stock
trader with COS Naming service as follows:
String homeName =....
StockTraderImpl trader =new StockTraderImpl();
System.out.println("binding obj <" homeName ">...");
java.util.Hashtable ht =new java.util.Hashtable();
ht.put("java.naming.factory.initial", args[2]);
ht.put("java.naming.provider.url", args[3]);
Context ctx =new InitialContext(ht);
ctx.rebind(homeName, trader);
[3] Generate the RMI-IIOP skeletons for the Implementation class,
rmic -iiop stock.StockTraderImpl
[4] generate the IDL for the RMI interface,
rmic -idl stock.StockTraderImpl
[5] Generate IDL stubs for the CORBA client,
idlj -v -fclient -emitAll StockTraderImpl.idl
[6] Write the client to use the IDL-defined stock trader,
String serverName =args[0];
String symList =args[1];
StockClient client =new StockClient();
System.out.println("init orb...");
ORB orb =ORB.init(args, null);
System.out.println("resolve init name service...");
org.omg.CORBA.Object objRef
=orb.resolve_initial_references("NameService");
NamingContext naming =NamingContextHelper.narrow(objRef);
... define a naming component etc...
org.omg.CORBA.Object obj =naming.resolve(...);
System.out.println("narrow objRef: " obj.getClass() ": " +obj);
StockTrader trader =StockTraderHelper.narrow(obj);
[7] Compile all the classes using Java 1.2.2
[8] start tnameserv (naming service), then the server to register the RMI
server obj
[9] Run the CORBA client, passing it the COSNaming service ref name (with
which the server obj is registered)
The CORBA client successfully finds the server obj ref in the naming
service, the operation StockTraderHelper.narrow() fails in the segment
below, with a class cast exception:
org.omg.CORBA.Object obj =naming.resolve(...);
StockTrader trader =StockTraderHelper.narrow(obj);
The <obj> returned by naming service turns out to be of the type;
class com.sun.rmi.iiop.CDRInputStream$1
This is of the same type when stock trader object is registered in a CORBA
server (as opposed to an RMI server), but works correctly with no casting
excpetions..
Any ideas / hints very welcome.
thanks in advance,
-hariOn the contrary... all that is being said is that we needed to provide clearer examples/documentation in the 5.1.0 release. There will be no difference between the product as found in the service pack and the product found in the 5.1.1. That is, the only substantive will be that 5.1.1 will also
include the examples.
"<=one way=>" wrote:
With reference to your and other messages, it appears that one should not
expect that WLS RMI-IIOP will work in a complex real-life system, at least
not now. In other words, support for real-life CORBA clients is not an
option in the current release of WLS.
TIA
"Eduardo Ceballos" <[email protected]> wrote in message
news:[email protected]...
We currently publish an IDL example, even though the IDL programmingmodel in Java is completely non-functional, in anticipation of the support
needs for uses who need to use IDL to talk to the Weblogic server,
generically. This example illustrates the simplest connectivity; it does not
address how
to integrate CORBA and EJB, a broad topic, fraught with peril, imo. I'llnote in passing that, to my knowledge, none of the other vendors attempt
this topic either, a point which is telling if all the less happy to hear.
For the record then, what is missing from our distribution wrt RMI-IIOPare a RMI-IIOP example, an EJB-IIOP example, an EJB-C++. In this you are
correct; better examples are forth coming.
Still, I would not call our RMI-IIOP implementation fragile. I would saythat customers have an understandably hard time accepting that the IDL
programming model is busted; busted in the sense that there are no C++
libraries to support the EJB model, and busted in the sense that there is
simply no
support in Java for an IDL interface to an EJB. Weblogic has nothing to doit being busted, although we are trying to help our customers deal with it
in productive ways.
For the moment, what there is is a RMI (over IIOP) programming model, aninherently Java to Java programming model, and true to that, we accept and
dispatch IIOP request into RMI server objects. The way I look at it is this:
it's just a protocol, like HTTP, or JRMP; it's not IDL and it has
practically nothing to do with CORBA.
ST wrote:
Eduardo,
Can you give us more details about the comment below:
I fear that as soon as the call to narrow succeeds, the remainingapplication will fail to work correctly because it is too difficult ot
use an idl client in java to work.It seems to me that Weblogic's RMI-IIOP is a very fragile
implementation. We
don't need a "HelloWorld" example, we need a concrete serious example(fully
tested and seriously documented) that works so that we can get a betteridea
on how to integrate CORBA and EJB.
Thanks,
Said
"Eduardo Ceballos" <[email protected]> wrote in message
news:[email protected]...
Please post request to the news group...
As I said, you must separate the idl related classes (class files and
java
files) from the rmi classes... in the rmic step, you must set a newtarget
(as you did), emit the java files into that directory (it's not clearyou
did this), then remove all the rmi class files from the class path... ifyou
need to compile more classes at that point, copy the java files to theidl
directly is you must, but you can not share the types in any way.
I fear that as soon as the call to narrow succeeds, the remainingapplication will fail to work correctly because it is too difficult otuse
an idl client in java to work.
Harindra Rajapakshe wrote:
Hi Eduardo,
Thanks for the help. That is the way I compiled my CORBA client, by
separating the IDL-generated stubs from the RMI ones, but still I
get a
CORBA.BAD_PARAM upon narrowing the client proxy to the interfacetype.
Here's what I did;
+ Define the RMI interfaces, in this case a StockTrader interface.
+ Implement RMI interface by extendingjavax.rmi.PortableRemoteObject
making
it IIOP compliant
+ Implemnnt an RMI server, and compile using JDK1.2.2
+ use the RMI implementation to generate CORBA idl, using RMI-IIOPplugin
utility rmic;
rmic -idl -noValueMethods -always -d idl stock.StockTraderImpl
+ generate Java mappings to the IDL generated above, using RMI-IIOPplugin
util,
idlj -v -fclient -emitAll -tf src stocks\StockTrader.idl
This creates source for the package stock and also
org.omg.CORBA.*
package, presumably IIOP type marshalling
+ compile all classes generated above using JDK1.2.2
+ Implement client (CORBA) using the classes generated above, NOTthe
RMI
proxies.
+ start RMI server, with stockTrader server obj
+ start tnameserv
+ start CORBA client
Then the client errors when trying to narrow the obj ref from the
naming
service, into the CORBA IDL defined interface using,
org.omg.CORBA.Object obj =naming.resolve(nn);
StockTrader trader =StockTraderHelper.narrow(obj); // THIS
ERRORS..!!!
throwing a CORBA.BAD_PARAM exception.
any ideas..?
Thanks in advance,
-hari
----- Original Message -----
From: Eduardo Ceballos <[email protected]>
Newsgroups: weblogic.developer.interest.rmi-iiop
To: Hari Rajapakshe <[email protected]>
Sent: Wednesday, July 26, 2000 4:38 AM
Subject: Re: problem using CORBA clients with RMI/EJBservers..!!!???
Please see the post on june 26, re Errors compiling... somewherein
there,
I suspect, you are referring to the rmi class file when you are
obliged
to
completely segregate these from the idl class files.
Hari Rajapakshe wrote:
Hi,
I have a question on using EJB / or RMI servers with CORBA
clients
using
RMI-IIOP transport, which in theory should work, but in practice
has
few
glitches.
Basically, I have implemented a very simple server,
StockTreader,
which
looks up for a symbol and returns a 'Stock' object. In the firstexample, I
simplified the 'Stock' object to be a mere java.lang.String, so
that
lookup
would simply return the 'synbol'.
Then I have implemented the above, as an RMI-IIOP server (case
1)
and a
CORBA server (case 2) with respective clients, and the pair of
client-servers work fine as long as they are CORBA-to-CORBA andRMI-to-RMI.
But the problem arises when I tried using the RMI server (via
IIOP)
with
the
CORBA client, when the client tries to narrow the object ref
obtained
from
the naming service into the CORBA idl defined type (StockTrader)
it
ends
up
with a class cast exception.
This is what I did to achieve the above results:
[1] Define an RMI interface StockTrader.java (extending
java.rmi.Remote)
with the method,
public String lookup( String symbol) throws RMIException;
[2] Implement the StorckTrader interface (on a
PortableRemoteObject
derived
class, to make it IIOP compliant), and then the server to
register
the
stock
trader with COS Naming service as follows:
String homeName =....
StockTraderImpl trader =new StockTraderImpl();
System.out.println("binding obj <" homeName ">...");
java.util.Hashtable ht =new java.util.Hashtable();
ht.put("java.naming.factory.initial", args[2]);
ht.put("java.naming.provider.url", args[3]);
Context ctx =new InitialContext(ht);
ctx.rebind(homeName, trader);
[3] Generate the RMI-IIOP skeletons for the Implementation
class,
rmic -iiop stock.StockTraderImpl
[4] generate the IDL for the RMI interface,
rmic -idl stock.StockTraderImpl
[5] Generate IDL stubs for the CORBA client,
idlj -v -fclient -emitAll StockTraderImpl.idl
[6] Write the client to use the IDL-defined stock trader,
String serverName =args[0];
String symList =args[1];
StockClient client =new StockClient();
System.out.println("init orb...");
ORB orb =ORB.init(args, null);
System.out.println("resolve init name service...");
org.omg.CORBA.Object objRef
=orb.resolve_initial_references("NameService");
NamingContext naming=NamingContextHelper.narrow(objRef);
... define a naming component etc...
org.omg.CORBA.Object obj =naming.resolve(...);
System.out.println("narrow objRef: " obj.getClass() ":"
+obj);
StockTrader trader =StockTraderHelper.narrow(obj);
[7] Compile all the classes using Java 1.2.2
[8] start tnameserv (naming service), then the server to
register
the
RMI
server obj
[9] Run the CORBA client, passing it the COSNaming service ref
name
(with
which the server obj is registered)
The CORBA client successfully finds the server obj ref in the
naming
service, the operation StockTraderHelper.narrow() fails in thesegment
below, with a class cast exception:
org.omg.CORBA.Object obj =naming.resolve(...);
StockTrader trader =StockTraderHelper.narrow(obj);
The <obj> returned by naming service turns out to be of the
type;
class com.sun.rmi.iiop.CDRInputStream$1
This is of the same type when stock trader object is registeredin a
CORBA
server (as opposed to an RMI server), but works correctly with
no
casting
excpetions..
Any ideas / hints very welcome.
thanks in advance,
-hari -
I got the rmi-iiop example code to work just fine, but I tried extending
it a little and strangeness ensues. Here's what I did:
I'm using a stock weblogic 6.0 install on solaris 8 (sparc). I added
the following new method to the Trader interface:
public void func(javax.naming.Name n) throws RemoteException;
and I added the implementation of that method to TraderBean like so:
public void func(javax.naming.Name n) {
System.out.prinltn("n [" + n + "]");
I then added a call to the new Trader function to the end of the
example() method in Client, just before the trader is removed:
try {
com.sun.jndi.ldap.LdapName lname =
new com.sun.jndi.ldap.LdapName("a=b");
trader.func(lname);
} catch (javax.naming.NamingException ne) {
ne.printStackTrace();
Then I compiled everything using the supplied build.sh, copied the
ejb_over_iiop.jar into config/mydomain/applications, and ran
startWebLogic.sh int the config/mydomain directory to start the server.
I then run the client like so (using the 1.3 java version included with
weblogic 6.0):
java -cp
/opt/bea/wlserver6.0/config/examples/clientclasses:/opt/bea/wlserver6.0/config/mydomain/applications:/opt/bea/wlserver6.0/lib/weblogic.jar
examples.rmi_iiop.ejb.rmi_iiop.Client iiop://localhost:7001
And I get the following output:
Beginning statelessSession.Client...
Creating a trader
Buying 100 shares of BEAS.
Buying 200 shares of MSFT.
Buying 300 shares of AMZN.
Buying 400 shares of HWP.
Selling 100 shares of BEAS.
Selling 200 shares of MSFT.
Selling 300 shares of AMZN.
Selling 400 shares of HWP.
There was an exception while creating and using the Trader.
This indicates that there was a problem communicating with the server:
java.rmi.RemoteException: CORBA UNKNOWN 0 No; nested exception is:
org.omg.CORBA.UNKNOWN: minor code: 0 completed: No
End statelessSession.Client...
Basically the call to the new method fails, and the server communication
error it produces doesn't provide much information. So question #1 is,
what's going on here?
And here's the really weird part: if I change the method signatures in
Trader and TraderBean so that the argument type is the concrete class
com.sun.jndi.ldap.LdapName instead of the interface javax.naming.Name
(which does extend java.io.Serializable, incidentally), it works fine!
I tried this with my own interfaces and concrete classes, and I get the
same strange behavior: calling methods with interface argument types on
the ejb via rmi-iiop fails with the above cryptic error, but methods
with concrete argument types work fine.
I also tried this out on a non-ejb rmi-iiop server object using jdk 1.3
but not weblogic. In that case both interfaces and concrete method
argument types work just fine.
Now I'm wondering if this could be a bug in weblogic.ejbc's iiop
generation. Can anyone else verify this problem?
Edwin Park
[email protected]Comments in line...
Edwin Park wrote:
I got the rmi-iiop example code to work just fine, but I tried extending
it a little and strangeness ensues. Here's what I did:
I'm using a stock weblogic 6.0 install on solaris 8 (sparc). I added
the following new method to the Trader interface:
public void func(javax.naming.Name n) throws RemoteException;
and I added the implementation of that method to TraderBean like so:
public void func(javax.naming.Name n) {
System.out.prinltn("n [" + n + "]");
I then added a call to the new Trader function to the end of the
example() method in Client, just before the trader is removed:
try {
com.sun.jndi.ldap.LdapName lname =
new com.sun.jndi.ldap.LdapName("a=b");
trader.func(lname);
} catch (javax.naming.NamingException ne) {
ne.printStackTrace();
Then I compiled everything using the supplied build.sh, copied the
ejb_over_iiop.jar into config/mydomain/applications, and ran
startWebLogic.sh int the config/mydomain directory to start the server.
I then run the client like so (using the 1.3 java version included with
weblogic 6.0):
java -cp
/opt/bea/wlserver6.0/config/examples/clientclasses:/opt/bea/wlserver6.0/config/mydomain/applications:/opt/bea/wlserver6.0/lib/weblogic.jar
examples.rmi_iiop.ejb.rmi_iiop.Client iiop://localhost:7001
And I get the following output:
Beginning statelessSession.Client...
Creating a trader
Buying 100 shares of BEAS.
Buying 200 shares of MSFT.
Buying 300 shares of AMZN.
Buying 400 shares of HWP.
Selling 100 shares of BEAS.
Selling 200 shares of MSFT.
Selling 300 shares of AMZN.
Selling 400 shares of HWP.
There was an exception while creating and using the Trader.
This indicates that there was a problem communicating with the server:
java.rmi.RemoteException: CORBA UNKNOWN 0 No; nested exception is:
org.omg.CORBA.UNKNOWN: minor code: 0 completed: No
End statelessSession.Client...
Basically the call to the new method fails, and the server communication
error it produces doesn't provide much information. So question #1 is,
what's going on here?
Marshaling through the interface apparently fails. What orb are you using on the client?
>
And here's the really weird part: if I change the method signatures in
Trader and TraderBean so that the argument type is the concrete class
com.sun.jndi.ldap.LdapName instead of the interface javax.naming.Name
(which does extend java.io.Serializable, incidentally), it works fine!It appears that marshaling an interface (or abstract class) fails, but marshaling a concrete class succeeds.
>
>
I tried this with my own interfaces and concrete classes, and I get the
same strange behavior: calling methods with interface argument types on
the ejb via rmi-iiop fails with the above cryptic error, but methods
with concrete argument types work fine.
I also tried this out on a non-ejb rmi-iiop server object using jdk 1.3
but not weblogic. In that case both interfaces and concrete method
argument types work just fine.
Now I'm wondering if this could be a bug in weblogic.ejbc's iiop
generation. Can anyone else verify this problem?I'll look into this.
>
>
Edwin Park
[email protected] -
JavaFX JavaScript bridge on Snow Leopard
Hello,
Installed Snow Leopard and tested the javafx/js bridge example at: http://javafx.com/docs/articles/dice/.
It loads fine, but when i click any of those Set D1/D2/Both buttons, I get a "http://javafx.com exception occured" dialog. There are no exceptions on the java console per se. When I enabled applet life cycle errors logging, i did see one exception at load time (see below).
I have tried both the 32-bit and the 64-bit versions (through the java preferences UI on snow leopard) for java-plugins but don't see any difference. The platform version is 1.6.0_15 (if i am not wrong), and the bridge requires only 0_10 to work.
Please let me know if you are able to roll the dice fine enough and how..
thanx,
;-p r a b u!
network: Connecting socket://dl.javafx.com:80 with proxy=DIRECT
network: Connecting http://dl.javafx.com/emptyJarFile-1252659334740__V1.2.1_b28.jar with cookie "gpChannel=javafx%3Adocs%3Aarticles%3Adice; gpName=javafx%3A/docs/articles/dice/; gpServer=javafx.com; s_cc=true; s_sq=%5B%5BB%5D%5D"
network: CleanupThread used 1 us
network: Downloading resource: http://dl.javafx.com/emptyJarFile-1252659334740__V1.2.1_b28.jar
Content-Length: 22
Content-Encoding: null
network: Wrote URL http://dl.javafx.com/emptyJarFile-1252659334740__V1.2.1_b28.jar to File /Users/prabu/Library/Caches/Java/cache/6.0/1/724dd901-27f87184-temp
java.util.zip.ZipException: ZIP file must have at least one entry
at java.util.zip.ZipOutputStream.finish(ZipOutputStream.java:304)
at java.util.zip.DeflaterOutputStream.close(DeflaterOutputStream.java:146)
at java.util.zip.ZipOutputStream.close(ZipOutputStream.java:321)
at com.sun.deploy.net.HttpDownloadHelper.download(HttpDownloadHelper.java:224)
at com.sun.deploy.cache.Cache$1.run(Cache.java:414)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.cache.Cache.downloadResourceToCache(Cache.java:393)On the Dice example page, I see this warning:
Note: JRE6u10 software ships with two versions of the Java Plug-In software (classic and next generation). The applet in this page requires functionality only available in the "next generation" version.
It then says that Mac users doesn't have yet the next version. I'm not sure if this still applies, but I'm having the same problem for both the example apps and my own apps.
--Cameron
Maybe you are looking for
-
After installing 8.01, I logged into My.MSN.com web page and my e-mail messages no longer dropped down into my Hotmail menu. I believe Firefox said 8.01 no longer supports this capability. I therefore did a system restore to go back to 3.6.24. How ca
-
IChat suddenly has insuffient bandwidth?
I've been using iChat for a month with my TiPB 867. No problems until recently. I use a Verizon Wireless aircard (Kyocera). My surfing speed runs at least 256 and as high as 1gig. But when iChat kicks in (as of a week ago), it drops below 20. Obvious
-
Hi i've just bought a ipod, however at present i do not have an internet connection. when i recieved my ipod there was no cd to install itunes onto my computer. Is there any way i can get the new itunes on disk? Or download it from the internet on to
-
IPhoto - 6 (rename film roll)
Is there a way to rename the film rolls in iPhoto? If so how?
-
How do you turn on NFS and RPC error logging?
I'm trying ot find NFS and RPC errors. Di I need to turn error logging on for those calls? Where would/should they show up?