Hi all,500 Internal Server ErrorApplication error occurred during request processingDetails:com.sap.engine.services.webservices.wsnavigator.WSNavigatorException:nullException id: [0016355ABDF800580000016F00002C7800043D23C1985713]I get the above exception when I run my webservice. I dont find anyclue to debug my code, becuase i see little/nothing information thrownby the SAP j2ee engine. I dont get any exceptions while i compile, buti get this error when i am executing.i have two classes, which I use as datastructure to return values frommy websevice. Well, i will give you a psuedo code to make youunderstand better of what i have right now.Class klass_1{public String var1="";public String var2="";....public ArrayList arrList = new ArrayList();// setter and getter methods for the above class members.}Class klass_2{public String var1="";public String var2="";....// setter and getter methods for the above class members.}// following is a method in EJB, with that i have created a webservicepublic kclass1 method_name(String arg1) throws SQLException{// PreparedStatement to query database table// Execute query and get result set valuestry{//instantiate klass1 and set its member with resulted values fromabove queryklass1 k1 = new klass();k1.setMember_k1(result.getString(1));// Query database with second query statement// loop through result set you get from the above querywhile(result_set.next()){//instantiate klass2, initialiaze its members with resulted valuesfrom the second query, and add object of klass2 to 'arrList' of klass1klass2 k2 = new klass2();k2.setMember_k2(result.getString(1));....k1.arrList.add(k2); // This line is giving me problem. }}catch (SQLException e){....}catch (Exception e){....}finally{// close PreparedStatements, ResultSets, and connection obj to db.return k1;}}i know error-code: 500 occurs when there is problem with source. Butthe source compiles successfully. And also if i commentk1.arrList.add(k2); this line in the above code i execute thewebservice with no problem but i dont get completely what i shouldget.Can somebody help on this?thank you,kath.
|
|
0
|
|
|
|
Reply
|
nitte.sudhir (33)
|
10/23/2007 10:43:13 AM |
|
On Oct 23, 3:43 am, kath <nitte.sud...@gmail.com> wrote:> Hi all,>> 500 Internal Server Error> Application error occurred during request processing> Details:> com.sap.engine.services.webservices.wsnavigator.WSNavigatorException:> null> Exception id: [0016355ABDF800580000016F00002C7800043D23C1985713]>> I get the above exception when I run my webservice. I dont find any> clue to debug my code, becuase i see little/nothing information thrown> by the SAP j2ee engine. I dont get any exceptions while i compile, but> i get this error when i am executing.>> i have two classes, which I use as datastructure to return values from> my websevice. Well, i will give you a psuedo code to make you> understand better of what i have right now.>> Class klass_1> {> public String var1="";> public String var2="";> ...> public ArrayList arrList = new ArrayList();>> // setter and getter methods for the above class members.>> }>> Class klass_2> {> public String var1="";> public String var2="";> ...>> // setter and getter methods for the above class members.>> }>> // following is a method in EJB, with that i have created a webservice> public kclass1 method_name(String arg1) throws SQLException{> // PreparedStatement to query database table> // Execute query and get result set values>> try{> //instantiate klass1 and set its member with resulted values from> above query> klass1 k1 = new klass();> k1.setMember_k1(result.getString(1));>> // Query database with second query statement> // loop through result set you get from the above query> while(result_set.next()){> //instantiate klass2, initialiaze its members with resulted values> from the second query, and add object of klass2 to 'arrList' of klass1>> klass2 k2 = new klass2();> k2.setMember_k2(result.getString(1));> ...> k1.arrList.add(k2); // This line is giving me problem. }>> }catch (SQLException e){> ...> }catch (Exception e){> ...> }finally{>> // close PreparedStatements, ResultSets, and connection obj to db.> return k1;>> }> }>> i know error-code: 500 occurs when there is problem with source. But> the source compiles successfully. And also if i comment> k1.arrList.add(k2); this line in the above code i execute the> webservice with no problem but i dont get completely what i should> get.>> Can somebody help on this?>> thank you,> kath.A 500 will also occur when there is a runtime error(NullPointerException, ArrayIndexOutOfBounds..). Can you check the logfile for any exception traces?>From this pseudocode, it looks like the klass does not initializearrList. If arrList is not initialized as new ArrayList() or somethingsimilar, the statement k1.arrList.add(k2) will always throw aNullPointerException. In the declaration of klass, initialize arrListcorrectly and you should be good to go.-cheers,Manish
|
|
0
|
|
|
|
Reply
|
Manish
|
10/23/2007 6:37:23 PM
|
|
kath <nitte.sud...@gmail.com> wrote:>> Class klass_1This isn't even legal Java. You need to use the keyword "class" to define Java classes, which you haven't done.Also, class names should begin with an upper-case letter, and CamelCase thereafer. Underscores should only appear in the names of compile-time constants (which are spelled in all upper case by convention).>> {>> public String var1="";>> public String var2="";>> ...>> public ArrayList arrList = new ArrayList();It is usually bettera) to declare the variable as the interface type rather than the concrete type, andb) to use generics.>> public kclass1 method_name(String arg1) throws SQLException{Also, the word "class" appearing in class names is redundant.>> i know error-code: 500 occurs when there is problem with source. But>> the source compiles successfully. And also if i comment>> k1.arrList.add(k2); this line in the above code i execute the>> webservice with no problem but i dont get completely what i should>> get.Nitpick: the word "I" is capitalized.-- Lew
|
|
0
|
|
|
|
Reply
|
Lew
|
10/23/2007 9:36:24 PM
|
|
|
2 Replies
679 Views
(page loaded in 0.054 seconds)
|