Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PB cannot find existing proxy object

60 views
Skip to first unread message

toad

unread,
Oct 25, 2007, 3:52:50 PM10/25/07
to
Hello,

I'm using PB 10.5.1 & JRE 1.5. Even though the proxy class "Header"
exists in the list of PB generated proxys, I am getting the following
java exception error within PB:

"Failed to find the proxy to represent the java class: Header."

Any suggestions?

Thanks,
Doug

Gokhan Demir

unread,
Oct 26, 2007, 5:13:05 AM10/26/07
to
Hmm I never had sthg like this. At which point do you see this
exception? Can you send your code block? Also the exported library entry
for your java class?

Some things that come to my mind includes (all to be read as maybe):
. a possible typo in the createJavaInstance method call
. wrong pbl list
. generated proxy object does not compile
. your java class does not have an empty constructor

Hth,
Gokhan

toad

unread,
Oct 26, 2007, 11:33:36 AM10/26/07
to
> > "Failed to find the proxy to represent the java class: Header."

The PB code calls a java method (HashTest.getHashtable) that returns a
Hashtable which contains the object "Header". Calling the method
Hashtable.containskey("RESPONSE.HEADER") returns "true" but calling
the method Hashtable.get("RESPONSE.HEADER") results in the java
exception.

PB code:
=======
Hashtable i_Hashtable
HashTest i_HashTest
Header i_Header
any i_any

i_JavaVM = CREATE JavaVM
i_JavaVM.createJavaVM( "OSSClient.jar;corbaconn.jar;swalog4j.jar",
TRUE )
i_JavaVM.createJavaInstance(i_Hashtable, "Hashtable" )
i_JavaVM.createJavaInstance(i_HashTest, "HashTest" )
i_JavaVM.createJavaInstance(i_Header, "Header" )

try

i_Hashtable = i_HashTest.getHashtable()

messagebox("Hashtable",string(i_Hashtable.containskey("RESPONSE.HEADER")))
i_any = i_Hashtable.get("RESPONSE.HEADER")

catch (Throwable t)
messagebox("Exception Error", t.getmessage())
end try

Exported proxy for HashTest:
=====================

$PBExportHeader$hashtest.srx
$PBExportComments$Proxy imported from EJB through EJB Proxy generator.
global type HashTest from nonvisualobject
end type

type variables
protected:
string HashTest_javaname= "HashTest"
end variables

forward prototypes
public:
subroutine HashTest() alias for "<init>,()V"
subroutine dummyHeader( Header Header_1) alias for "dummyHeader,
(LHeader;)V"
subroutine dummyRoute( Route Route_1) alias for "dummyRoute,
(LRoute;)V"
subroutine dummySegment( Segment Segment_1) alias for "dummySegment,
(LSegment;)V"
function HashTest getHashTest() alias for "getHashTest,()LHashTest;"
function Hashtable getHashtable() alias for "getHashtable,()Ljava/
util/Hashtable;"
function Hashtable getHashtable2() alias for "getHashtable2,()Ljava/
util/Hashtable;"
function string getMyName() alias for "getMyName,()Ljava/lang/
String;"
subroutine main( string string_1[]) alias for "main,([Ljava/lang/
String;)V"
subroutine printHashtable( Hashtable Hashtable_1) alias for
"printHashtable,(Ljava/util/Hashtable;)V"
end prototypes


Exported proxy for Header:
====================

$PBExportHeader$header.srx
$PBExportComments$Proxy imported from EJB through EJB Proxy generator.
global type Header from nonvisualobject
end type

type variables
protected:
string Header_javaname= "Header"
end variables

forward prototypes
public:
subroutine Header() alias for "<init>,()V"
function string getDestination() alias for "getDestination,()Ljava/
lang/String;"
function string getNumOfRoute() alias for "getNumOfRoute,()Ljava/lang/
String;"
function string getOrigin() alias for "getOrigin,()Ljava/lang/
String;"
function string getRequestid() alias for "getRequestid,()Ljava/lang/
String;"
subroutine setDestination( string string_1) alias for
"setDestination,(Ljava/lang/String;)V"
subroutine setNumOfRoute( string string_1) alias for "setNumOfRoute,
(Ljava/lang/String;)V"
subroutine setOrigin( string string_1) alias for "setOrigin,(Ljava/
lang/String;)V"
subroutine setRequestid( string string_1) alias for "setRequestid,
(Ljava/lang/String;)V"
end prototypes

Thanks for you time!!!!


Gokhan Demir

unread,
Oct 27, 2007, 10:11:51 AM10/27/07
to
In my opinion, your code would be working well under normal conditions.
Anyway, I have some notes:

1) you have to give the full path of your java class to the
createJavaInstance method (i.e. not "Hashtable", but
"java.lang.Hashtable").

2) in your code, there is no need to call createJavaInstance for
Hashtable and for Header classes.

3) It is always a good practice to check the return value of the
createJavaInstance method, since, instead of throwing an exception, this
method just returns a long to indicate its success/failure status.

4) I am thinking loudly. From the exception text, I assume that
i_Hashtable.get("RESPONSE.HEADER") does not return a null. So what can
it be? Here what comes to my mind (again these should be read as maybe):

a) double check the PBL holding the proxy for Header class is in your
PBL library search list.

b) Regenerate the proxy for your java classes. Empty the PBL holding
your proxy objects to make sure you have an up-to-date proxy object for
your java classes.

c) Be sure you are using the same jar files (all) when generating
proxies and when running your application. That way you eliminate the
risk of not finding java classes that Header java class depends.

If these does not make any difference:

d) (here I go paranoiac) the class Header does not have a java package,
and it is kinda generic name. Can it be that its somewhat generic name
is fooling Powerbuilder? You can try refactoring this Header class, and
move it to a java package and change its name to for instance Headerx :)

e) I have seen cases where certain Powerbuilder builds behave
differently. For example pb 9.0.2 build 7534 can return the exception
text from a java class, but 9.0.3 latest build cannot. I would take my
time and try the same code with a different pb build to see if it is a
pb bug. Trying with pb 9, 10 or 11 would be nice too. If you can see
your code runs under any of these versions, you can consider opening a
support case with Sybase.

f) Make an executable of your application and try with the executable as
well to see if you get the same exception. If it works in executable but
does not work in dvlp environment, open a support case with Sybase.

One final note:

g) If your java code were running on an app server (so, a different jvm)
then it would be that the returned serialized java class uid mismatch
with what class is available in your client side classpath. However from
your code, I can surely tell that this is not the case for you.

That's all I can imagine.

Regards,
Gokhan Demir

toad

unread,
Oct 29, 2007, 4:31:36 PM10/29/07
to
Gokhan,

First off, I really appreciate you taking the time to reply back. I
went though all your suggestions and tried a few more things but
unfortunately the result is the same. I was hoping to stumble across
something I was doing wrong but it looks like yet another PB quirk :(

Gokhan Demir

unread,
Oct 29, 2007, 4:14:18 PM10/29/07
to
Ok then. Next thing is to open a support case with Powerbuilder. Please
prepare a reproducible support case. Eliminate your business logic from
your java classes and try to simplify the situation as mush as you can
do. Sybase engineering staff is very responsive to ejb client bug cases.
I'm sure you get very fast response from Sybase.

Good bye.
Gokhan.

toad

unread,
Nov 1, 2007, 3:02:19 PM11/1/07
to
no PowerBuilder :(

0 new messages