Skip to Content

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

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Apr 09, 2008 at 07:21 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 09, 2008 at 06:37 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 09, 2008 at 10:12 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • Posted on Apr 09, 2008 at 10:14 AM

    solved(temporarily)

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.