CORBA structs
I am trying to use CORBA structs in WLS 5.1 sp2. I want to use them as
return types and parameters instead of valuetypes. I have written the IDL
and generated the appropriate .java files with the IDLJ compiler. I have a
test application written using the sun JDK that works 100%. My problem is
when I try to return a class that implements
org.omg.CORBA.portable.IDLEntity the client gives me the exception:
java.rmi.RemoteException: CORBA UNKNOWN 0 Maybe; nested exception is:
org.omg.CORBA.UNKNOWN: minor code: 0 completed: Maybe
org.omg.CORBA.UNKNOWN: minor code: 0 completed: Maybe
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Class.java:237)
at
com.sun.corba.se.internal.iiop.ReplyMessage.getSystemException(ReplyMessage.
java:93)
at
com.sun.corba.se.internal.iiop.ClientResponseImpl.getSystemException(ClientR
esponseImpl.java:82)
at
com.sun.corba.se.internal.corba.ClientDelegate.invoke(ClientDelegate.java:19
1)
at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:294)
at com.heineman._Test_Stub.getVersion(Unknown Source)
at RMIClient.main(RMIClient.java:29)
There are no exceptions on the server. It appears to me that the ejbc
compiler is not generating the appropriate skeleton code. I know the stub
code is fine since I use the rmic compiler to generate those. I am not
using the -iiop parameter with ejbc, instead I am using rmic and jaring the
stub classes separately.
To run the test (under WinNT or Win2000), unzip all the files to a single
directory and with this as the current directory, do the following:
tnameserv
jcn Server
jcn Client
How do I get CORBA structs to work with WLS?
[struct.zip]
It's a very commun problem, in fact.
Every time you ask the recordset to go further, I mean "next()", there's one network connection behind. So if you want to make your program run faster, just retrieve the whole data you want to analyse in a Vector or ... List() or what you want; and then use your Vector() class to handle the data. By this way, you'll waste less time in network connection...
Hope this will help
Similar Messages
-
Re: (forte-users) Forte and CORBA question
Hi,
The discarding the Java variable that references a distributed Forte object
doesn't cause that the distributed object will be reclaimed. In Forte client
you can use ReleaseDistReference() of the current partition (task.part) to
free the remote object. For Java client, you can implement the following
solution:
- define a method ReleaseMyObject() in the SO you are using to get the proxy
to the dist. object. As parameter for it use something that can identify
your object (attribute).
- your SO has an array or hashtable with your distributed objects, every new
object is added to it.
- in the implementation of ReleaseMyObject() find the object to release in
the array and call ReleaseDistReference() for it,
- from the Java client, call the ReleaseMyObject() for the object that is
not more needed.
Regards,
Zenon Adamek
----- Original Message -----
From: Joseph Mirwald <jomirweb.de>
To: Dave Ortman <dortmanyahoo.com>; 'Forte User Forum'
<forte-userslists.xpedior.com>
Sent: Wednesday, March 07, 2001 3:58 PM
Subject: Re: (forte-users) Forte and CORBA question
Hello Dave,
do you use a copy return or copy parameters in this method ?
If not, then maybe Forte is unable to garbage-collect this object because
it is forever
a proxy which only the server-partition may be able to drop it from memory
(object=NIL).
Try this and let us know what happens.
Hope this helps
Joseph Mirwald
At 11:49 07.03.01 -0800, Dave Ortman wrote:
We're attempting to use a Java client to access a
Forte server. In doing such, we've experienced a
problem which I hoped somebody could shed some light
on.
We've had a Java client calling Forte service objects
and passing Forte objects back and forth as CORBA
structs with no problem. However, we have experienced
some problem obtaining and using remote references to
distributed objects from the Java client.
The problem is memory utilization. Each time I obtain
a reference to a new object, the memory utilization on
the Forte server jumps up quite a bit (around 100k per
object on an NT box). Eventually, if I fetch enough
objects, the server will crash due to lack of memory.
It seems that Forte never reclaims the memory, even
though I'm not using (and don't have a handle to) this
remote objects.
The objects are very small. In fact, I created a test
Forte SO with one method, getObject(); which returns a
distributed object with a single attribute. I then
have a Java client access the getObject() method
repeatedly - discarding the reference to the object
after each iteration. After a short while, the box
will come down.
Any thoughts?
Thanks in advance,
-Dave Ortman
--- "Epari, Madhusudhan" <meparioxhp.com> wrote:
Hi All,
Following error occurs consistently on a router
partition for every call to
the service object but the partition doesn't die or
crash. I tried bumping
up the partition memory too. Any thoughts on why
it's happening?
Thanks in advance,
Madhu
SYSTEM ERROR: Failed to connect or lost connection
to the
environment manager
at FORTE_NS_ADDRESS = <Unknown>. Check that the
environment
manager is
installed at that location. If it is, then check
to be sure that
there are
enough system resources available to support this
partition.
Class: qqsp_SystemResourceException
Error #: [601, 201]
Detected at: qqdo_NsClient::FindObject at 1
Error Time: Wed Feb 21 09:30:56
Exception occurred (locally) on partition
"CSA_cl0_Part2-router",
(partitionId =
C61609A0-8270-11D3-88A9-F4D005D0AA77:0x10c5c:0x1,
taskId =
[C61609A0-8270-11D3-88A9-F4D005D0AA77:0x10c5c.8]) in
application
"MWRouting_cl1", pid 18937 on node forted1 in
environment
frtedev.
SYSTEM ERROR: Attempt to send from a partition
(C61609A0-8270-11D3-88A9-F4D005D0AA77:0x10c5c:0x1)
that no
longer exists.
Class: qqsp_DistAccessException
Error #: [601, 111]
Detected at: qqdo_PartitionMgr::SendMsg at
1
Error Time: Wed Feb 21 09:30:56
Distributed method called:
qqdo_NsServerProxy.FindObject
(object name
Unnamed) from partition
"CSA_cl0_Part2-router",
(partitionId =
C61609A0-8270-11D3-88A9-F4D005D0AA77:0x10c5c:0x1,
taskId =
[C61609A0-8270-11D3-88A9-F4D005D0AA77:0x10c5c.8]) in
application
"MWRouting_cl1", pid 18937 on node
forted1 in environment
frtedev
Exception occurred (locally) on partition
"CSA_cl0_Part2-router",
(partitionId =
C61609A0-8270-11D3-88A9-F4D005D0AA77:0x10c5c:0x1,
taskId =
[C61609A0-8270-11D3-88A9-F4D005D0AA77:0x10c5c.8])
in
application "MWRouting_cl1", pid 18937 on
node forted1 in
environment
frtedev.
LbRouter::FindMembers - CAUGHT EXCEPTION attaching
members from
For the archives, go to:
http://lists.xpedior.com/forte-users and use
the login: forte and the password: archive. To
unsubscribe, send in a new
email the word: 'Unsubscribe' to:
forte-users-requestlists.xpedior.com
For the archives, go to: http://lists.xpedior.com/forte-users and use
the login: forte and the password: archive. To unsubscribe, send in a new
email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.com--
For the archives, go to: http://lists.xpedior.com/forte-users and use
the login: forte and the password: archive. To unsubscribe, send in a new
email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.comWhy not this:
while myText.moveToString(' ') do
myText.ReplaceRange('-', myText.Offset, myText.Offset+1);
end while;
or if you prefer verbosity:
while myText.moveToString(source=' ') do
myText.ReplaceRange(source='-', startOffset=myText.Offset,
endOffset=myText.Offset+1);
end while;
-----Original Message-----
From: FatchJeBAM.com [mailto:FatchJeBAM.com]
Sent: Wednesday, January 12, 2000 2:51 PM
To: Troy.Burnsvacationclub.com; kamranaminyahoo.com
Subject: RE: (forte-users) search and replace within a TextData
How about this?? May have to play with start/end on ReplaceRange as I
didn't really test this
Anybody got a better way??
-- replace space with underscore
For x in 1 to myTextdata.LengthToEnd() do
If myTextData.IsSpace() then
MyTextdata.ReplaceRange('_'. Startoffset=myTextdata.offset,
endoffset=myTextdata.offset+1);
End if;
MyTextdata.MoveNext;
End for;
Jerry Fatcheric
-----Original Message-----
From: Burns, Troy [mailto:Troy.Burnsvacationclub.com]
Sent: Wednesday, January 12, 2000 9:40 AM
To: kamranaminyahoo.com
Subject: (forte-users) search and replace within a
TextData
Hello all,
I need to search within a textdata object, replacing all
occurrances of a
space
with another character. Can you give a quick code example
of how I would do
this?
Thanks in advance,
Troy
Troy Burns
Marriott Vacation Club Intl.
E-mail: troy.burnsvacationclub.com
Phone: (941) 688-7700 ext. 4408
For the archives, go to: http://lists.sageit.com/forte-users
and use
the login: forte and the password: archive. To unsubscribe,
send in a new
email the word: 'Unsubscribe' to:
forte-users-requestlists.sageit.com
For the archives, go to: http://lists.sageit.com/forte-users and use
the login: forte and the password: archive. To unsubscribe, send in a new
email the word: 'Unsubscribe' to: forte-users-requestlists.sageit.com -
We're attempting to use a Java client to access a
Forte server. In doing such, we've experienced a
problem which I hoped somebody could shed some light
on.
We've had a Java client calling Forte service objects
and passing Forte objects back and forth as CORBA
structs with no problem. However, we have experienced
some problem obtaining and using remote references to
distributed objects from the Java client.
The problem is memory utilization. Each time I obtain
a reference to a new object, the memory utilization on
the Forte server jumps up quite a bit (around 100k per
object on an NT box). Eventually, if I fetch enough
objects, the server will crash due to lack of memory.
It seems that Forte never reclaims the memory, even
though I'm not using (and don't have a handle to) this
remote objects.
The objects are very small. In fact, I created a test
Forte SO with one method, getObject(); which returns a
distributed object with a single attribute. I then
have a Java client access the getObject() method
repeatedly - discarding the reference to the object
after each iteration. After a short while, the box
will come down.
Any thoughts?
Thanks in advance,
-Dave Ortman
--- "Epari, Madhusudhan" <meparioxhp.com> wrote:
Hi All,
Following error occurs consistently on a router
partition for every call to
the service object but the partition doesn't die or
crash. I tried bumping
up the partition memory too. Any thoughts on why
it's happening?
Thanks in advance,
Madhu
SYSTEM ERROR: Failed to connect or lost connection
to the
environment manager
at FORTE_NS_ADDRESS = <Unknown>. Check that the
environment
manager is
installed at that location. If it is, then check
to be sure that
there are
enough system resources available to support this
partition.
Class: qqsp_SystemResourceException
Error #: [601, 201]
Detected at: qqdo_NsClient::FindObject at 1
Error Time: Wed Feb 21 09:30:56
Exception occurred (locally) on partition
"CSA_cl0_Part2-router",
(partitionId =
C61609A0-8270-11D3-88A9-F4D005D0AA77:0x10c5c:0x1,
taskId =
[C61609A0-8270-11D3-88A9-F4D005D0AA77:0x10c5c.8]) in
application
"MWRouting_cl1", pid 18937 on node forted1 in
environment
frtedev.
SYSTEM ERROR: Attempt to send from a partition
(C61609A0-8270-11D3-88A9-F4D005D0AA77:0x10c5c:0x1)
that no
longer exists.
Class: qqsp_DistAccessException
Error #: [601, 111]
Detected at: qqdo_PartitionMgr::SendMsg at
1
Error Time: Wed Feb 21 09:30:56
Distributed method called:
qqdo_NsServerProxy.FindObject
(object name
Unnamed) from partition
"CSA_cl0_Part2-router",
(partitionId =
C61609A0-8270-11D3-88A9-F4D005D0AA77:0x10c5c:0x1,
taskId =
[C61609A0-8270-11D3-88A9-F4D005D0AA77:0x10c5c.8]) in
application
"MWRouting_cl1", pid 18937 on node
forted1 in environment
frtedev
Exception occurred (locally) on partition
"CSA_cl0_Part2-router",
(partitionId =
C61609A0-8270-11D3-88A9-F4D005D0AA77:0x10c5c:0x1,
taskId =
[C61609A0-8270-11D3-88A9-F4D005D0AA77:0x10c5c.8])
in
application "MWRouting_cl1", pid 18937 on
node forted1 in
environment
frtedev.
LbRouter::FindMembers - CAUGHT EXCEPTION attaching
members from
For the archives, go to:
http://lists.xpedior.com/forte-users and use
the login: forte and the password: archive. To
unsubscribe, send in a new
email the word: 'Unsubscribe' to:
forte-users-requestlists.xpedior.comWe're attempting to use a Java client to access a
Forte server. In doing such, we've experienced a
problem which I hoped somebody could shed some light
on.
We've had a Java client calling Forte service objects
and passing Forte objects back and forth as CORBA
structs with no problem. However, we have experienced
some problem obtaining and using remote references to
distributed objects from the Java client.
The problem is memory utilization. Each time I obtain
a reference to a new object, the memory utilization on
the Forte server jumps up quite a bit (around 100k per
object on an NT box). Eventually, if I fetch enough
objects, the server will crash due to lack of memory.
It seems that Forte never reclaims the memory, even
though I'm not using (and don't have a handle to) this
remote objects.
The objects are very small. In fact, I created a test
Forte SO with one method, getObject(); which returns a
distributed object with a single attribute. I then
have a Java client access the getObject() method
repeatedly - discarding the reference to the object
after each iteration. After a short while, the box
will come down.
Any thoughts?
Thanks in advance,
-Dave Ortman
--- "Epari, Madhusudhan" <meparioxhp.com> wrote:
Hi All,
Following error occurs consistently on a router
partition for every call to
the service object but the partition doesn't die or
crash. I tried bumping
up the partition memory too. Any thoughts on why
it's happening?
Thanks in advance,
Madhu
SYSTEM ERROR: Failed to connect or lost connection
to the
environment manager
at FORTE_NS_ADDRESS = <Unknown>. Check that the
environment
manager is
installed at that location. If it is, then check
to be sure that
there are
enough system resources available to support this
partition.
Class: qqsp_SystemResourceException
Error #: [601, 201]
Detected at: qqdo_NsClient::FindObject at 1
Error Time: Wed Feb 21 09:30:56
Exception occurred (locally) on partition
"CSA_cl0_Part2-router",
(partitionId =
C61609A0-8270-11D3-88A9-F4D005D0AA77:0x10c5c:0x1,
taskId =
[C61609A0-8270-11D3-88A9-F4D005D0AA77:0x10c5c.8]) in
application
"MWRouting_cl1", pid 18937 on node forted1 in
environment
frtedev.
SYSTEM ERROR: Attempt to send from a partition
(C61609A0-8270-11D3-88A9-F4D005D0AA77:0x10c5c:0x1)
that no
longer exists.
Class: qqsp_DistAccessException
Error #: [601, 111]
Detected at: qqdo_PartitionMgr::SendMsg at
1
Error Time: Wed Feb 21 09:30:56
Distributed method called:
qqdo_NsServerProxy.FindObject
(object name
Unnamed) from partition
"CSA_cl0_Part2-router",
(partitionId =
C61609A0-8270-11D3-88A9-F4D005D0AA77:0x10c5c:0x1,
taskId =
[C61609A0-8270-11D3-88A9-F4D005D0AA77:0x10c5c.8]) in
application
"MWRouting_cl1", pid 18937 on node
forted1 in environment
frtedev
Exception occurred (locally) on partition
"CSA_cl0_Part2-router",
(partitionId =
C61609A0-8270-11D3-88A9-F4D005D0AA77:0x10c5c:0x1,
taskId =
[C61609A0-8270-11D3-88A9-F4D005D0AA77:0x10c5c.8])
in
application "MWRouting_cl1", pid 18937 on
node forted1 in
environment
frtedev.
LbRouter::FindMembers - CAUGHT EXCEPTION attaching
members from
For the archives, go to:
http://lists.xpedior.com/forte-users and use
the login: forte and the password: archive. To
unsubscribe, send in a new
email the word: 'Unsubscribe' to:
forte-users-requestlists.xpedior.com -
Converting a hashtable to an array (CORBA sequence)
Hi all,
I wish to convert the contents of a hashtable to an array (well a CORBA sequence), but I am having a bit of trouble.
I have a CORBA struct called 'Equipment', and an unbounded sequence of Equipment structs called 'EquipmentList':
struct Equipment {
string name;
string description;
typedef sequence<Equipment> EquipmentList;I have a Java hashtable called equipmentList which contains a list of equipment with key 'name' and corresponding value of 'description'.
The following code is trying to convert from the hashtable to the CORBA sequence:
Equipment equipList[] = new Equipment[equipmentList.size()]; // make sequence same size as hashtable.
for (int i = 0; i < equipmentList.size(); i++) {
equipList[i] = new Equipment(); // make element a valid 'Equipment' object.
equipList.name = equipmentList.name; // give each sequence element value 'name' the value of the hashtable key value 'name'
equipList[i].description = equipmentList.description; // same with 'description' value
I know the conversion is completely wrong, and it obviously brings up 2 errors a compile time:HireCompanyServer.java:81: cannot find symbol
symbol : variable name
location: class java.util.Hashtable
equipList[i].name = equipmentList.name;
^
HireCompanyServer.java:82: incompatible types
found : java.lang.Object
required: java.lang.String
equipList[i].description = equipmentList.get(equipList[i
].name);
^
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
I know this might be a long-winded question, but I am having real difficulty fixing this, and would kindly appreciate some more advanced programmers to give me any hints or fixes for my code.
ThanksJonBetts2004 wrote:
I know this might be a long-winded question, but I am having real difficulty fixing this, and would kindly appreciate some more advanced programmers to give me any hints or fixes for my code.Not quite sure how 'struct' got in there, but unless you're using generics to set up your HashTable, you have to cast anything you get from your list to the correct type. Have a look at the HashTable method list and I think you'll work out what you want. -
Beginner CORBA idl struct said to be abstract class
How do I instantiate a class declared in my .idl file for use by the methods implementing the interface?
I want to return an array of Record objects in my CORBA implentation, and my .idl file has: struct Record
long recordNumber;
string firstName;
string lastName;
string streetAddress;
string city;
string country;
string phone;
string eMail;
string fax;
typedef sequence <Record> recordSet;
interface AddRecord
void setUser(in string user);
string getUser();
recordSet getRecords();
// plus more stuffWhen my implementing class in the server tries to define the getRecords() method like so: public Record[] getRecords()
Record r = null;
Record[] allRecs;
int index = 0;
String selectAll = "SELECT * FROM Record ORDER BY Record_number";
try
Statement s = connection.createStatement();
ResultSet recs = s.executeQuery(selectAll);
while(recs.next())
index++;
allRecs = new Record[index];
//plus more stuffthe compiler complains
C:\My Documents\Java\CIS 290\hw5\RecordObj.java:178: Record is abstract; cannot be instantiated
r = new Record();
I went into the Record.java that the idlj compiler generated, and it is a final, non-abstract class. What incantation do I need here?Whoops; solved that one; the real question is this: My .idl file declares some methods that I want to call in my implementation, but the .java class generated by the idlj compiler doesn't show the methods. Here's the full idl:module hw5Corba
typedef sequence <string> columns;
struct Record
long recordNumber;
string firstName;
string lastName;
string streetAddress;
string city;
string country;
string phone;
string eMail;
string fax;
typedef sequence <Record> recordSet;
interface AddRecord
void setUser(in string user);
string getUser();
recordSet getRecords();
columns getColumnNames(in string user);
void newRecord(in Record r);
void deleteRecord(in long num);
void updateRecord(in Record r);
void setRecordNumber(in long num);
long getRecordNumber();
void setFirstName(in string first);
string getFirstName();
void setLastName(in string last);
string getLastName();
void setStreetAddr(in string add);
string getStreetAddr();
void setCity(in string city);
string getCity();
void setCountry(in string country);
string getCountry();
void setEmail(in string email);
string getEmail();
void setPhone(in string phone);
string getPhone();
void setFax(in string fax);
string getFax();
};Here's the method I expect to be able to implement: public Record[] getRecords()
Record r = null;
Record[] allRecs;
int index = 0;
String selectAll = "SELECT * FROM Record ORDER BY Record_number";
try
Statement s = connection.createStatement();
ResultSet recs = s.executeQuery(selectAll);
while(recs.next())
index++;
allRecs = new Record[index];
//cycle through records again, adding each
//to the array
index = 0;
recs = s.executeQuery(selectAll);
while(recs.next())
r = new Record();
r.setRecordNumber(recs.getInt(1));
r.setFirstName(recs.getString(2));
r.setLastName(recs.getString(3));
r.setStreetAddr(recs.getString(4));
r.setCity(recs.getString(5));
r.setCountry(recs.getString(6));
r.setEmail(recs.getString(7));
r.setPhone(recs.getString(8));
r.setFax(recs.getString(9));
allRecs[index] = r;
catch (SQLException ex)
exceptionCode(ex);
return allRecs;
}The compiler error lists the 9 sub-methods as "can't resolve symbol", because as the Record.java file generated by the idlj shows, the methods aren't there:package hw5Corba;
* hw5Corba/Record.java
* Generated by the IDL-to-Java compiler (portable), version "3.0"
* from Record.idl
* Tuesday, November 20, 2001 10:08:15 PM CST
public final class Record implements org.omg.CORBA.portable.IDLEntity
public int recordNumber = (int)0;
public String firstName = null;
public String lastName = null;
public String streetAddress = null;
public String city = null;
public String country = null;
public String phone = null;
public String eMail = null;
public String fax = null;
public Record ()
} // ctor
public Record (int _recordNumber,
String _firstName, String _lastName,
String _streetAddress, String _city,
String _country, String _phone,
String _eMail, String _fax)
recordNumber = _recordNumber;
firstName = _firstName;
lastName = _lastName;
streetAddress = _streetAddress;
city = _city;
country = _country;
phone = _phone;
eMail = _eMail;
fax = _fax;
} // ctor
} // class Record What do I need to do to implement these methods declared in the .idl file? -
Array of (structure) as a parameter in CORBA and JAVA
Hii
i have created a structure in the (interface )IDL file in CORBA program,
then I used an array of this structure.
I used the data type in the server application, i decalared a variable of the same type of the structure and i send it to the client as a single variable, it was working with out problems.
the problem is :
i wanted to send an array of this object (structure) to the client but i couldn't i tried many ways but i couldn't,
I wrote the program (both server and client) in Java, but since i am not java profissional I think there is a certain way to send this array as a parameter from the server to the client or the opposit.
so , Can you please help meIn your idl file you need to define a sequence of your structure
typedef sequence<strucrure name> stucts;
this is mapped to an aarray of your struct in java -
RE: Forte/CORBA inquiry - Long post
Dave,
Are you using any kind of structured object in the parameters to your
CORBA-exposed method?
We have found that Forté will change the order of struct class attributes
when changes are made in the IDE (often even when seemingly unrelated).
Look at the IDL generated in your last deploy to be sure the order of
attributes is the same.
- MikeL
-----Original Message-----
Date: Thu, 3 Aug 2000 12:10:17 -0700
From: "Dave Ortman" <dortmanrcsis.com>
To: kamranaminyahoo.com
Subject: Forte/CORBA inquiry - Long post
Message-id: <3989c399.22c.0rcsis.com>
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hello,
I've been experimenting with accessing Forte through Java via CORBA. While
I have adequate experience with Forte and Java, I'm fairly new to CORBA. As
a result, I've discovered some issues which I can't seem to resolve.
I fear my explanation might be a bit lengthy, but I figure it's easier to
offer
comments when you have all the information. I apologize in advance.
I started by writing a Java application that would access a Forte service
object.
To keep things simple, I didn't use any of our existing code base. I
instead
used the code examples in tech note #10950: Forte Service Objects and
VisiBroker
Java IIOP clients. However, instead of using the VisiBroker ORB, I used the
Java 1.2 ORB. Other than that, I used the same code offered in the tech
note.
This example worked fine. I exported the IDL from Forte, ran the Sun
idltojava
tool, and compiled my Java classes.
I then tried to carry this example forward, and use some of our existing
Forte
objects. Things did not go as smoothly, and I am now left with a few
questions.
I created two new projects in my workspace - CorbaSO and CorbaManager.
In the CorbaManager I created a single class - CustomerManager. This object
has one method which retrieves a customer object based upon a CustomerID
which
is passed into the method. This project has three supplier plans which are
needed to retrieve this Customer object.
In the CorbaSO project, I created two classes - CorbaServer and TestClass.
CorbaServer has two methods: getCustomer and GetDamage. The getCustomer
method
instantiates an instance of the CustomerManager class, and uses it to
retrieve
a customer based upon the CustomerID passed into the getCustomer method,
then
returns the CustomerName (string). The GetDamage method is the same method
that's used in tech note #10950 (discussed above). I just wanted to make
sure
it still worked. I then made a Service Object from the CorbaServer class,
which
I called CorabaServerSO. This project has two supplier plans - the
CorbaManager
project discussed above, and the plan which contains the CustomerObject
(which
is returned by the CUstomerManager class).
Lastly, the test class simply contains a go() method, which I used to make
sure
the CorbaServerSO was working fine. All it does is call
CorbaServerSO.getCustomerName()
passing in a CustomerID, and writes the returning name out the logger.
The code compiles, and it works fine when I run it from within Forte
[through
TestClass.go()]. I then deployed the app and exported the IDL.
However, when looking at the IDL, I find that Forte exported 900k of IDL.
It
exported the IDL definition of every class within the supplier plan
hierarchy.
Given that I only wanted to expose my one service object, I assumed that I
would only get IDL for that one project. Instead, I got IDL for every
object
all the way down the Supplier Plan chain. So my first question is, why do I
get IDL for everything?
To make matters worse, this 900k IDL file is littered with errors - and my
IDL
compiler chokes. I edited the IDL so that it only contained definitions for
the CorbaSO project, and ran the IDLTOJAVA tool on that edited file. That
created
the JAVA files just fine, and I then compiled them into CLASS files. So far
so good.
I then wrote a Java client to call methods on my newly published
CorbaServerSO.
I found that the GetDamage() method worked fine, while the getCustomer
method
yield the following error: 'org.omg.CORBA.UNKNOWN: minor code: 1
completed:
Maybe'. This error is offered immediately after calling the getCustomer
method
on the CORBA stub.
Curious as to why one method worked, and one didn't - I looked to the code
in
the GetDamage method. The code was as follows (all undeclared variables are
input or output variables of type double):
tmp1 : i4;
tmp1 = i4(total * 0.0775 * 100.0 + 0.5);
salesTax = double(tmp1) / 100.0;
tmp1 = i4(total * 0.15 * 100.0 + 0.5);
tips15 = double(tmp1) / 100.0;
newTotalwoTips = salesTax + total + total;
As written above, the code works. I then modified the code to the following
(all parameters were unchanged):
custManager : CustomerManager= new();
tempCustomer : Customer = custManager.fetchCustomer(12345);
tmp1 : i4;
tmp1 = i4(total * 0.0775 * 100.0 + 0.5);
salesTax = double(tmp1) / 100.0;
tmp1 = i4(total * 0.15 * 100.0 + 0.5);
tips15 = double(tmp1) / 100.0;
newTotalwoTips = salesTax + total + total;
After deploying the newly modified code, I find that the GetDamage method
now
does not work. All I did was instanstiate an object, and call a method on
it.
I never did anything with the results. Yet I get the same error:
'org.omg.CORBA.UNKNOWN:
minor code: 1 completed: Maybe'.
So my two question are:
1. Why did I get IDL for every object within the Supplier Plan tree when I
was
only attempting to expose 1 Service Object.
2. Why does a method cease to work via CORBA when I interact with another
object?
Thanks in advance for any help,
-Dave OrtmanIn a previous post, I asked:
<<Why did I get IDL for every object within the Supplier Plan tree when I
was
only attempting to expose 1 Service Object.>>
Since writing this, I have come across tech note #11427 - which mentions use
of a IIOPIgnore extended flag which you can set on objects to suppress IDL
generation. Otherwise, Forte automatically generates IDL for any object
which is marked as Distributed.
Most of our objects are distributed. I set this property on the objects
within the two projects I was working in, and the IDL for these objects was
not created. However, the rest of the objects in the Supplier Plan chain
were still translated to IDL. Am I going to have to set this property on
every object? I don't see how I could be misapplying the property - but you
never know.
<<Why does a method cease to work via CORBA when I interact with another
object?>>
Through the use of putline()'s, I've found that the error is generated
somewhere deeper within our application architecture. It may be a problem
with our code - I'm not sure. I would still be happy to hear any input on
the matter.
Thanks,
-Dave Ortman -
CORBA IDL "pragma ID" not solving problem
Similar to "CORBA Bug?", I get the stacktrace that is listed at the end of this note. I have put "pragma ID..." for typedefs, structs and interfaces in my idl file. I did nothing else to the code. The same errors were generated, so I assume the "pragma ID..." had no effect.
This program connects to a Cloudscape DB on the server, and works very well with servants that have only "string" types. It produces errors with strings that have user-defined or boolean return types.
I appreciate any help in this matter.
Gary Lance
[email protected]
Exception in thread "main" org.omg.CORBA.UNKNOWN:
vmcid: SUN minor code: 202 completed: Maybe at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct orAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:296)
at java.lang.Class.newInstance(Class.java:249)
at
com.sun.corba.se.internal.iiop.messages.ReplyMessage_1_2.ge
tSystemException(ReplyMessage_1_2.java:90)
at
com.sun.corba.se.internal.iiop.ClientResponseImpl.getSystemEx
ception(ClientResponseImpl.java:105)
at
com.sun.corba.se.internal.POA.GenericPOAClientSC.invoke
(GenericPOAClientSC.java:129)
at org.omg.CORBA.portable.ObjectImpl._invoke
(ObjectImpl.java:457)
at TeachApp._TeachingStub.getProfessors
(_TeachingStub.java:43)
at TeachEntry.getNames(TeachEntry.java:127)
at TeachEntry.<init>(TeachEntry.java:85)
at TeachEntry.main(TeachEntry.java:295)I had this problem myself and I finally managed to crack it ...
Let's take an example IDL for reference
typedef string<100> Name;
struct PersonStruct {
string age;
Name name;
typedef sequence<PersonStruct> PersonSeq;
interface PersonHandling {
long getPersons(in string personId, in Name name, out PersonSeq persons);
};The method getPerson returns an array of PersonStructs.
The most likely place where the error 202 is thrown is in the implementation class
public int getPersons(String personId, String name, PersonSeqHolder persons) {
PersonStruct a = new PersonStruct();
a.age = "28";
a.name = "John Smith";
persons = new PersonSeqHolder(); //this line is the cause of error 202
persons.value = new PersonStruct[]{a};
return 0;
}The return PersonSeqHolder object should not be reinitialised. We must use the object given in the input params as is ..
i.e. persons = new PersonSeqHolder();//should be removed Remove this line and simply set the value
persons.value = new PersonStruct[]{a}; -
Hi all,
I got the following error.... Can't understand what happen?
I can get the interface from the server. However, I cannot invoke any method.
Any thought?
Thank you,
edu.cmu.nat.project6.server._SupervisorInterfaceStub:IOR:000000000000003849444c3
a6564752f636d752f6e61742f70726f6a656374362f7365727665722f53757065727669736f72496
e746572666163653a312e3000000000010000000000000064000102000000000e3139322e3136382
e312e31303400054500000019afabcb00000000021bc6f2780000000800000002000000000a00000
00000000100000001000000200000000000010001000000020501000100010020000101090000000
100010100
-------- Menu : Supervisor -------
1. Load a file
2. Print the file
3. Exit
Please select your choice: 1
Please enter file name to read from: d:\95702\project0\proj0sample.txt
org.omg.CORBA.UNKNOWN: vmcid: SUN minor code: 202 completed: Maybe
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:296)
at java.lang.Class.newInstance(Class.java:249)
at com.sun.corba.se.internal.iiop.messages.ReplyMessage_1_2.getSystemExc
eption(ReplyMessage_1_2.java:90)
at com.sun.corba.se.internal.iiop.ClientResponseImpl.getSystemException(
ClientResponseImpl.java:105)
at com.sun.corba.se.internal.corba.ClientDelegate.invoke(ClientDelegate.
java:303)
at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:457)
at edu.cmu.nat.project6.server._SupervisorInterfaceStub.initialize(_Supe
rvisorInterfaceStub.java:59)
at edu.cmu.nat.project6.client.Supervisor.readFile(Supervisor.java:43)
at edu.cmu.nat.project6.client.Supervisor.loadFile(Supervisor.java:71)
at edu.cmu.nat.project6.client.Supervisor.run(Supervisor.java:115)
at edu.cmu.nat.project6.client.Supervisor.main(Supervisor.java:136)I have a similar problem (to "CORBA Bug?"). The stacktrace is printed at the end of this note. To fix, I put "pragma ID ..." after every typedef, struct and interface in the IDL. I made no other changes to the java code on the server or client. The error does not go away.
Is (are) there any other reason(s) that the errors are generated?
Thank you in advance
Gary Lance
[email protected]
Exception in thread "main" org.omg.CORBA.UNKNOWN:
vmcid: SUN minor code: 202 completed: Maybe at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstruct orAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance
(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance (Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:296)
at java.lang.Class.newInstance(Class.java:249)
at
com.sun.corba.se.internal.iiop.messages.ReplyMessage_1_2.getSystemException(ReplyMessage_1_2.java:90)
at
com.sun.corba.se.internal.iiop.ClientResponseImpl.getSystemEx
ception(ClientResponseImpl.java:105)
at
com.sun.corba.se.internal.POA.GenericPOAClientSC.invoke(GenericPOAClientSC.java:129)
at org.omg.CORBA.portable.ObjectImpl._invoke
(ObjectImpl.java:457)
at TeachApp._TeachingStub.getProfessors
(_TeachingStub.java:43)
at TeachEntry.getNames(TeachEntry.java:127)
at TeachEntry.<init>(TeachEntry.java:85)
at TeachEntry.main(TeachEntry.java:295) -
Insertion of user defined structure in CORBA ANY
I am using JDK 1.4.2 CORBA (ORB) APIs.
I am using CORBA Any in my application. I am able to insert primitive values like short, long, char, etc. into the Any using the specified APIs. But if I try to insert a user defined structure, I get an exception.
This can be explained further by the code below:
Consider the following IDL definition:
// IDL
struct Foo {
string bar;
float number;
interface Flexible {
void doit (in any a);
Now in order to pass the structure Foo in Any, I use the following code snippet:
// Java
// Client.java,
import org.omg.CORBA.*;
Flexible fRef;
Any param = ORB.init().create_any();
Foo toPass = new Foo();
toPass.bar = "Bar";
toPass.number = (float) 34.5;
try {
fRef = FlexibleHelper.bind("anyMarker:anyServer", hostname);
fooHelper.insert (param, toPass);
fref.doit (param);
catch (Exception e) {
But I get an exception when I use the above mentioned methodology.
What is that I am doing wrong.
Or is there some known issue with Sun Java ORB.I just noticed that these files appear to be under copyright. My first question is do you have the copyright permissions to post them in a public forum? If not then you may wish to delete them. That being said I have examined the code and it seems easy enough to work around your issues (provided you have the copyright permissions). The way to work around the issues is indeed to replace the struct fields with variables. This will of course require you to change a couple function definitions to input and output the neccesary variables which I believe was at most 5 variables. You will also need to redo the error checking code that uses a cell array. Altogether I estimate about 30 minutes of work. I would have given you the work around in these files had the files not been copyrighted. So, unfortunately, you will have to implement the work around yourself.
Good luck!
K Scott -
CORBA MARSHAL and DATA_CONVERSION errors
Hi,
I'm developing a CORBA application and everything was well till now. I have to bring a lot of information from a database. When I run the method local (without ORB) everything goes well but when I do it through ORB it fails. I get two errors:
org.omg.CORBA.MARSHAL: Unmarshaller requested more data after end of stream vmcid: SUN minor code: 207 completed: No
org.omg.CORBA.DATA_CONVERSION: vmcid: OMG minor code: 1 completed: No
I can bring all kind of information except this. Does JDK's ORB have problems transporting huge sequences of structs? What`s the reason for this? How can I solve it? I'm currently using 1.4.
Any comentary can be useful
ThanksI got it,
I changed "string" for "wstring" in the IDL file. -
This is the situation we have:
1) We must support both C++ and Java clients that will be requesting
services from our EJBs running in WLS. The clients are internal apps running
in different companies and we would prefer to avoid requiring our clients to
use an ORB by a specific vendor. At the same time we do not want to deal
with potential problems related to the implementation differences by
different ORB vendors. What would be the best way to handle this situation?
2) WLS documentation has the following paragraph:
"WebLogic RMI over IIOP is the framework for EJB-to-CORBA mapping support.
Currently, however, a standard for passing user identity -- required to
implement EJB-to-CORBA mapping -- does not exist and the requirement for
transaction propagation from the client is in question. While RMI over IIOP
does allow CORBA clients to access EJBeans, the following services will not
be available:
EJB transaction services
EJB security services"
Does this mean that:
2.1) CORBA client initiated transactions will not be supported,
everything will work
2.2) None of the EJB security services will be available in EJB method
called by a CORBA client (i.e. getCallerPrincipal() and isCallerInRole()
will fail)
Thanks in advanceGenerally speaking, applications are built around common resources, namely the databases and security realms. Here, it seems you can't make any assumptions about the client at all, so you render useless the ability to propagate the transaction and security context; the upshot being that you couldn't
use it, even if we provided support for it, which we don't.
You also want to be shielded from all the incompatibilities between the ORB vendors, that is, you want to provide a client interface to call into an ejb, that will work irrespective of the orb the client runs. From this, I gather that you can have a 1.0 or 2.1 Tao, Visibroker, IONA, etc, orb as a
client, so you can not use objects in the interface.
To accomplish this, you need to do the following:
-- design the client interface so that it is stateless
-- design the interface so that it does not include any objects or structs... actually, you can use structs, it's just more complicated.
-- use server side transactions only (this follows from the statelessness of the interface)
-- either assume that ssl will be in place by the time you need it or include a token in the interface for the authenticated user
Please, read on...
"<=one way=>" wrote:
This is the situation we have:
1) We must support both C++ and Java clients that will be requesting
services from our EJBs running in WLS. The clients are internal apps running
in different companies and we would prefer to avoid requiring our clients to
use an ORB by a specific vendor. At the same time we do not want to deal
with potential problems related to the implementation differences by
different ORB vendors. What would be the best way to handle this situation?
We support IIOP as the transport. To call into any remote interface, you must provide a java.rmi.Remote interface, and code generate the IDL from that interface using weblogic.rmic. If you follow the above strictures, and use the -noValueTypes discussed earlier, you should be able to make progress
without the promised examples.... or you can wait for the examples.
>
2) WLS documentation has the following paragraph:
"WebLogic RMI over IIOP is the framework for EJB-to-CORBA mapping support.
Currently, however, a standard for passing user identity -- required to
implement EJB-to-CORBA mapping -- does not exist and the requirement for
transaction propagation from the client is in question. While RMI over IIOP
does allow CORBA clients to access EJBeans, the following services will not
be available:
EJB transaction services
EJB security services"
Does this mean that:
2.1) CORBA client initiated transactions will not be supported,
everything else (sic) will workYes.
>
2.2) None of the EJB security services will be available in EJB method
called by a CORBA client (i.e. getCallerPrincipal() and isCallerInRole()
will fail)No. The call will not fail, they will either provide values that correspond to the default or the user configured by the weblogic.iiop.user property.
>
>
Thanks in advance -
Hi,
I'm trying to use a method in CORBA Idl which uses
an array as in parameter. When I'm trying to call this
method by passing a properly initialized array from my
java program, I'm getting a nullPointerException in Java. The following is the scenario...
dbCorbaInterface.idl
=====================
module dbCorbaInterface{
struct Product{
string id;
string name;
typedef sequence<Product, 20> ProductList;
interface DBInterface{
boolean insertOrder(in ProductList prList);
DBInterfaceImpl.java
=====================
public class DBInterfaceImpl extends _DBInterfaceImplBase{
boolean insertOrder(Product [] prList){
Client.java
============
Product [] prList = new Product[20];
for(int i = 0; i <20; i++){
prList = new Product();
//Initialize the elements of the product array
prList.id = i;
prList.name = "";
//Assume there is an obj of DBInterface named DBI
DBI.InsertOrder(prList); // => Gives nullPointerException.
Can anyone help to solve this issue?
Rgds,
JaiHi,
I'd look on DBI interface initialization. You're getting nullPointerException because it's REALLY null. -
Hello
i am having some problems with a particular situation in CORBA. i am trying to invoke a server call and i am getting a BAD_PARAM exception (==? NULL references). Any kind of help would be greatly appreciated. Here is the sample codes:
IDL structure:
struct NestedStructure
string name;
sequence<NestedStructure> subField;
void getNestedStructure(out NestedStructureList data);
Server implementation :
public void getNestedStructure(NestedStructureListHolder data)
System.out.println(data.value);
data.value = myNestedStructure;
Client implementation :
public void getNestedStructure()
NestedStructureListHolder dataHolder = new NestedStructureListHolder();
myStub.getNestedStructure(dataHolder);
When i run them, i receive the following error message:
org.omg.CORBA.BAD_PARAM: vmcid: 0x0 minor code: 0 completed: No
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.inprise.vbroker.orb.SE.read(SE.java:28)
at com.inprise.vbroker.orb.DelegateImpl.handleReply(DelegateImpl.java:874)
at com.inprise.vbroker.orb.DelegateImpl.invoke(DelegateImpl.java:759)
at org.omg.CORBA.portable.ObjectImpl._invoke(Unknown Source)
...when i add some value to the holder on the client before making the remote call, i still get the same exceptions. Moreover, the system output on the server side is also NULL in this case.
Any kind of help would be most appreciated. This has been annoying me for a while now.
Kind regards,
viksolved :)
vik -
Can I send a Java HashTable using IDL and CORBA?
I have code that uses a HashTable implementation of the Map datatype. I would like to be able to send this datatype using IDL and CORBA without trying to map it to Struct, if at all possible. I have just started with this yesterday, IDL that is, have successfully run the Hello World over the network and passed a string variable instead of just the string, and would welcome any help whatsoever.
Thanks,
Teresa Redmond- Don't transfer the Hashtable at all, but writea
server, which gives access to the Hashtableentries
I think what Martin means is: why not let yourserver
actually do the work with the Hashtable in itself
instead of making the client do it?
Yes, exactly this is what I meant. And I will
strengthen your arguments, why building a server for
the Hashtables would probably be the best solution. So
first double-check, whether you can go this way,
before reading any further!
But anyway, if you want to look deeper into
serialization:
- Create an ObjectOutputStream consisting of a
ByteArrayOutputStream:
ByteArrayOutputStream baos = new
ByteArrayOutputStream(100);
ObjectOutputStream oos = new
ObjectOutputStream(baos);where "100" is the initial size in bytes.
- Write to this stream with
oos.writeObject(hashtable);
oos.flush();- Send the data as a sequence of bytes, which can be
accessed by:
baos.toByteArray()- on the receiving side, create an ObjectInputStream
from the received byteArray:
ByteArrayInputStream bais = new
ByteArrayInputStream(byteArray);
ObjectInputStream ois = new
ObjectInputStream(bais);- Then read the hashtable:
Hashtable h =
(Hashtable)ois.readObject();This is only a very coares description of the process,
but should just give some pointers to the basic way to
serialization.So, in the client, I could:
Map m = new HashMap();
//fill m
baosSize = m.getsizeofm();//pseudo method
ByteArrayOutputStream baos = new ByteArrayOutputStream(baosSize);
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(m);
oos.flush();
baos.toByteArray()and in the server code, I could:
ByteArrayInputStream bais = new ByteArrayInputStream(byteArray);
ObjectInputStream ois = new ObjectInputStream(bais);
Map mh = (HashMap)ois.readObject();is that about right? If that's the case, how do I write the idl file? is this a string? say, "string baos;"?
Thanks, guys, I really appreciate your help!
Maybe you are looking for
-
Download error after mountain lion upload
HI After I upgraded to 10.8 mountain lion I have since struggled to download firefox and adobe flash (get the error image file corrupted). Also I can't download in itunes (get error 50 or 8000). I have tried: reboot software update Recovery boot and
-
Got Windows 8 Questions? HP Win8 Expert Day – November 28, 2012
Thank you for coming to Expert Day – the event has now concluded. **To find out about future HP Expert Day events, check out this page** On behalf of the Experts, I would like to thank you for coming to the Forum to connect with us. We hope you will
-
Character conversion error: Unconvertible UTF-8 character beginning..
Hello, I'm using TrAX for XSLT transformations, and having a following problem Character conversion error: "Unconvertible UTF-8 character beginning with 0xa9" (line number may be too low). org.xml.sax.SAXParseException: Character conversion error: "U
-
Can I swap ram from a Powermac G4 400 PCI into a Powermac G4 Quicksilver?
Hi, I have a Powermac G4 400mhz PCI, but I'm looking at getting a Powermac G4 Quicksilver 933. I wondered if I can swap some ram from my Powermac G4 PCI into a Quicksilver. I have gone to the Crucial website and it says the Powermac G4 PCI and the Po
-
One week in USA with a Swiss Sim-Card can I naviga...
Hi I have Nokia maps licenced for europe (living in Switzerland) with a Swiss sim card in my handy. I will travel to the USA for 2 Weeks: I can licence USA for a short time to navigate by car there- OK. When I give in a route in the USA, does my hand