Skip to Content
author's profile photo Former Member
Former Member

debug and log Web Service

Hello,

i have a problem regarding web service. I wrote a web service (adapted to my needs) as described in the tutorial for java. But when it comes to testing, the web service throws an exception. The method itself is fine (tested and debugged with a local test client).

The question is, is there a way to debug the web service or is there a logfile in which the exception is described in detail?

Thanks in advanced for all replies

regards,

Rene

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2006 at 11:58 AM

    Hi,

    I think we have to debug using Local client program. Are you debugging like this.

    I hope you created web service from EJB. deploy J2EE application with JNDI name.

    Create simple java applcation do the following steps:

    public class SSample {

    public static void main(String[] args) {

    SampleEJB remote = null;

    try {

    Context ctx = new InitialContext();

    SampleEJBHome home = (SampleEJBHome) ctx.lookup("SampleJNDI");

    remote = home.create();

    } catch (Exception e) {

    System.out.println("Exception:" + e.getLocalizedMessage());

    }

    String result = remote.add(aFirst,aSecond,);

    System.out.print("Result:" + result);

    } catch (Exception ex) {

    System.out.println("Exception:" + ex.getLocalizedMessage());

    }

    }

    }

    Go To Run > choose your program(client program to call ejb method) >

    Arguments : VM Environment

    paste the following code

    -Djava.naming.factory.initial=com.sap.engine.services.jndi.InitialContextFactoryImpl -Djava.naming.provider.url=192.168.0.100:50004

    replace the server IP address with your server IP address where your ejbs are running.

    Under Class path settings for the program put the following jar files.

    You can search for them from net weaver soruce folders

    or copy from c:\usr\... (search under this folder)

    connector.jar

    activation.jar

    ejb20.jar

    ogging.jar

    exception.jar

    sapj2eeclient.jar

    sapj2eenginedeploy.jar

    and RUN >>>

    this makes testing of your client programs easier, you can find the error trace on which line and saves lot of time.

    Regards, Suresh KB

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Suresh,

      i solved the problem. The logging.jar was missing in the class path. But (as usual) i am facing a new problem. Now, i get a exception called: "Exception:Object not found in lookup of TestArrayJNDI". I assume that the client can not lookup the JNDI name. But when i check it in visual admin i can see an entrance for my bean.

      so do you have an idea?

      thanks a lot,

      Rene

  • Posted on Sep 27, 2006 at 11:33 AM

    Sure there is.

    Please go to the Debug" target="_blank">http://help.sap.com/saphelp_nw04s/helpdata/en/66/547f09281d464b951c9a3a6b06a12d/frameset.htm">Debug example and follow this one. As your webservice is just an EJB with an extension it works the same way for you!

    Regards,

    Benny

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Rene,

      There is quite a bit of posting in this thread, and as described in the forum hints, that could discourage some people from reading. Maybe if you post the most recent problem in a new post, that will attract more attention.

      To your problem, or more likely to the several problems you are having in this thread - the exceptions and its stacktrace should be seen in the server log files.

      These are found at something like

      :\usr\sap\<sid>\<id>\j2ee\cluster\server<number>\log

      It's hard to say where exactly the exception would go without knowing your application, but I would guess that the likely candidate should be the latest defaultTrace.trc file.

      If it's not there you may try to copy everything from there in a new location, reproduce the exceptions and check what files have increased their size. There you should see some information what is wrong.

      The other way you could deal is to attach via debugger like Benny has suggested, if you have the server already in a debug mode, just connect with the IDE, put a breakpoint in your code before you have invoked the web service, then trigger your code somehow and trace the execution.

      The IDE has also the possibility to make a breakpoint on any unhandled exception, there is such button in the debug view. You may try switching it on.

      If you want to invoke your bean from a standalone client and see the result, but you are unable to lookupi the JNDI name, then you should double check what exactly JNDI name you are supplying and under what name is your bean. The easiest way is to login at the server telnet administration (telnet 127.0.0.1 50008)

      (The telnet port should be the same as the HTTP on your server but with 8 as last digit), then execute those commands :

      jump 0

      add naming

      lsn > c:\my_naming.txt

      you should see in a nice way the JNDI tree on your server and you can check where is your bean and how it should be invoked. However I would personally not go to writing standalone program to see the exception. It sounds like less efforts to try some of the other suggestions.

      Btw, ideally, you should be able to code your application so that exceptions are reported in a nice way and you are sure where they are going. For example if your front end is a HTML, then a classic approach is to have an error page where the exceptions will be printed so that you don't have to search logs or debug the server.

      HTH

      Peter

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.