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.
Similar Messages
-
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 -
[att1.html]
I've been fighting the same issues over the past few days. The answer you gave still left me
wondering which tool to use. Should it be rmi -iiop or ejbc -iiop? I get the idl files on
WLS 5.1 generated but then I can't get the idlj to execute properly on the generated
HelloHome.idl and Hello.idl.
Wayne
Andy Piper wrote:
Abhishek <[email protected]> writes:
But How do I write Rmi - iiop clients for EJBs.
when I try to generate the IDL for my EJB by running the weblogic.rmic utility I get an
error that none of my classes ( Remote, Home and Impl ) implement the remote
interface. Which is true as EJBs do not directly implement the remote interface.You may be able to get this to work with WLS6.0SP1 and the
-idlMethodSignatures flag. Take a look at the methods target in
examples/rmi_iiop/ejb/generic_idl or at
examples/rmi_iiop/ejb/simplified_idl. This all works fine in
Silversword.
andy -
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 -
Examples for JAVA ME in Blu Ray
Are there any code examples for using Java in Blu-Ray DVD players?
For CS4 you must update the Roxio component http://forums.adobe.com/thread/400484?
More on Encore and Roxio http://forums.adobe.com/thread/528582?tstart=0 or direct to
http://kb.roxio.com/search.aspx?URL=/content/kb/General%20Information/000070GN&PARAMS
Also, Run as Administrator http://forums.adobe.com/thread/771202?tstart=0
tstart=0 -
Cannot deploy the Bookstore Example for Java EE tutorials
I also have the same issue as another user on a different thread, and I did check my build.properties and it appears accurate. However I am still getting the exception when I try to run the 'ant create-tables' or 'ant deploy' :
Buildfile: build.xml
-pre-init:
init:
check:
tools:
start-db:
[exec] Database already started on host localhost, port 1527.
[exec] Command start-database executed successfully.
delete-tables:
[sql] Executing file: C:\tutorial\javaeetutorial\examples\web\bookstore1\${db.delete.src}
BUILD FAILED
C:\tutorial\javaeetutorial5\examples\bp-project\database-ant.xml:48:java.io.FileNotFoundException: C:\tutorial\javaeetutorial\examples\web\bookstore1\${db.delete.src} (The system cannot find the file specified)
Total time: 7 seconds
The Build.Properties file in my [install]/examples/bp-projects/ directory is a follows
javaee.home=C:/Sun/AppServer
javaee.tutorial.home = c:/tutorial/javaeetutorial5
javaee.server.name=localhost
javaee.server.port=10000
javaee.adminserver.port=4848
javaee.server.username=admin
javaee.server.passwordfile=c:/tutorial/javaeetutorial5/password.txt
appserver.instance=server
I was able to compile the first Hello tutorial with Ant, so I am assuming that means the above build.properties file should be correct (or else that deployment would have failed too, right?). I also created the JDBC connection in the System Admin Console before trying this, as per the tutorial text.
Since I'm new to the environment, I'm not sure where else to look for the problem.Ok, I did an 'ant deploy' at the books directory. It seems to be going well and then just hung for minutes at the following line...
check:
tools:
-pre-deploy:
-pre-init:
init:
check:
tools:
start-db:
[exec] Database started in Network Server mode on host localhost and port 1
527.
[exec] --------- Derby Network Server Information --------
[exec] Version: CSS10011/10.1.1.0 Build: 208786 DRDA Product Id: CSS10011
[exec] -- listing properties --
[exec] derby.drda.maxThreads=0
[exec] derby.drda.keepAlive=true
[exec] derby.drda.minThreads=0
[exec] derby.drda.portNumber=1527
[exec] derby.drda.logConnections=false
[exec] derby.drda.timeSlice=0
[exec] derby.drda.startNetworkServer=false
[exec] derby.drda.host=localhost
[exec] derby.drda.traceAll=false
[exec] ------------------ Java Information ------------------
[exec] Java Version: 1.5.0_06
[exec] Java Vendor: Sun Microsystems Inc.
[exec] Java home: C:\Sun\AppServer\jdk\jre
[exec] Java classpath: C:\Sun\AppServer\lib\appserv-rt.jar;C:\Sun\AppServe
r\lib\admin-cli.jar;C:\Sun\AppServer\javadb\lib\derby.jar;C:\Sun\AppServer\javad
b\lib\derbytools.jar;C:\Sun\AppServer\javadb\lib\derbynet.jar;C:\Sun\AppServer\j
avadb\lib\derbyclient.jar
[exec] OS name: Windows XP
[exec] OS architecture: x86
[exec] OS version: 5.1
[exec] Java user name: Russell Longo
[exec] Java user home: C:\Documents and Settings\Russell Longo
[exec] Java user dir: C:\Sun\AppServer
[exec] java.specification.name: Java Platform API Specification
[exec] java.specification.version: 1.5
[exec] --------- Derby Information --------
[exec] JRE - JDBC: J2SE 5.0 - JDBC 3.0
[exec] [C:\Sun\AppServer\javadb\lib\derby.jar] 10.1.1.0 - (208786)
[exec] [C:\Sun\AppServer\javadb\lib\derbytools.jar] 10.1.1.0 - (208786)
[exec] [C:\Sun\AppServer\javadb\lib\derbynet.jar] 10.1.1.0 - (208786)
[exec] [C:\Sun\AppServer\javadb\lib\derbyclient.jar] 10.1.1.0 - (208786)
[exec] ------------------------------------------------------
[exec] ----------------- Locale Information -----------------
[exec] ------------------------------------------------------
[exec] Starting database in the background. Log redirected to C:/Sun/AppSe
rver/javadb\derby.log.
[exec] Command start-database executed successfully.
I hit a Ctrl-C and it asked if I wanted to end the batch. I replied 'n' but it dropped out to the command line.
So I tried the ant deploy again and got the following...
check:
tools:
-pre-deploy:
-pre-init:
init:
check:
tools:
start-db:
[exec] Database already started on host localhost, port 1527.
[exec] Command start-database executed successfully.
delete-tables:
[sql] Executing file: C:\tutorial\javaeetutorial5\examples\web\books\${db.
delete.src}
BUILD FAILED
C:\tutorial\javaeetutorial5\examples\web\books\build.xml:51: The following error
occurred while executing this line:
C:\tutorial\javaeetutorial5\examples\bp-project\database-ant.xml:48: java.io.Fil
eNotFoundException: C:\tutorial\javaeetutorial5\examples\web\books\${db.delete.s
rc} (The system cannot find the file specified)
I finally went to the bookstore directory to see if I could deploy that application. Ant deploy gave the following:
check:
tools:
-pre-deploy:
-pre-init:
init:
check:
tools:
start-db:
[exec] Database already started on host localhost, port 1527.
[exec] Command start-database executed successfully.
delete-tables:
[sql] Executing file: C:\tutorial\javaeetutorial5\examples\web\books\${db.
delete.src}
BUILD FAILED
C:\tutorial\javaeetutorial5\examples\web\books\build.xml:51: The following error
occurred while executing this line:
C:\tutorial\javaeetutorial5\examples\bp-project\database-ant.xml:48: java.io.Fil
eNotFoundException: C:\tutorial\javaeetutorial5\examples\web\books\${db.delete.s
rc} (The system cannot find the file specified)
Last, I went to bookstore1 just to try the ant deploy again, see if things were cleared up, and maybe the errors above wouldn't affect it. When I tried deploying I got the following...
check:
tools:
-pre-deploy:
-pre-init:
init:
check:
tools:
start-db:
[exec] Database already started on host localhost, port 1527.
[exec] Command start-database executed successfully.
delete-tables:
[sql] Executing file: C:\tutorial\javaeetutorial5\examples\web\books\${db.
delete.src}
BUILD FAILED
C:\tutorial\javaeetutorial5\examples\web\books\build.xml:51: The following error
occurred while executing this line:
C:\tutorial\javaeetutorial5\examples\bp-project\database-ant.xml:48: java.io.Fil
eNotFoundException: C:\tutorial\javaeetutorial5\examples\web\books\${db.delete.s
rc} (The system cannot find the file specified)
I'm clearly not 'getting' a handle on this environment. -
Hi,
can someone please tell me what a java bean is and show me a very basic example using a java bean.
Thanks in advance for any replies
Jim.When ever I have questions like this "Tutorial" just screams though my mind, take a look, it is exactly what you want:
http://java.sun.com/developer/onlineTraining/Beans/ -
Hi -
I'm working to modify a C program (gnuplot) so that it can remotely call functions in Java.
My current plan is to use RMI-IIOP on the Java side. I'd like to create a class that implements java.rmi.Remote via some local implementation class, instantiate it, then obtain a stringified IOR for that object and pass it to gnuplot, which can then use the IOR to call remote methods.
Also, I'm planning to use CORBA DII on the client side, since I want a generic program where the remote method names can be set by user options at run time.
Does this make sense? I'm working with this tutorial code:
http://java.sun.com/j2se/1.5.0/docs/guide/rmi-iiop/tutorial.html
and am stuck on obtaining an IOR in the server code.
Any help would be appreciated...Well, I figured it out. The key method is remoteToCorba in com.sun.jndi.toolkit.corba.CorbaUtils. Here's my server code:
//HelloServer.java
import java.io.*;
import org.omg.CORBA.ORB;
import com.sun.jndi.toolkit.corba.CorbaUtils;
public class HelloServer {
public static void main(String[] args) {
try {
// Step 1: Instantiate the Hello servant
HelloImpl helloRef = new HelloImpl();
// Step 2: Initialize the ORB
ORB orb = ORB.init(args, null);
// Step 3: Convert the Hello servant to a CORBA object
org.omg.CORBA.Object corba_obj;
corba_obj = CorbaUtils.remoteToCorba(helloRef, orb);
// Step 4a: Announce the IOR to STDOUT
String ior = orb.object_to_string(corba_obj);
System.out.println("IOR: " + ior);
// Step 4b: Announce the IOR to a file
FileWriter fw = new FileWriter("hello.ior");
fw.write(ior);
fw.close();
System.out.println("Hello Server: Ready...");
} catch (Exception e) {
System.out.println("Trouble: " + e);
e.printStackTrace();
}And here's the matching client code:
//HelloClient.java
import java.io.*;
import org.omg.CORBA.ORB;
import javax.rmi.PortableRemoteObject;
public class HelloClient {
public static void main( String args[] ) {
HelloInterface hi;
try {
// Step 1: Initialize the ORB
ORB orb = ORB.init(args, null);
// Step 2: Obtain the stringified IOR from a file
FileReader fr = new FileReader("hello.ior");
BufferedReader br = new BufferedReader(fr);
String ior = br.readLine();
// Step 3: Convert the IOR to a CORBA object reference
org.omg.CORBA.Object objref = orb.string_to_object(ior);
// Step 4: Narrow the CORBA object reference to the concrete type
hi = (HelloInterface) PortableRemoteObject.narrow(
objref, HelloInterface.class);
// Step 5: Invoke the method.
hi.sayHello( " MARS " );
} catch( Exception e ) {
System.err.println( "Exception " + e + "Caught" );
e.printStackTrace( );
return;
}The other two files are unchanged from the original example:
//HelloInterface.java
import java.rmi.Remote;
public interface HelloInterface extends java.rmi.Remote {
public void sayHello( String from ) throws java.rmi.RemoteException;
//HelloImpl.java
import javax.rmi.PortableRemoteObject;
public class HelloImpl extends PortableRemoteObject implements HelloInterface {
public HelloImpl() throws java.rmi.RemoteException {
super(); // invoke rmi linking and remote object initialization
public void sayHello( String from ) throws java.rmi.RemoteException {
System.out.println( "Hello from " + from + "!!" );
System.out.flush();
}Compilation and usage is straightforward:
javac *.java
rmic -iiop HelloImpl
java -cp . HelloServer
java -cp . HelloClientIt gives warnings about using a Sun proprietary interface, but that's the only problem that I've had with the Java end. Getting the C end working has been more challenging. ORBit seems to have some serious interoperability problems. I haven't gotten it working yet with Java. -
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); -
Build process for ejb iiop example
Hello and thank you in advance,
I'm trying to build the examples under iiop examples for WL6.1 (Win NT), and the
'ant' build xml file contains a tag line <createidl ... which causes the build
to fail. I've been unable to find anything on this tag.
Am I supposed to replace this line with some other code? If so, then can anyone
help with the code.
Thanks!
SeanC:\bea\wlserver6.1\lib>dir weblogic.jar
Volume in drive C is Main
Volume Serial Number is 10C7-F019
Directory of C:\bea\wlserver6.1\lib
10/22/2001 09:26p 25,158,674 weblogic.jar
1 File(s) 25,158,674 bytes
0 Dir(s) 5,713,345,024 bytes free
C:\bea\wlserver6.1\lib>jar tvf weblogic.jar | grep taskdefs | grep iiop
0 Tue Sep 18 14:43:22 CDT 2001 weblogic/ant/taskdefs/iiop/
1738 Tue Sep 18 14:43:22 CDT 2001 weblogic/ant/taskdefs/iiop/CppIdlSetup.class
Hope this helps,
Robert
Sean Cloutier wrote:
Thank you for the reply Andy, however I'm unable to find the 'iiop' package under
the taskdefs package. I'm looking in the weblogic.jar file included with WLS6.1
(WinNT) service pack 1.
Is it possible that this is somewhere other than the weblogic.jar file? If so,
then where?
thanks again,
Sean
Andy Piper <[email protected]> wrote:
"Sean Cloutier" <[email protected]> writes:
I think it should be
weblogic.ant.taskdefs.iiop.CppIdlSetup
andy
Andy Piper <[email protected]> wrote:
Robert Patrick <[email protected]> writes:
Of course Andy really meant to say weblogic.jar since there is no
weblogicaux.jar
file
in WLS 6.xOf course I did ;-)
andy
--Ok, I guess I'm a little confused now. You say task, which I'm assumingyou mean
would be in the taskdef package of 'ant' which is included in the weblogic.jar
file. I looked through the weblogic.jar file and never found any'task' which
is called 'createidl'.
I'm I confused or missing something?
Thanks again for your help!
Sean -
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] -
Losing RMI-IIOP connection at server end
Hi all
I have a system running on Solaris 9, JVM 1.4.2_06 with a webapp hosted in Tomcat 5.5 connecting over RMI-IIOP to another java service on the same machine. The connection is established at webapp initialisation via a lookup to the naming service (currently tnameserv).
Unfortunately, after a period of time (varies between a few hours and a couple of days), the RMI connection simply disappears from the server-side point of view, and the webapp grinds to a halt. Taking a thread dump of Tomcat and the service at the point of failure shows that Tomcat still has "JavaIDL Reader" threads listening to the service, but the service has lost all of its "JavaIDL Reader" threads listening to Tomcat.
I've traced the problem as far as line 518 of com.sun.corba.se.internal.iiop.messages.MessageBase:
bytecount = is.read(buf, offset + n, size - n);This read on the InputStream is throwing an IOException. I have configured the system so that IP address 127.0.0.1 is being used in all places.
It may well be that this is not the right forum for this question, but has anyone else ever come across a problem like this? All suggestions most welcome.
Regards
BrianIn trying to find an answer to your question, have actually discovered that the root cause of the issue is actually a little lower in the stack.
SocketInputStream.read(byte[],int,int) is returning -1 (EOF), and this is being interpretted into an IOException by the MessageBase class. So now I need to work out why this unexpected EOF may be occurring on this platform.
I imagine this is no longer very relevant to the RMI forum. I've posted on the Socket Programming forum.
Regards
Brian -
Classcastexception with rmi-iiop
Hi,
I try the rmi-iiop example in examples/rmi_iiop/hello using Sun's JDK 1.3rc1 on Linux. I use weblogic.rmic to generate an IDL file from HelloImpl.class. Next, I use idlj (comes with the JDK) to generate those help .java files from IDL. Then, I compile these files and HelloClient.java. I start Weblogic(SP6) and launch HelloClient using the command,
java examples.rmi_iiop.hello.HelloClient {long IOR number string}
Weblogic server throws this exception when the client make a contact,
Sun Dec 17 16:52:33 GMT+08:00 2000:<I> <WebLogicServer> WebLogic Server started
Sun Dec 17 16:52:40 GMT+08:00 2000:<I> <ListenThread> Adding address: localhost/127.0.0.1 to licensed client list
Sun Dec 17 16:52:40 GMT+08:00 2000:<E> <Adapter> Exception thrown by rmi server: [-8596339638698095515S127.0.0.1:[7001,7001,7002,7002,7001,-1]/8]
java.lang.ClassCastException: examples.rmi_iiop.hello.HelloImpl
at weblogic.cos.naming.NamingContextImpl.resolve(NamingContextImpl.java:138)
at weblogic.cos.naming.NamingContext_WLSkel.invoke(NamingContext_WLSkel.java:53)
at weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(BasicServerObjectAdapter.java:347)
at weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicRequestHandler.java:69)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:15)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:135)
Why there is a ClassCastException? If there a compatiblity problem with idlj that comes with the JDK? Please advise.Generally, this is a classpath problem. You must ensure that the classes that are produced by jidl are not in the WLS classpath; similarly, the RMI interfaces must not be visible to the java CORBA client.
IMO, a java CORBA client is not a viable development platform.
TH Lim wrote:
Hi,
I try the rmi-iiop example in examples/rmi_iiop/hello using Sun's JDK 1.3rc1 on Linux. I use weblogic.rmic to generate an IDL file from HelloImpl.class. Next, I use idlj (comes with the JDK) to generate those help .java files from IDL. Then, I compile these files and HelloClient.java. I start Weblogic(SP6) and launch HelloClient using the command,
java examples.rmi_iiop.hello.HelloClient {long IOR number string}
Weblogic server throws this exception when the client make a contact,
Sun Dec 17 16:52:33 GMT+08:00 2000:<I> <WebLogicServer> WebLogic Server started
Sun Dec 17 16:52:40 GMT+08:00 2000:<I> <ListenThread> Adding address: localhost/127.0.0.1 to licensed client list
Sun Dec 17 16:52:40 GMT+08:00 2000:<E> <Adapter> Exception thrown by rmi server: [-8596339638698095515S127.0.0.1:[7001,7001,7002,7002,7001,-1]/8]
java.lang.ClassCastException: examples.rmi_iiop.hello.HelloImpl
at weblogic.cos.naming.NamingContextImpl.resolve(NamingContextImpl.java:138)
at weblogic.cos.naming.NamingContext_WLSkel.invoke(NamingContext_WLSkel.java:53)
at weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(BasicServerObjectAdapter.java:347)
at weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicRequestHandler.java:69)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:15)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:135)
Why there is a ClassCastException? If there a compatiblity problem with idlj that comes with the JDK? Please advise. -
RMI/IIOP HelloWorld problem
I saw this topic in an old thread but couldn't find the answer. My
problem was the same, the client app was stuck at the line
obj = nc.resolve(path);
Could you post your solution if you know the answer to this problem.
Thanks a lot.Yes, you are right. I'm currently using jdk1.3. Is there a fix or do I
have to go back to jdk1.2? Thanks a lot.
Regards,
Eduardo Ceballos wrote:
You must run under jdk 1.3.
Jim Hurd wrote:
I did not see the line
Thu Aug 03 11:33:52 PDT 2000:<I> <WebLogicServer> IIOP subsystem
enabled.
I think that was the problem. How do I fix that?
Thank you very much.
Eduardo Ceballos wrote:
I tried every combination of hostname/ip address I could think of,
but I don't see that problem... could you confirm that the WLS log
listen thread entry is... should be something like:
Thu Aug 03 11:34:06 PDT 2000:<I> <ListenThread> Listening on port:
7001
Also, does the first line of your log say:
Thu Aug 03 11:33:52 PDT 2000:<I> <WebLogicServer> IIOP subsystem
enabled.
Jim Hurd wrote:
Hi Eduardo,
I tried the rmi-iiop client SimpleHelloClient example that you
posted (with hostname and port modified according to my setup)
and I got this error while trying to get the InitialContext (at
line Context ic = new InitialContext(env);
Exception in thread "main" javax.naming.CommunicationException:
Cannot connect to ORB. Root exception is
org.omg.CORBA.COMM_FAILURE: minor code: 1 completed:
Maybe
at
com.sun.corba.se.internal.iiop.IIOPConnection.purge_calls(Unknown
Source)
at
com.sun.corba.se.internal.iiop.ReaderThread.run(Unknown Source)
Here is my setup
env.put("java.naming.factory.initial","com.sun.jndi.cosnaming.CNCtxFactory");
env.put("java.naming.provider.url", "iiop://127.0.0.1:7001");
Context ic = new InitialContext(env);
Thanks a lot
Eduardo Ceballos wrote:
Here's the html version.. maybe clearer
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 pickingup 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.
\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.
\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.
\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.
\jre\lib\rt.jar(org/omg/CosNaming/NameComponent.class)]
[loading
D:\jdk1.
\jre\lib\rt.jar(org/omg/CosNaming/NamingContextHelper.class)]
[loading
D:\jdk1.
\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.
\jre\lib\rt.jar(org/omg/CORBA/portable/InputStream.class)]
[loading
D:\jdk1.
\jre\lib\rt.jar(org/omg/CORBA/portable/OutputStream.class)]
[loading
D:\jdk1.
\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
[att1.html] -
ClassCastException for RMI-IIOP client hitting CORBA server
I am writing a RMI-IIOP client to connect to an existing CORBA C++ server. I started out with writing a RMI Interface mimicking the IDL and then converting into a stub using rmic -iiop option. I then use COSNaming to connect to the server. When I narrow the reference using PortableRemoteObject.narrow(), I get a ClassCastException. Probably because the object that I get from naming service will be a CORBA object which cannot be casted to RMI Interface object.
Exception in thread "main" java.lang.ClassCastException
at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
at com.att.cswd.poc.RMIIIOPClient.IMSConnect(RMIIIOPClient.java:46)
at com.att.cswd.poc.RMIIIOPClient.main(RMIIIOPClient.java:27)
Caused by: java.lang.ClassCastException: Object is not of remote type com.att.cswd.poc.CORBAInterface
at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:221)
... 3 more
Code
CORBAInterface ims;
String tranCode="CRTUN130";
byte[][] input_segs = null;
try {
Hashtable hm = new Hashtable();
hm.put("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory");
hm.put("java.naming.provider.url", "corbaloc:iiop:BSYS.MVS.SC.COM:14050/NameService");
Context initialNamingContext = new InitialContext(hm);
Object objref = initialNamingContext.lookup("O2K/AdapterInterface");
ims = (CORBAInterface) PortableRemoteObject.narrow(objref, CORBAInterface.class);
byte output_segs[][] = ims.run_transaction_binary(tranCode, input_segs);
System.out.println ("Response is " + output_segs);
} catch (NamingException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
}I am writing a RMI-IIOP client to connect to an existing CORBA C++ serverAs it says in [the Javadoc|http://java.sun.com/j2se/1.5.0/docs/guide/rmi-iiop/rmiiiopUsing.html#when], you can't do that. For RMI/IIOP you have to start with a PortableRemoteObject and rmic -iiop. You can use a C++ client to that but you can't use an RMI/IIOP client to a C++ server.
Use IDLJ.
Maybe you are looking for
-
My computer no longer recognizes my iphone after I updated the phone.
What do I have to do to correct that?
-
Other websites keep opening up when i open firefox i.e facebook
when i open my homepage other pages open up i.e gambling sites or dating sites == This happened == Every time Firefox opened
-
The below given function gives result as 1 in apex when the max_date and min_date are same. But when run on toad it gives result 0. CREATE FUNCTION D_DIFF (max_date STRING, min_date STRING) RETURN PLS_INTEGER IS BEGIN RETURN TO_DATE(max_date) - TO
-
IMovie sound problems once shared
I make a movie with effects and a soundtrack etc and when previewed all is fine..... HOWEVER.... onced shared/saved to a final file ready for import into iDVD or any other program the sound is fine until playback reaches a point where an effect is ap
-
Mac mini hdmi auto detect stereo or surround
Hi, I have just switched from an windows 7 media center to using a mac mini for my media center. In my setup I have connected the mini to my Denon surround receiver with an HDMI cable (like I had with my windows media center). However I have a small