cancel
Showing results for 
Search instead for 
Did you mean: 

the type AbstractStringBuilder is not visible ----- Please Help

srinivas_sistu
Active Contributor
0 Kudos

Hi Experts,

below is the code i wrote inside a view in webdynpro(java).

public void onActionSave(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionSave(ServerEvent)

//this.CreateXML();

StringBuffer strb=new StringBuffer("testStringBuffer");

strb.append("123");

strb.append(0);

wdComponentAPI.getMessageManager().reportSuccess(strb.toString());

//@@end

}

when i run this application i am getting an exception as given below.

java.lang.NoSuchMethodError: java/lang/StringBuffer.append(D)Ljava/lang/AbstractStringBuilder

and when i do

strb.append("123").append(0);

i am getting an exception stating that

"the type AbstractStringBuilder is not visible".

Please help me.

Thanks,

Srinivas

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Srinivas,

The problem is with the StringBuffer class ( gosh i have always had problems with it).

I found some abstract articles indicating that StringBuffer.append doesn't necessarily return StringBuffer anymore (see http://www.nearinfinity.com/blogs/page/sleberkn/20060721) so it seems like it can (or does) return AbstractStringBuffer even though the JDK still indicates it returns StringBuffer so then subsequent .append calls in the statement fail to compile.

As an alternative solution you can write something like

String strb=new String("testStringBuffer");

strb =strb + "123";

strb =strb + "0";

wdComponentAPI.getMessageManager().reportSuccess(strb);

Best Regards,

Ravi

Answers (3)

Answers (3)

srinivas_sistu
Active Contributor
0 Kudos

solved(temporarily)

srinivas_sistu
Active Contributor
0 Kudos

Hi Experts,

Thankyuou all for your replies. as said by all of you all the things are correct.

1. when i do a strringbuffer,append it is returning a AbstractStringBuilder rather than StringBuffer.

2.My JRE version no. is 1.6 where as my EPServer JRE version no. is 1.4

So what i did is i made use of string rather than stringbuffer, and done a concatination

i.e,

instead of

StringBuffer sb=new StringBuffer();

sb.append("str1");

sb.append("str2");

I did

String s=null;

s=s1+s2;

now my program is not running. I know using s1+s2 is not recomended, but to temporaryly solve my problem i did this. later i will try to change my JRE version(to make it compatable with my server's JRE).

Thank you all for your valuble sugessions.

Thanks,

Srinivas.

Former Member
0 Kudos

Why don't you just install the JDK version that is compatible with your NetWeaver version (see release notes) and change your NWDS settings to use this as default JDK? Using a higher version will lead to problems as soon as you use any features likes generics etc.

Armin

Former Member
0 Kudos

Hi Srinivas,

Try checking the versions of java runtime on server as well as on your machine. StringBuffer class throws error at runtime when Java Runtime version differs in client machine and server machine.

It happened to me once. In my machine JRE version was 1.6 while at server version was 1.4.2_13

Regards,

Gopal

srinivas_sistu
Active Contributor
0 Kudos

Hi Gopal,

thanks for yopur reply. in my system jre version no is 1.6, and i checked in my nwds there also it is 1.6

i am having a doubt,

that why stringbuffer.append.append is not supported in my studio?

as u said if the version no. are different then i will get an error at runtime.

but when i do stringbuffer.append.append i am getting an error at designtime it self,

and more over if try to import java.lang.AbstractStringBuilder in my view then also i am getting the same error as "java.lang.AbstractStringBuilder is not visible". please help me.

thanks,

Srinivas.

Former Member
0 Kudos

Hi,

Try to use the jdk version recomended by SAP for development else you will end up in even bigger issues.

which version of NWDS are you using?

Regards

Ayyapparaj

Former Member
0 Kudos

You have to use a JDK version that is supported by your NetWeaver version. Probably you are using NW 7.0 thus you should use JDK 1.4.x.

Armin

Former Member
0 Kudos

The reason why it gives "java.lang.AbstractStringBuilder is not visible" error is because the class AbstractStringBuilder is not public and cannot be accessed in your own class.

Regards

Ravi..

Former Member
0 Kudos

Hi Srinivas,

Please look into JRE version which is installed in your server where SAP J2ee engine in installed. It is better that your NWDS should have installed JRE version as 1.4.2_13.

Regards,

Gopal