Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Creating proxy for a straight java class

8 posts in EJB Client Last posting was on 2005-06-17 02:00:43.0Z
Ravi Posted on 2005-06-16 05:48:05.0Z
From: "Ravi" <ravi@ses-ins.com>
Newsgroups: sybase.public.powerbuilder.ejbclient
Subject: Creating proxy for a straight java class
Lines: 13
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
X-Original-NNTP-Posting-Host: 198.172.117.2
Message-ID: <42b11291$1@forums-2-dub>
X-Original-Trace: 15 Jun 2005 22:48:01 -0700, 198.172.117.2
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 15 Jun 2005 22:48:02 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 15 Jun 2005 22:48:05 -0700
X-Trace: forums-1-dub 1118900885 10.22.108.75 (15 Jun 2005 22:48:05 -0700)
X-Original-Trace: 15 Jun 2005 22:48:05 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.ejbclient:540
Article PK: 424671

Hi,
We have lot of java classes ( not EJB's) compiled with jdk1.2.
We are trying to use them from Powerbuilder 9.
Does this work ? I was able to get a sample ( converter class ) working from
Pb 9.
But I am not able to create proxies for other pure java classes using EJB
Client proxy.
Can anyone please advise.

( earlier in Pb 7.0,we used these classes by wrapping these in EJB's
,deploying these in EA server and creating proxy stubs) .


Ravi Posted on 2005-06-16 13:33:39.0Z
From: "Ravi" <ravi@ses-ins.com>
Newsgroups: sybase.public.powerbuilder.ejbclient
References: <42b11291$1@forums-2-dub>
Subject: Re: Creating proxy for a straight java class
Lines: 22
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 198.172.117.2
X-Original-NNTP-Posting-Host: 198.172.117.2
Message-ID: <42b17fb3$1@forums-1-dub>
Date: 16 Jun 2005 06:33:39 -0700
X-Trace: forums-1-dub 1118928819 198.172.117.2 (16 Jun 2005 06:33:39 -0700)
X-Original-Trace: 16 Jun 2005 06:33:39 -0700, 198.172.117.2
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.ejbclient:541
Article PK: 424672

Never mind. I got a simple java class working .
But any one has ideas on how I can call a static method in a class?

"Ravi" <ravi@ses-ins.com> wrote in message news:42b11291$1@forums-2-dub...
> Hi,
> We have lot of java classes ( not EJB's) compiled with jdk1.2.
> We are trying to use them from Powerbuilder 9.
> Does this work ? I was able to get a sample ( converter class ) working
from
> Pb 9.
> But I am not able to create proxies for other pure java classes using EJB
> Client proxy.
> Can anyone please advise.
>
> ( earlier in Pb 7.0,we used these classes by wrapping these in EJB's
> ,deploying these in EA server and creating proxy stubs) .
>
>


Jim O'Neil [Sybase] Posted on 2005-06-16 13:58:09.0Z
From: "Jim O'Neil [Sybase]" <joneil_at_sybase_dot_com>
Newsgroups: sybase.public.powerbuilder.ejbclient
Subject: Re: Creating proxy for a straight java class
Message-ID: <eb13b1pogo76b624lk0fjcpk3gema78mai@4ax.com>
References: <42b11291$1@forums-2-dub> <42b17fb3$1@forums-1-dub>
X-Newsreader: Forte Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: joneilw2k.sybase.com
X-Original-NNTP-Posting-Host: joneilw2k.sybase.com
Date: 16 Jun 2005 06:58:09 -0700
X-Trace: forums-1-dub 1118930289 10.18.43.183 (16 Jun 2005 06:58:09 -0700)
X-Original-Trace: 16 Jun 2005 06:58:09 -0700, joneilw2k.sybase.com
Lines: 28
X-Authenticated-User: teamsybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.ejbclient:542
Article PK: 424674

You'd have to create an instance of the class, which means it's not
really static, but in addition to that, there is a bug so you won't be
successful at all if the method is static.

On 16 Jun 2005 06:33:39 -0700, "Ravi" <ravi@ses-ins.com> wrote:

>Never mind. I got a simple java class working .
>But any one has ideas on how I can call a static method in a class?
>
>
>
>"Ravi" <ravi@ses-ins.com> wrote in message news:42b11291$1@forums-2-dub...
>> Hi,
>> We have lot of java classes ( not EJB's) compiled with jdk1.2.
>> We are trying to use them from Powerbuilder 9.
>> Does this work ? I was able to get a sample ( converter class ) working
>from
>> Pb 9.
>> But I am not able to create proxies for other pure java classes using EJB
>> Client proxy.
>> Can anyone please advise.
>>
>> ( earlier in Pb 7.0,we used these classes by wrapping these in EJB's
>> ,deploying these in EA server and creating proxy stubs) .
>>
>>
>


Ravi Posted on 2005-06-16 15:48:34.0Z
From: "Ravi" <ravi@ses-ins.com>
Newsgroups: sybase.public.powerbuilder.ejbclient
References: <42b11291$1@forums-2-dub> <42b17fb3$1@forums-1-dub> <eb13b1pogo76b624lk0fjcpk3gema78mai@4ax.com>
Subject: Re: Creating proxy for a straight java class
Lines: 46
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
X-Original-NNTP-Posting-Host: 198.172.117.2
Message-ID: <42b19f50$1@forums-2-dub>
X-Original-Trace: 16 Jun 2005 08:48:32 -0700, 198.172.117.2
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 16 Jun 2005 08:48:33 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 16 Jun 2005 08:48:34 -0700
X-Trace: forums-1-dub 1118936914 10.22.108.75 (16 Jun 2005 08:48:34 -0700)
X-Original-Trace: 16 Jun 2005 08:48:34 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.ejbclient:543
Article PK: 424675

Thanks Jim.
But is there a workaround for this ? Is there a bug fix or do I have to get
Sybase support involved in this?
Because lot of our java classes have static methods and I dont have its a
good alternative to rewrite any of that code for the sake of Powerbuilder.


TIA
Ravi

"Jim O'Neil [Sybase]" <joneil_at_sybase_dot_com> wrote in message
news:eb13b1pogo76b624lk0fjcpk3gema78mai@4ax.com...
> You'd have to create an instance of the class, which means it's not
> really static, but in addition to that, there is a bug so you won't be
> successful at all if the method is static.
>
> On 16 Jun 2005 06:33:39 -0700, "Ravi" <ravi@ses-ins.com> wrote:
>
> >Never mind. I got a simple java class working .
> >But any one has ideas on how I can call a static method in a class?
> >
> >
> >
> >"Ravi" <ravi@ses-ins.com> wrote in message
news:42b11291$1@forums-2-dub...
> >> Hi,
> >> We have lot of java classes ( not EJB's) compiled with jdk1.2.
> >> We are trying to use them from Powerbuilder 9.
> >> Does this work ? I was able to get a sample ( converter class ) working
> >from
> >> Pb 9.
> >> But I am not able to create proxies for other pure java classes using
EJB
> >> Client proxy.
> >> Can anyone please advise.
> >>
> >> ( earlier in Pb 7.0,we used these classes by wrapping these in EJB's
> >> ,deploying these in EA server and creating proxy stubs) .
> >>
> >>
> >
>


Jim O'Neil [Sybase] Posted on 2005-06-16 18:16:20.0Z
From: "Jim O'Neil [Sybase]" <joneil_at_sybase_dot_com>
Newsgroups: sybase.public.powerbuilder.ejbclient
Subject: Re: Creating proxy for a straight java class
Message-ID: <scg3b19tstr6umacuj2nmicd6eff0jrpcj@4ax.com>
References: <42b11291$1@forums-2-dub> <42b17fb3$1@forums-1-dub> <eb13b1pogo76b624lk0fjcpk3gema78mai@4ax.com> <42b19f50$1@forums-2-dub>
X-Newsreader: Forte Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: joneilw2k.sybase.com
X-Original-NNTP-Posting-Host: joneilw2k.sybase.com
Date: 16 Jun 2005 11:16:20 -0700
X-Trace: forums-1-dub 1118945780 10.18.43.183 (16 Jun 2005 11:16:20 -0700)
X-Original-Trace: 16 Jun 2005 11:16:20 -0700, joneilw2k.sybase.com
Lines: 53
X-Authenticated-User: teamsybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.ejbclient:544
Article PK: 424678

It's a known bug but not currently being worked on. If you have a
support contract, you could defintely use that avenue to escalate it
for a fix. The workaround is to introduce a non-static method on the
same class (or a different one) that wraps the static method.

On 16 Jun 2005 08:48:34 -0700, "Ravi" <ravi@ses-ins.com> wrote:

>Thanks Jim.
>But is there a workaround for this ? Is there a bug fix or do I have to get
>Sybase support involved in this?
>Because lot of our java classes have static methods and I dont have its a
>good alternative to rewrite any of that code for the sake of Powerbuilder.
>
>
>TIA
>Ravi
>
>
>
>"Jim O'Neil [Sybase]" <joneil_at_sybase_dot_com> wrote in message
>news:eb13b1pogo76b624lk0fjcpk3gema78mai@4ax.com...
>> You'd have to create an instance of the class, which means it's not
>> really static, but in addition to that, there is a bug so you won't be
>> successful at all if the method is static.
>>
>> On 16 Jun 2005 06:33:39 -0700, "Ravi" <ravi@ses-ins.com> wrote:
>>
>> >Never mind. I got a simple java class working .
>> >But any one has ideas on how I can call a static method in a class?
>> >
>> >
>> >
>> >"Ravi" <ravi@ses-ins.com> wrote in message
>news:42b11291$1@forums-2-dub...
>> >> Hi,
>> >> We have lot of java classes ( not EJB's) compiled with jdk1.2.
>> >> We are trying to use them from Powerbuilder 9.
>> >> Does this work ? I was able to get a sample ( converter class ) working
>> >from
>> >> Pb 9.
>> >> But I am not able to create proxies for other pure java classes using
>EJB
>> >> Client proxy.
>> >> Can anyone please advise.
>> >>
>> >> ( earlier in Pb 7.0,we used these classes by wrapping these in EJB's
>> >> ,deploying these in EA server and creating proxy stubs) .
>> >>
>> >>
>> >
>>
>


Ravi Posted on 2005-06-16 23:55:19.0Z
From: "Ravi" <ravi@ses-ins.com>
Newsgroups: sybase.public.powerbuilder.ejbclient
References: <42b11291$1@forums-2-dub> <42b17fb3$1@forums-1-dub> <eb13b1pogo76b624lk0fjcpk3gema78mai@4ax.com> <42b19f50$1@forums-2-dub> <scg3b19tstr6umacuj2nmicd6eff0jrpcj@4ax.com>
Subject: Re: Creating proxy for a straight java class
Lines: 218
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
X-Original-NNTP-Posting-Host: 198.172.117.2
Message-ID: <42b21163$1@forums-2-dub>
X-Original-Trace: 16 Jun 2005 16:55:15 -0700, 198.172.117.2
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 16 Jun 2005 16:55:16 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 16 Jun 2005 16:55:19 -0700
X-Trace: forums-1-dub 1118966119 10.22.108.75 (16 Jun 2005 16:55:19 -0700)
X-Original-Trace: 16 Jun 2005 16:55:19 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.ejbclient:545
Article PK: 424677

Jim,
I seem to be having another issue. I created a wrapper java class (through
EJBClient proxy ) that instantiates other classes dynamically. Now my called
class is not able to get a database connection but if i put that connection
logic in the wrapper ,then its works fine.
Any ideas? See code below from powerbuilder and java to get the idea.

TIA
Ravi

/***************************************************************************
*********************
ls_args[1] = "datax.Job"
ls_args[2] = "run"
ls_args[3] = "24"
TRY
lEJBConn = CREATE EJBConnection
lEJBConn.CreateJavaInstance(lpb2java, "Pb2Java")
lpb2java.getjavaobject( ls_args)
//ls_ret = lpb2java.parse( ls_test,ls_comma)

CATCH ( Throwable t )
Messagebox("Fail",t.getMessage())
END TRY
/***************************************************************************
*********************

// add your custom import statements here

import java.lang.reflect.*;
import tims.*;
import java.util.*;
import univs.*;
import ses.util.*;
import datax.*;
import univs.util.*;

public class Pb2Java
{

public Pb2Java() {
}

public void getJavaObject(String[] args){
String classname;
String methodname;
int ret = 0;

Class cls = null;
Method mth = null;
Object object = null;
Object obj = null;

//ArrayList paramList = new ArrayList(); RP commented
String params[] = null; //RP 11/25/03
Object parameter[] = null;
Class cParam[] = null;


if (args.length < 1){
LogUtil.log("A Class Name is required to instantiate processor
class.",LogUtil.DEBUG);
System.exit(0);
}

LogUtil.log("Args: " + args.length,LogUtil.DEBUG);

classname = args[0];
methodname = args[1];
LogUtil.log("Class: " + classname,LogUtil.DEBUG);
LogUtil.log("Method: " + methodname,LogUtil.DEBUG);

/*
for (int i = 2; i < args.length; i++) {
paramList.add(args[i]);
}
*/
if ( args.length > 2 ) {
params = Utilities.parseStrToArray(args[2],",");
LogUtil.log("parms: " + args[2],LogUtil.DEBUG);

//int paramlength = paramList.size(); // RP
int paramlength = params.length;

parameter = new Object[paramlength];
cParam = new Class[paramlength];

for (int j = 0; j < paramlength; j++){
//parameter[j] = paramList.get(j); RP 11/25/03
parameter[j] = params[j];
//cParam[j] = String.class;
cParam[j] = parameter[j].getClass();
}
}


try {
cls = Class.forName(classname);

} catch (Exception e) {
LogUtil.log("forName error: " + e.getMessage() +
e.toString(),LogUtil.ERROR);
}


try {
LogUtil.log(classname + " loaded" ,LogUtil.DEBUG);
mth = cls.getMethod(methodname,cParam);
} catch (Exception e) {
LogUtil.log("getMethod error. " + e.getMessage() +
e.toString(),LogUtil.ERROR);
}

if ( mth != null ) {

try {
object = cls.newInstance();
LogUtil.log(classname + " instantiated" ,LogUtil.DEBUG);
} catch (Exception e) {
LogUtil.log("newInstance error. " + e.getMessage() +
e.toString(),LogUtil.ERROR);
}

try {
obj = mth.invoke(object,parameter);
LogUtil.log(methodname + " invoked" ,LogUtil.DEBUG);
} catch (Exception e) {
LogUtil.log(e.getMessage(),LogUtil.ERROR);
}

if ( obj == null )
LogUtil.log("Object is null",LogUtil.ERROR);
else{

Integer x = (Integer) obj;
int i = x.intValue();

}
}
//try {
// java.sql.Connection conn =
univs.db.DBConnectionManager.getDirectConnection("data_exchange") ;
// return 100;

//} catch (Exception e) {
// LogUtil.log(e.getMessage() + " " + e.toString());
// return -100;
//}

//return 1;
}
}

/***************************************************************************
********************

"Jim O'Neil [Sybase]" <joneil_at_sybase_dot_com> wrote in message
news:scg3b19tstr6umacuj2nmicd6eff0jrpcj@4ax.com...
> It's a known bug but not currently being worked on. If you have a
> support contract, you could defintely use that avenue to escalate it
> for a fix. The workaround is to introduce a non-static method on the
> same class (or a different one) that wraps the static method.
>
> On 16 Jun 2005 08:48:34 -0700, "Ravi" <ravi@ses-ins.com> wrote:
>
> >Thanks Jim.
> >But is there a workaround for this ? Is there a bug fix or do I have to
get
> >Sybase support involved in this?
> >Because lot of our java classes have static methods and I dont have its a
> >good alternative to rewrite any of that code for the sake of
Powerbuilder.
> >
> >
> >TIA
> >Ravi
> >
> >
> >
> >"Jim O'Neil [Sybase]" <joneil_at_sybase_dot_com> wrote in message
> >news:eb13b1pogo76b624lk0fjcpk3gema78mai@4ax.com...
> >> You'd have to create an instance of the class, which means it's not
> >> really static, but in addition to that, there is a bug so you won't be
> >> successful at all if the method is static.
> >>
> >> On 16 Jun 2005 06:33:39 -0700, "Ravi" <ravi@ses-ins.com> wrote:
> >>
> >> >Never mind. I got a simple java class working .
> >> >But any one has ideas on how I can call a static method in a class?
> >> >
> >> >
> >> >
> >> >"Ravi" <ravi@ses-ins.com> wrote in message
> >news:42b11291$1@forums-2-dub...
> >> >> Hi,
> >> >> We have lot of java classes ( not EJB's) compiled with jdk1.2.
> >> >> We are trying to use them from Powerbuilder 9.
> >> >> Does this work ? I was able to get a sample ( converter class )
working
> >> >from
> >> >> Pb 9.
> >> >> But I am not able to create proxies for other pure java classes
using
> >EJB
> >> >> Client proxy.
> >> >> Can anyone please advise.
> >> >>
> >> >> ( earlier in Pb 7.0,we used these classes by wrapping these in EJB's
> >> >> ,deploying these in EA server and creating proxy stubs) .
> >> >>
> >> >>
> >> >
> >>
> >
>


Jim O'Neil [Sybase] Posted on 2005-06-17 01:22:18.0Z
From: "Jim O'Neil [Sybase]" <joneil_at_sybase_dot_com>
Newsgroups: sybase.public.powerbuilder.ejbclient
Subject: Re: Creating proxy for a straight java class
Message-ID: <4d94b19uac7vv3dq6dospkt30cpv01tnik@4ax.com>
References: <42b11291$1@forums-2-dub> <42b17fb3$1@forums-1-dub> <eb13b1pogo76b624lk0fjcpk3gema78mai@4ax.com> <42b19f50$1@forums-2-dub> <scg3b19tstr6umacuj2nmicd6eff0jrpcj@4ax.com> <42b21163$1@forums-2-dub>
X-Newsreader: Forte Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vpn-concord-070.sybase.com
X-Original-NNTP-Posting-Host: vpn-concord-070.sybase.com
Date: 16 Jun 2005 18:22:18 -0700
X-Trace: forums-1-dub 1118971338 158.159.8.70 (16 Jun 2005 18:22:18 -0700)
X-Original-Trace: 16 Jun 2005 18:22:18 -0700, vpn-concord-070.sybase.com
Lines: 223
X-Authenticated-User: teamsybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.ejbclient:548
Article PK: 424679

nothing jumps out here. What error/exception do you get from the
connection attempt.

On 16 Jun 2005 16:55:19 -0700, "Ravi" <ravi@ses-ins.com> wrote:

>Jim,
>I seem to be having another issue. I created a wrapper java class (through
>EJBClient proxy ) that instantiates other classes dynamically. Now my called
>class is not able to get a database connection but if i put that connection
>logic in the wrapper ,then its works fine.
>Any ideas? See code below from powerbuilder and java to get the idea.
>
>TIA
>Ravi
>
>/***************************************************************************
>*********************
>ls_args[1] = "datax.Job"
>ls_args[2] = "run"
>ls_args[3] = "24"
>TRY
> lEJBConn = CREATE EJBConnection
> lEJBConn.CreateJavaInstance(lpb2java, "Pb2Java")
> lpb2java.getjavaobject( ls_args)
> //ls_ret = lpb2java.parse( ls_test,ls_comma)
>
>CATCH ( Throwable t )
> Messagebox("Fail",t.getMessage())
>END TRY
>/***************************************************************************
>*********************
>
>// add your custom import statements here
>
>import java.lang.reflect.*;
>import tims.*;
>import java.util.*;
>import univs.*;
>import ses.util.*;
>import datax.*;
>import univs.util.*;
>
>public class Pb2Java
>{
>
> public Pb2Java() {
> }
>
> public void getJavaObject(String[] args){
> String classname;
> String methodname;
> int ret = 0;
>
> Class cls = null;
> Method mth = null;
> Object object = null;
> Object obj = null;
>
> //ArrayList paramList = new ArrayList(); RP commented
> String params[] = null; //RP 11/25/03
> Object parameter[] = null;
> Class cParam[] = null;
>
>
> if (args.length < 1){
> LogUtil.log("A Class Name is required to instantiate processor
>class.",LogUtil.DEBUG);
> System.exit(0);
> }
>
> LogUtil.log("Args: " + args.length,LogUtil.DEBUG);
>
> classname = args[0];
> methodname = args[1];
> LogUtil.log("Class: " + classname,LogUtil.DEBUG);
> LogUtil.log("Method: " + methodname,LogUtil.DEBUG);
>
> /*
> for (int i = 2; i < args.length; i++) {
> paramList.add(args[i]);
> }
> */
> if ( args.length > 2 ) {
> params = Utilities.parseStrToArray(args[2],",");
> LogUtil.log("parms: " + args[2],LogUtil.DEBUG);
>
> //int paramlength = paramList.size(); // RP
> int paramlength = params.length;
>
> parameter = new Object[paramlength];
> cParam = new Class[paramlength];
>
> for (int j = 0; j < paramlength; j++){
> //parameter[j] = paramList.get(j); RP 11/25/03
> parameter[j] = params[j];
> //cParam[j] = String.class;
> cParam[j] = parameter[j].getClass();
> }
> }
>
>
> try {
> cls = Class.forName(classname);
>
> } catch (Exception e) {
> LogUtil.log("forName error: " + e.getMessage() +
>e.toString(),LogUtil.ERROR);
> }
>
>
> try {
> LogUtil.log(classname + " loaded" ,LogUtil.DEBUG);
> mth = cls.getMethod(methodname,cParam);
> } catch (Exception e) {
> LogUtil.log("getMethod error. " + e.getMessage() +
>e.toString(),LogUtil.ERROR);
> }
>
> if ( mth != null ) {
>
> try {
> object = cls.newInstance();
> LogUtil.log(classname + " instantiated" ,LogUtil.DEBUG);
> } catch (Exception e) {
> LogUtil.log("newInstance error. " + e.getMessage() +
>e.toString(),LogUtil.ERROR);
> }
>
> try {
> obj = mth.invoke(object,parameter);
> LogUtil.log(methodname + " invoked" ,LogUtil.DEBUG);
> } catch (Exception e) {
> LogUtil.log(e.getMessage(),LogUtil.ERROR);
> }
>
> if ( obj == null )
> LogUtil.log("Object is null",LogUtil.ERROR);
> else{
>
> Integer x = (Integer) obj;
> int i = x.intValue();
>
> }
> }
> //try {
> // java.sql.Connection conn =
>univs.db.DBConnectionManager.getDirectConnection("data_exchange") ;
> // return 100;
>
> //} catch (Exception e) {
> // LogUtil.log(e.getMessage() + " " + e.toString());
> // return -100;
> //}
>
> //return 1;
> }
>}
>
>/***************************************************************************
>********************
>
>
>"Jim O'Neil [Sybase]" <joneil_at_sybase_dot_com> wrote in message
>news:scg3b19tstr6umacuj2nmicd6eff0jrpcj@4ax.com...
>> It's a known bug but not currently being worked on. If you have a
>> support contract, you could defintely use that avenue to escalate it
>> for a fix. The workaround is to introduce a non-static method on the
>> same class (or a different one) that wraps the static method.
>>
>> On 16 Jun 2005 08:48:34 -0700, "Ravi" <ravi@ses-ins.com> wrote:
>>
>> >Thanks Jim.
>> >But is there a workaround for this ? Is there a bug fix or do I have to
>get
>> >Sybase support involved in this?
>> >Because lot of our java classes have static methods and I dont have its a
>> >good alternative to rewrite any of that code for the sake of
>Powerbuilder.
>> >
>> >
>> >TIA
>> >Ravi
>> >
>> >
>> >
>> >"Jim O'Neil [Sybase]" <joneil_at_sybase_dot_com> wrote in message
>> >news:eb13b1pogo76b624lk0fjcpk3gema78mai@4ax.com...
>> >> You'd have to create an instance of the class, which means it's not
>> >> really static, but in addition to that, there is a bug so you won't be
>> >> successful at all if the method is static.
>> >>
>> >> On 16 Jun 2005 06:33:39 -0700, "Ravi" <ravi@ses-ins.com> wrote:
>> >>
>> >> >Never mind. I got a simple java class working .
>> >> >But any one has ideas on how I can call a static method in a class?
>> >> >
>> >> >
>> >> >
>> >> >"Ravi" <ravi@ses-ins.com> wrote in message
>> >news:42b11291$1@forums-2-dub...
>> >> >> Hi,
>> >> >> We have lot of java classes ( not EJB's) compiled with jdk1.2.
>> >> >> We are trying to use them from Powerbuilder 9.
>> >> >> Does this work ? I was able to get a sample ( converter class )
>working
>> >> >from
>> >> >> Pb 9.
>> >> >> But I am not able to create proxies for other pure java classes
>using
>> >EJB
>> >> >> Client proxy.
>> >> >> Can anyone please advise.
>> >> >>
>> >> >> ( earlier in Pb 7.0,we used these classes by wrapping these in EJB's
>> >> >> ,deploying these in EA server and creating proxy stubs) .
>> >> >>
>> >> >>
>> >> >
>> >>
>> >
>>
>


Ravi Posted on 2005-06-17 02:00:43.0Z
From: "Ravi" <ravi@ses-ins.com>
Newsgroups: sybase.public.powerbuilder.ejbclient
References: <42b11291$1@forums-2-dub> <42b17fb3$1@forums-1-dub> <eb13b1pogo76b624lk0fjcpk3gema78mai@4ax.com> <42b19f50$1@forums-2-dub> <scg3b19tstr6umacuj2nmicd6eff0jrpcj@4ax.com> <42b21163$1@forums-2-dub>
Subject: Re: Creating proxy for a straight java class
Lines: 233
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 198.172.117.2
X-Original-NNTP-Posting-Host: 198.172.117.2
Message-ID: <42b22ecb$1@forums-1-dub>
Date: 16 Jun 2005 19:00:43 -0700
X-Trace: forums-1-dub 1118973643 198.172.117.2 (16 Jun 2005 19:00:43 -0700)
X-Original-Trace: 16 Jun 2005 19:00:43 -0700, 198.172.117.2
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.ejbclient:549
Article PK: 424680

never mind again...i can be such an idiot sometimes...
:)

"Ravi" <ravi@ses-ins.com> wrote in message news:42b21163$1@forums-2-dub...
> Jim,
> I seem to be having another issue. I created a wrapper java class (through
> EJBClient proxy ) that instantiates other classes dynamically. Now my
called
> class is not able to get a database connection but if i put that
connection
> logic in the wrapper ,then its works fine.
> Any ideas? See code below from powerbuilder and java to get the idea.
>
> TIA
> Ravi
>
>
/***************************************************************************
> *********************
> ls_args[1] = "datax.Job"
> ls_args[2] = "run"
> ls_args[3] = "24"
> TRY
> lEJBConn = CREATE EJBConnection
> lEJBConn.CreateJavaInstance(lpb2java, "Pb2Java")
> lpb2java.getjavaobject( ls_args)
> //ls_ret = lpb2java.parse( ls_test,ls_comma)
>
> CATCH ( Throwable t )
> Messagebox("Fail",t.getMessage())
> END TRY
>
/***************************************************************************
> *********************
>
> // add your custom import statements here
>
> import java.lang.reflect.*;
> import tims.*;
> import java.util.*;
> import univs.*;
> import ses.util.*;
> import datax.*;
> import univs.util.*;
>
> public class Pb2Java
> {
>
> public Pb2Java() {
> }
>
> public void getJavaObject(String[] args){
> String classname;
> String methodname;
> int ret = 0;
>
> Class cls = null;
> Method mth = null;
> Object object = null;
> Object obj = null;
>
> //ArrayList paramList = new ArrayList(); RP commented
> String params[] = null; //RP 11/25/03
> Object parameter[] = null;
> Class cParam[] = null;
>
>
> if (args.length < 1){
> LogUtil.log("A Class Name is required to instantiate processor
> class.",LogUtil.DEBUG);
> System.exit(0);
> }
>
> LogUtil.log("Args: " + args.length,LogUtil.DEBUG);
>
> classname = args[0];
> methodname = args[1];
> LogUtil.log("Class: " + classname,LogUtil.DEBUG);
> LogUtil.log("Method: " + methodname,LogUtil.DEBUG);
>
> /*
> for (int i = 2; i < args.length; i++) {
> paramList.add(args[i]);
> }
> */
> if ( args.length > 2 ) {
> params = Utilities.parseStrToArray(args[2],",");
> LogUtil.log("parms: " + args[2],LogUtil.DEBUG);
>
> //int paramlength = paramList.size(); // RP
> int paramlength = params.length;
>
> parameter = new Object[paramlength];
> cParam = new Class[paramlength];
>
> for (int j = 0; j < paramlength; j++){
> //parameter[j] = paramList.get(j); RP 11/25/03
> parameter[j] = params[j];
> //cParam[j] = String.class;
> cParam[j] = parameter[j].getClass();
> }
> }
>
>
> try {
> cls = Class.forName(classname);
>
> } catch (Exception e) {
> LogUtil.log("forName error: " + e.getMessage() +
> e.toString(),LogUtil.ERROR);
> }
>
>
> try {
> LogUtil.log(classname + " loaded" ,LogUtil.DEBUG);
> mth = cls.getMethod(methodname,cParam);
> } catch (Exception e) {
> LogUtil.log("getMethod error. " + e.getMessage() +
> e.toString(),LogUtil.ERROR);
> }
>
> if ( mth != null ) {
>
> try {
> object = cls.newInstance();
> LogUtil.log(classname + " instantiated" ,LogUtil.DEBUG);
> } catch (Exception e) {
> LogUtil.log("newInstance error. " + e.getMessage() +
> e.toString(),LogUtil.ERROR);
> }
>
> try {
> obj = mth.invoke(object,parameter);
> LogUtil.log(methodname + " invoked" ,LogUtil.DEBUG);
> } catch (Exception e) {
> LogUtil.log(e.getMessage(),LogUtil.ERROR);
> }
>
> if ( obj == null )
> LogUtil.log("Object is null",LogUtil.ERROR);
> else{
>
> Integer x = (Integer) obj;
> int i = x.intValue();
>
> }
> }
> //try {
> // java.sql.Connection conn =
> univs.db.DBConnectionManager.getDirectConnection("data_exchange") ;
> // return 100;
>
> //} catch (Exception e) {
> // LogUtil.log(e.getMessage() + " " + e.toString());
> // return -100;
> //}
>
> //return 1;
> }
> }
>
>
/***************************************************************************
> ********************
>
>
> "Jim O'Neil [Sybase]" <joneil_at_sybase_dot_com> wrote in message
> news:scg3b19tstr6umacuj2nmicd6eff0jrpcj@4ax.com...
> > It's a known bug but not currently being worked on. If you have a
> > support contract, you could defintely use that avenue to escalate it
> > for a fix. The workaround is to introduce a non-static method on the
> > same class (or a different one) that wraps the static method.
> >
> > On 16 Jun 2005 08:48:34 -0700, "Ravi" <ravi@ses-ins.com> wrote:
> >
> > >Thanks Jim.
> > >But is there a workaround for this ? Is there a bug fix or do I have
to
> get
> > >Sybase support involved in this?
> > >Because lot of our java classes have static methods and I dont have its
a
> > >good alternative to rewrite any of that code for the sake of
> Powerbuilder.
> > >
> > >
> > >TIA
> > >Ravi
> > >
> > >
> > >
> > >"Jim O'Neil [Sybase]" <joneil_at_sybase_dot_com> wrote in message
> > >news:eb13b1pogo76b624lk0fjcpk3gema78mai@4ax.com...
> > >> You'd have to create an instance of the class, which means it's not
> > >> really static, but in addition to that, there is a bug so you won't
be
> > >> successful at all if the method is static.
> > >>
> > >> On 16 Jun 2005 06:33:39 -0700, "Ravi" <ravi@ses-ins.com> wrote:
> > >>
> > >> >Never mind. I got a simple java class working .
> > >> >But any one has ideas on how I can call a static method in a class?
> > >> >
> > >> >
> > >> >
> > >> >"Ravi" <ravi@ses-ins.com> wrote in message
> > >news:42b11291$1@forums-2-dub...
> > >> >> Hi,
> > >> >> We have lot of java classes ( not EJB's) compiled with jdk1.2.
> > >> >> We are trying to use them from Powerbuilder 9.
> > >> >> Does this work ? I was able to get a sample ( converter class )
> working
> > >> >from
> > >> >> Pb 9.
> > >> >> But I am not able to create proxies for other pure java classes
> using
> > >EJB
> > >> >> Client proxy.
> > >> >> Can anyone please advise.
> > >> >>
> > >> >> ( earlier in Pb 7.0,we used these classes by wrapping these in
EJB's
> > >> >> ,deploying these in EA server and creating proxy stubs) .
> > >> >>
> > >> >>
> > >> >
> > >>
> > >
> >
>
>