Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML content is not forming when running from server

 
vidya sagar
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My project requires of creating a xml file by reading partial datas from EXcel file and another partial datas from Database.

When i try running a program as a standalone, XML was created with no issues, but when i run from server its not thorwing any error. File was created but no content was present in it.



Did i miss anything.....Few chunks of code i had pasted.

Any ideas/suggestions are welcome.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did not look at your code in detail, but looks like you are catching the exception and just calling printStacktrace(). This is not a good thing to do (specially in a server environment). The code is effectively eating up the exception.



You might want to first fix that and see if there are any errors thrown during the program execution.
 
vidya sagar
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I fix the exception block and even then i am not able to see any excpetion in the console.
 
Aneesh Vijendran
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

Are you only catching :



There could be some other exception rather than this ones caught. Just put the:
catch(Throwable e)


Also try to put debug statements in every line inside the writeXML- for the time being just use:



But make sure you use log4j or other logging framework.
 
vidya sagar
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Catching throwable also not helping me(No errors displayed).

i am assuming my problem may be similar to the problem posted here.

http://forums.sun.com/thread.jspa?threadID=615318

please tell me how to force websphere to use xml-apis.jar provided by sun jdk.

I placed the xml-apis under web-inf/lib which was not working.

Thanks in advance

 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know how that thread is related to your question. But to find out what's going on, you can attach a debugger (if you are using some IDE) and run your code.
 
vidya sagar
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To make code easier for others to understand, below is compact code



By running the above code as a standalone application the output was
Output : <?xml version="1.0" encoding="UTF-8"?>
<Document>
<Docid>1</Docid>
</Document>

But by running the above code in Websphere6.1, the output was
Output :

Nothing got printed in websphere console after the word output.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic