[jacorb-developer] having a problem, and can't understand why

Fabrizio Vižintin fabrizio.vizintin at gmail.com
Mon Jan 21 11:35:23 CET 2013


Hi Nick,

thanks for the fast reply.

The machines can be configured in various ways (fixed ip address, dhcp
address, fixed dhcp address).

So, i will try jacorb.dns.enable=true.

But, let me show you what i've done:

The IDL interface is Server.idl has the following content:

module demo
{
    module corbaloc {

interface Printer {
void printText(in wstring text);
};

        interface GoodDay {

            string hello_simple();

Printer getPrinter(in wstring printerName);

        };

    };

};

The PrinterImpl.java has the following content:

package demo.corbaloc;

public class PrinterImpl
    extends PrinterPOA
{
    private String name;
private org.omg.CORBA.ORB orb;

    public PrinterImpl( String name )
    {
        this.name = name;
    }

    public void printText(String text)
    {
        System.out.println("Printing text: " + text);
    }

}

And the GoodDayImpl.java has the following content:

package demo.corbaloc;

public class GoodDayImpl
    extends GoodDayPOA
{
    private String location;
private org.omg.CORBA.ORB orb;

    public GoodDayImpl( org.omg.CORBA.ORB orb, String location )
    {
        this.location = location;
    this.orb = orb;
    }

    public String hello_simple()
    {
        return "Hello World, from " + location;
    }

public Printer getPrinter(String printerName) {
PrinterImpl printer = new PrinterImpl(printerName);
printer._this_object(orb);
return printer._this();
}
}

In the Client.java the lines added are:

