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

Error when calling java method returning Object

87 views
Skip to first unread message

Vlad Zlotskiy

unread,
Apr 22, 2004, 4:10:31 PM4/22/04
to
I have exact same problem when attempting to call nextElement() on
Enumeration, which suppose to return Object into my any variable. Under the
hood I guess PowerBuilder tries to immediately implicitly cast my any
variable into existing proxy that corresponds to the real underlying class
under the returned Object and produces an error in my case it is :

Failed to find the proxy to represent the java.class:
com.ibm.jms.JMSTextMessage. It implements the following interfaces:
javax.jms.TextMessage.

What puzzles me is that I have proxies for both classes in my PBL, in fact I
have a variable declared in the script of the corresponding proxy type.
I guess my question is there anything special about the way proxies are
located at runtime based on the underlying class and implemented interface.
From what I understand PB Proxy has no notion of interface all it knows is
the underlying class name and its ancestors.

I greately appreciate any help

Vlad


"Gökhan Demir" <gokhan...@igonline.biz> wrote in message
news:3FC77197...@igonline.biz...
> Hi,
>
> Your sample code successfully runs on my environment. I have PB9.0.1
> Build 6533, Sun JDK 1.4.2_02, w2k machine on a P3-800. Besides for your
> information, I have many other Java methods returning objects, I face
> the objects and wrap them into appropriate java classes within
> Powerbuilder code succesfully.
>
> You can contact me offline to give your e-mail address and I can send
> you the generated proxies for your java class and java.lang.StringBuffer
> in case you want to compare with yours.
>
> HTH,
> Gokhan
>
> jcsmonda wrote:
>
> > When I call a java method which the returned type in the
> > prototype is Object,
> > I have the following Error (in the case when the real type
> > of the returned object is StringBuffer) :
> > Failed to find the proxy to represent the java class:
> > java.lang.StringBuffer.
> > It implements the following interfaces:
> > java.io.Serializable;
> >
> > Have anybody the same problem ?
> > Or, can anyone successfully call such a method ?
> >
> > I use the EJBConnection method to access to java.
> > My version of PB is PB9.01 build 6533.
> >
> > Thanks for your help.
> >
> > Sample code:
> > Java class:
> > public class MyClass {
> > public Object getObject() {
> > return new StringBuffer("hello in getObject");
> > }
> >
> > public StringBuffer getStringBuffer() {
> > return new StringBuffer("hello in
> > getStringBuffer");
> > }
> > }
> >
> > Powerbuilder:
> > JavaVM l_JavaVM
> > EJBConnection l_EJBConn
> > String ls_classPath
> >
> > ls_classPath = "C:\HOMEWARE\JCS\ejbtest\bin"
> > l_JavaVM = CREATE JavaVM
> > l_JavaVM.CreateJavaVM(ls_classPath, True)
> > l_EJBConn = CREATE EJBConnection
> >
> > myclass l_myclass
> > l_EJBConn.CreateJavaInstance(l_myclass, "myclass")
> >
> > stringbuffer l_stringbuffer
> > Try
> > // No problem here
> > l_stringbuffer = l_myclass.getStringBuffer()
> > MessageBox("Success getStringBuffer",
> > l_stringbuffer.toString())
> > Catch (Exception e1)
> > MessageBox("Error getStringBuffer", e1.getMessage(),
> > Exclamation!)
> > End Try
> >
> > Any la_result
> > Try
> > // Error here
> > la_result = l_myclass.getObject()
> > MessageBox("Success getObject", "")
> > Catch (Exception e2)
> > MessageBox("Error getObject", e2.getMessage(),
> > Exclamation!)
> > End Try
> >
> > JC Smondack
>


markknight

unread,
Apr 7, 2005, 4:46:43 PM4/7/05
to
I have exactly the same problem as described below. If
anyone out there knows the answer to this riddle then please
tell me the answer as it is driving me nuts.
Thanks.

caru...@gmail.com

unread,
Jan 8, 2013, 12:08:21 PM1/8/13
to
Hi Did you get the solution of this error?

bruce.a...@yahoo.com

unread,
Feb 22, 2013, 8:21:57 PM2/22/13
to
Most of the groups shown in Google are no longer active on the Sybase server. In addition, the remaining Sybase newsgroups will be shut down shortly. If you post here most people who take the time to answer questions will never see it.

Instead, post your question in the SAP Community Network (SCN) PowerBuilder Developer Center forums:

http://scn.sap.com/community/developer-center/powerbuilder/content?filterID=content~objecttype~objecttype[thread]
0 new messages