<modified>
      org.omg.CORBA.Object obj = orb.string_to_object("
corbaloc:iiop:1.2 at 127.0.0.1:6969/VeryShortKey<http://corbaloc:iiop%3A1.2@127.0.0.1:6969/VeryShortKey>");

      // and narrow it to HelloWorld.GoodDay
      // if this fails, a BAD_PARAM will be thrown
      GoodDay goodDay = GoodDayHelper.narrow( obj );
<modified>

<added>
  System.out.println("EXECUTING WORK ON THE OBJECT");
  Printer printer = goodDay.getPrinter("NAME");
  printer.printText(" text to print ");
<added>

And i omitted the static calls for the 2 ways of connecting to the server.
And in Server.java i commented out everything about server 2.

When invoking printer.printText we get the network address. And I don't
understand why.

So, till the printer.printText the server return 127.0.0.1, when invoking
the printText method it returns the network address.

About the explicit address configuration, I don't know how to set it up in
a way that the remote and local clients does not have a problem with it.

If needed I will share the code.

Kind Regards


On Mon, Jan 21, 2013 at 10:57 AM, Nick Cross <jacorb at goots.org> wrote:

>
>
> Hi,
>
> Firstly attachments are stipped to this list - you could use bugzilla to
> share code.
>
> Have you tried using DNS names instead? Or configuring the ip address
> explicitly? (both of these should be in the programmingguide).
>
> Regards
>
> Nick
>
>
>
> On 20/01/13 22:08, Fabrizio Vižintin wrote:
>
>> Hi,
>>
>> I am working on a Java POS (point of sale) application that is in its 2
>> year of development.
>>
>> The printing is implemented using the corba technology.
>>
>> We have migrated from the standard com.sun.corba.se implementation to
>> jacorb.
>>
>> The reasons of the migration are obvious, jacorb is just a better
>> implementation.
>>
>> I can say that everything is working fine for now. We expect the first new
>> installations to happen at the beginning of Februrary.
>>
>> I have a problem, that is happening on both implementations: standard and
>> jacorb.
>>
>> So let me shortly explain how we print using corba.
>>
>> We have an IDL interface that defines a Printer interface (with the main
>> method print(String XMLdata) ), a DeviceFactory interface, a
>> PrintetSettings valueType.
>>
>> And we basically get the Printer from the DeviceFacotry that has a
>> getPrinter method (with some parameters). And then invoke the print
>> method.
>>
>> The problem is happening with the local connection ...
>>
>> No problem with cllients from other machines :-)
>>
>> Now, what happens is that the ip address returned from the server is
>> almost
>> always 127.0.0.1 but on the print method the server is returning the
>> network address! And this is a problem if the network goes down.
>>
>> I reproduced the behavior modifying the corbaloc example, and I'm
>> attaching
>> a zip file containing all the sources.
>>
>> The IDL have been extended by a new Printer interface, and the GoodDay
>> interface has a method Printer getPrinter.
>>
>> runing ant, when the network cable is attached generates the output:
>>
>> fvizinti at fvizinti-ubuntu ~/Downloads/src/jacorb-3.1/**demo/corbaloc $ ant
>> Buildfile: /home/fvizinti/Downloads/src/**jacorb-3.1/demo/corbaloc/**
>> build.xml
>>
>> idl.taskdef:
>>
>> idl:
>>     [jacidl] processing idl file:
>> /home/fvizinti/Downloads/src/**jacorb-3.1/demo/corbaloc/idl/**server.idl
>>
>> compile:
>>
>> demo:
>>       [jaco] Server 1 can be reached with:
>>       [jaco]    corbaloc::1.2 at localhost
>> :6969/HelloServer/HelloPOAP/**HelloServerID
>>       [jaco]
>>       [jaco] Jan 20, 2013 10:52:40 PM org.jacorb.config.**
>> JacORBConfiguration
>> <init>
>>       [jaco] WARNING: no properties found for configuration jacorb
>>       [jaco] Jan 20, 2013 10:52:40 PM org.jacorb.orb.ORBSingleton <init>
>>       [jaco] INFO: created ORBSingleton
>>       [jaco] Jan 20, 2013 10:52:40 PM org.jacorb.poa.AOM add
>>       [jaco] INFO: oid: 48 65 6C 6C 6F 53 65 72 76 65 72 49 44
>>         HelloServerIDobject is activated
>>       [jaco] Server 1 ior:
>> IOR:**000000000000001D49444C3A6F6D67**2E6F72672F434F5242412F4F626A65**
>> 63743A312E30000000000000000100**00000000000050000102000000000A**
>> 3132372E302E302E31001B39000000**2348656C6C6F5365727665722F4865**
>> 6C6C6F504F41502F48656C6C6F5365**727665724944000000000100000000**
>> 00000008000000004A414300
>>       [jaco] Adding object mapping for server 1
>> ior:IOR:**000000000000001D49444C3A6F6D67**2E6F72672F434F5242412F4F626A65*
>> *63743A312E30000000000000000100**00000000000050000102000000000A**
>> 3132372E302E302E31001B39000000**2348656C6C6F5365727665722F4865**
>> 6C6C6F504F41502F48656C6C6F5365**727665724944000000000100000000**
>> 00000008000000004A414300
>>       [jaco] Calling server using short key form...
>>       [jaco] Jan 20, 2013 10:53:10 PM org.jacorb.config.**
>> JacORBConfiguration
>> <init>
>>       [jaco] WARNING: no properties found for configuration jacorb
>>       [jaco] Jan 20, 2013 10:53:10 PM org.jacorb.orb.ORBSingleton <init>
>>       [jaco] INFO: created ORBSingleton
>>       [jaco] Jan 20, 2013 10:53:10 PM org.jacorb.config.**
>> JacORBConfiguration
>> <init>
>>       [jaco] WARNING: no properties found for configuration jacorb
>>       [jaco] Jan 20, 2013 10:53:10 PM
>> org.jacorb.orb.giop.**ClientConnectionManager getConnection
>>       [jaco] INFO: ClientConnectionManager: created new
>> ClientGIOPConnection
>> to 127.0.0.1:6969 (2a4983)
>>       [jaco] Jan 20, 2013 10:53:10 PM org.jacorb.orb.Delegate
>> getReplyGroup
>>       [jaco] INFO: Adding new retry group for 127.0.0.1:6969
>>       [jaco] Jan 20, 2013 10:53:10 PM
>> org.jacorb.orb.iiop.**ServerIIOPConnection configure
>>       [jaco] INFO: Opened new server-side TCP/IP transport to
>> 127.0.0.1:36270
>>       [jaco] Jan 20, 2013 10:53:10 PM org.jacorb.poa.AOM add
>>       [jaco] INFO: oid: 00 01 33 0D 1B 3E 4D 0E 02 32 10 06 30 46 38 14 14
>> 1B 48 4C ..3..>M..2..0F8...HL1B
>>               .object is activated
>>       [jaco] Jan 20, 2013 10:53:10 PM org.jacorb.poa.POA getImplName
>>       [jaco] INFO: Using server ID (6796505089) for transient POA
>>       [jaco] Hello World, from SomewhereP
>>       [jaco] EXECUTING WORK ON THE OBJECT
>>       [jaco] Jan 20, 2013 10:53:10 PM
>> org.jacorb.orb.iiop.**ClientIIOPConnection connect
>>       [jaco] INFO: Connected to 127.0.0.1:6969 from local port 36270
>>       [jaco] Jan 20, 2013 10:53:10 PM
>> org.jacorb.orb.giop.**ClientConnectionManager getConnection
>>       [jaco] *INFO: ClientConnectionManager: created new
>> ClientGIOPConnection to 192.168.254.54:6969 (1b3f829)*
>>
>>       [jaco] Jan 20, 2013 10:53:10 PM org.jacorb.orb.Delegate
>> getReplyGroup
>>       [jaco] INFO: Adding new retry group for 192.168.254.54:6969
>>       [jaco] Jan 20, 2013 10:53:10 PM
>> org.jacorb.orb.iiop.**ClientIIOPConnection connect
>>       [jaco] INFO: Connected to 192.168.254.54:6969 from local port 47255
>>       [jaco] Printing text:  text to print
>>       [jaco] Jan 20, 2013 10:53:10 PM
>> org.jacorb.orb.iiop.**ServerIIOPConnection configure
>>       [jaco] INFO: Opened new server-side TCP/IP transport to
>> 192.168.254.54:47255
>>       [jaco] Jan 20, 2013 10:53:10 PM
>> org.jacorb.orb.iiop.**ServerIIOPConnection close
>>       [jaco] INFO: Closed server-side transport to 192.168.254.54:47255
>>       [jaco] Jan 20, 2013 10:53:10 PM
>> org.jacorb.orb.iiop.**ServerIIOPConnection close
>>       [jaco] INFO: Closed server-side transport to 127.0.0.1:36270
>>      [touch] Creating
>> /home/fvizinti/Downloads/src/**jacorb-3.1/demo/corbaloc/**
>> build/tmp/kill1099540429
>>       [jaco] Jan 20, 2013 10:53:12 PM org.jacorb.orb.ORB shutdown
>>       [jaco] INFO: prepare ORB for shutdown...
>>       [jaco] Jan 20, 2013 10:53:12 PM org.jacorb.orb.ORB shutdown
>>       [jaco] INFO: ORB going down...
>>       [jaco] Jan 20, 2013 10:53:12 PM org.jacorb.poa.POA
>> makeDestructionComplete
>>       [jaco] INFO: POA HelloPOAT destroyed
>>       [jaco] Jan 20, 2013 10:53:12 PM org.jacorb.poa.POA
>> makeDestructionComplete
>>       [jaco] INFO: POA HelloPOAP destroyed
>>       [jaco] Jan 20, 2013 10:53:12 PM org.jacorb.poa.POA
>> makeDestructionComplete
>>       [jaco] INFO: POA RootPOA destroyed
>>       [jaco] Jan 20, 2013 10:53:12 PM org.jacorb.orb.ORB shutdown
>>       [jaco] INFO: ORB shutdown complete
>>       [jaco] Jan 20, 2013 10:53:12 PM
>> org.jacorb.orb.iiop.**IIOPListener$Acceptor run
>>       [jaco] INFO: Listener exiting
>>       [jaco] Jan 20, 2013 10:53:12 PM org.jacorb.util.threadpool.**
>> ConsumerTie
>> run
>>       [jaco] INFO: ConsumerTie exited
>>       [jaco] Jan 20, 2013 10:53:12 PM org.jacorb.util.threadpool.**
>> ConsumerTie
>> run
>>       [jaco] INFO: ConsumerTie exited
>>
>> BUILD SUCCESSFUL
>> Total time: 34 seconds
>>
>> You can see the network address 192.168.254.54, and its returned when
>> invoking the printText method (right after the line Printer printer =
>> goodDay.getPrinter("NAME");)
>>
>> Now, if you start again ant, then wait for the server to come alive, and
>> then unplug the network cable, we can't print ... here is the output:
>>
>> fvizinti at fvizinti-ubuntu ~/Downloads/src/jacorb-3.1/**demo/corbaloc $ ant
>> Buildfile: /home/fvizinti/Downloads/src/**jacorb-3.1/demo/corbaloc/**
>> build.xml
>>
>> idl.taskdef:
>>
>> idl:
>>     [jacidl] processing idl file:
>> /home/fvizinti/Downloads/src/**jacorb-3.1/demo/corbaloc/idl/**server.idl
>>
>> compile:
>>
>> demo:
>>       [jaco] Jan 20, 2013 10:56:50 PM org.jacorb.config.**
>> JacORBConfiguration
>> <init>
>>       [jaco] WARNING: no properties found for configuration jacorb
>>       [jaco] Jan 20, 2013 10:56:50 PM org.jacorb.orb.ORBSingleton <init>
>>       [jaco] INFO: created ORBSingleton
>>       [jaco] Jan 20, 2013 10:56:50 PM org.jacorb.poa.AOM add
>>       [jaco] INFO: oid: 48 65 6C 6C 6F 53 65 72 76 65 72 49 44
>>         HelloServerIDobject is activated
>>       [jaco] Server 1 can be reached with:
>>       [jaco]    corbaloc::1.2 at localhost
>> :6969/HelloServer/HelloPOAP/**HelloServerID
>>       [jaco]
>>       [jaco] Server 1 ior:
>> IOR:**000000000000001D49444C3A6F6D67**2E6F72672F434F5242412F4F626A65**
>> 63743A312E30000000000000000100**00000000000050000102000000000A**
>> 3132372E302E302E31001B39000000**2348656C6C6F5365727665722F4865**
>> 6C6C6F504F41502F48656C6C6F5365**727665724944000000000100000000**
>> 00000008000000004A414300
>>       [jaco] Adding object mapping for server 1
>> ior:IOR:**000000000000001D49444C3A6F6D67**2E6F72672F434F5242412F4F626A65*
>> *63743A312E30000000000000000100**00000000000050000102000000000A**
>> 3132372E302E302E31001B39000000**2348656C6C6F5365727665722F4865**
>> 6C6C6F504F41502F48656C6C6F5365**727665724944000000000100000000**
>> 00000008000000004A414300
>>       [jaco] Jan 20, 2013 10:57:20 PM org.jacorb.config.**
>> JacORBConfiguration
>> <init>
>>       [jaco] WARNING: no properties found for configuration jacorb
>>       [jaco] Jan 20, 2013 10:57:20 PM org.jacorb.orb.ORBSingleton <init>
>>       [jaco] INFO: created ORBSingleton
>>       [jaco] Jan 20, 2013 10:57:20 PM org.jacorb.config.**
>> JacORBConfiguration
>> <init>
>>       [jaco] WARNING: no properties found for configuration jacorb
>>       [jaco] Calling server using short key form...
>>       [jaco] Jan 20, 2013 10:57:20 PM
>> org.jacorb.orb.giop.**ClientConnectionManager getConnection
>>       [jaco] INFO: ClientConnectionManager: created new
>> ClientGIOPConnection
>> to 127.0.0.1:6969 (c7b00c)
>>       [jaco] Jan 20, 2013 10:57:20 PM org.jacorb.orb.Delegate
>> getReplyGroup
>>       [jaco] INFO: Adding new retry group for 127.0.0.1:6969
>>       [jaco] Jan 20, 2013 10:57:20 PM
>> org.jacorb.orb.iiop.**ServerIIOPConnection configure
>>       [jaco] INFO: Opened new server-side TCP/IP transport to
>> 127.0.0.1:36282
>>       [jaco] Jan 20, 2013 10:57:20 PM org.jacorb.poa.AOM add
>>       [jaco] INFO: oid: 00 01 33 11 01 04 1F 0A 35 24 10 06 30 46 38 14 14
>> 1B 48 4C ..3.....5$..0F8...HL1B
>>               .object is activated
>>       [jaco] Jan 20, 2013 10:57:20 PM org.jacorb.poa.POA getImplName
>>       [jaco] INFO: Using server ID (1890388230) for transient POA
>>       [jaco] Hello World, from SomewhereP
>>       [jaco] EXECUTING WORK ON THE OBJECT
>>       [jaco] Jan 20, 2013 10:57:20 PM
>> org.jacorb.orb.iiop.**ClientIIOPConnection connect
>>       [jaco] INFO: Connected to 127.0.0.1:6969 from local port 36282
>>       [jaco] Jan 20, 2013 10:57:20 PM
>> org.jacorb.orb.giop.**ClientConnectionManager getConnection
>>       [jaco] INFO: ClientConnectionManager: created new
>> ClientGIOPConnection
>> to 192.168.254.54:6969 (15a0305)
>>       [jaco] Jan 20, 2013 10:57:20 PM org.jacorb.orb.Delegate
>> getReplyGroup
>>       [jaco] INFO: Adding new retry group for 192.168.254.54:6969
>>       [jaco] Jan 20, 2013 10:57:20 PM
>> org.jacorb.orb.iiop.**ClientIIOPConnection connect
>>       [jaco] INFO: Retrying to connect to 192.168.254.54:6969
>>       [jaco] Jan 20, 2013 10:57:21 PM
>> org.jacorb.orb.iiop.**ClientIIOPConnection connect
>>       [jaco] INFO: Retrying to connect to 192.168.254.54:6969
>>       [jaco] Jan 20, 2013 10:57:21 PM
>> org.jacorb.orb.iiop.**ClientIIOPConnection connect
>>       [jaco] INFO: Retrying to connect to 192.168.254.54:6969
>>       [jaco] Jan 20, 2013 10:57:22 PM
>> org.jacorb.orb.iiop.**ClientIIOPConnection connect
>>       [jaco] INFO: Retrying to connect to 192.168.254.54:6969
>>       [jaco] Jan 20, 2013 10:57:22 PM
>> org.jacorb.orb.iiop.**ClientIIOPConnection connect
>>       [jaco] INFO: Retrying to connect to 192.168.254.54:6969
>>       [jaco] Exception in thread "main" org.omg.CORBA.TRANSIENT: Retries
>> exceeded, couldn't reconnect to 192.168.254.54:6969
>>       [jaco] at
>> org.jacorb.orb.iiop.**ClientIIOPConnection.connect(**
>> ClientIIOPConnection.java:223)
>>       [jaco] at
>> org.jacorb.orb.giop.**GIOPConnection.sendMessage(**
>> GIOPConnection.java:1042)
>>       [jaco] at
>> org.jacorb.orb.giop.**GIOPConnection.sendRequest(**
>> GIOPConnection.java:987)
>>       [jaco] at
>> org.jacorb.orb.giop.**ClientConnection.sendRequest(**
>> ClientConnection.java:308)
>>       [jaco] at
>> org.jacorb.orb.giop.**ClientConnection.sendRequest(**
>> ClientConnection.java:289)
>>       [jaco] at org.jacorb.orb.Delegate._**invoke_internal(Delegate.java:
>> **1335)
>>       [jaco] at org.jacorb.orb.Delegate.**invoke_internal(Delegate.java:*
>> *1160)
>>       [jaco] at org.jacorb.orb.Delegate.**invoke(Delegate.java:1148)
>>       [jaco] at org.omg.CORBA.portable.**ObjectImpl._invoke(ObjectImpl.**
>> java:80)
>>       [jaco] at demo.corbaloc._PrinterStub.**printText(_PrinterStub.java:
>> **37)
>>       [jaco] at demo.corbaloc.Client.main(**Client.java:36)
>>       [jaco] Jan 20, 2013 10:57:23 PM
>> org.jacorb.orb.iiop.**ServerIIOPConnection close
>>       [jaco] INFO: Closed server-side transport to 127.0.0.1:36282
>>       [jaco] Java Result: 1
>>      [touch] Creating
>> /home/fvizinti/Downloads/src/**jacorb-3.1/demo/corbaloc/**
>> build/tmp/kill1331427440
>>       [jaco] Jan 20, 2013 10:57:24 PM org.jacorb.orb.ORB shutdown
>>       [jaco] INFO: prepare ORB for shutdown...
>>       [jaco] Jan 20, 2013 10:57:24 PM org.jacorb.orb.ORB shutdown
>>       [jaco] INFO: ORB going down...
>>       [jaco] Jan 20, 2013 10:57:24 PM org.jacorb.poa.POA
>> makeDestructionComplete
>>       [jaco] INFO: POA HelloPOAT destroyed
>>       [jaco] Jan 20, 2013 10:57:24 PM org.jacorb.poa.POA
>> makeDestructionComplete
>>       [jaco] INFO: POA HelloPOAP destroyed
>>       [jaco] Jan 20, 2013 10:57:24 PM org.jacorb.poa.POA
>> makeDestructionComplete
>>       [jaco] INFO: POA RootPOA destroyed
>>       [jaco] Jan 20, 2013 10:57:24 PM org.jacorb.orb.ORB shutdown
>>       [jaco] INFO: ORB shutdown complete
>>       [jaco] Jan 20, 2013 10:57:24 PM
>> org.jacorb.orb.iiop.**IIOPListener$Acceptor run
>>       [jaco] INFO: Listener exiting
>>       [jaco] Jan 20, 2013 10:57:24 PM org.jacorb.util.threadpool.**
>> ConsumerTie
>> run
>>       [jaco] INFO: ConsumerTie exited
>>
>> BUILD SUCCESSFUL
>> Total time: 36 seconds
>>
>> Our workaround is to instantiate the Printer locally (bypassing the corba
>> infrastructure) when the request for printing is coming from the local
>> machine to the locally attached printer, but this is not what we want.
>>
>> So please, can you look at the code example, and tell us what we are doing
>> wrong.
>>
>> Thanks in advance.
>>
>> Fabrizio
>>
>>
>>
>> ______________________________**_________________
>> jacorb-developer maillist  -  jacorb-developer at lists.spline.**
>> inf.fu-berlin.de <jacorb-developer at lists.spline.inf.fu-berlin.de>
>> https://lists.spline.inf.fu-**berlin.de/mailman/listinfo/**
>> jacorb-developer<https://lists.spline.inf.fu-berlin.de/mailman/listinfo/jacorb-developer>
>>
>>
>


More information about the jacorb-developer mailing list