This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet + Oracle9Ii help needed

reda weldu
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I stored a document to my database as a blob file. that is, firest I write a document in jEditor of netbeans and using sockets i stored it in the database.
I can display(retriev) it into the jEditor again.
However, when I tried to display the document in MSWORD, it gives the following problem;
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException.
at line 8 (of the following code).

The whole code of the servlet is:

1 InputStream is=null;
2 oracle.sql.BLOB blob=null;
3 HttpServletRequest req=null;
4 HttpServletResponse res=null;
5 String fileselected=(String) jList1.getSelectedValue();

6 OutputStream os;
7 try {
8 res.setContentType("application/msword"); // error here
9 os = res.getOutputStream();
10 try{
11 Statement st = con1.createStatement();
12 ResultSet rs = st.executeQuery("SELECT EDITED_FILE FROM DARAS.TBLEDIT WHERE EDITIONNAME="+fileselected);
while ({
int pos=0;
int length=0;
byte[] b = new byte[blob.getChunkSize()];
while((!= -1){

catch (SQLException se)
} catch ( ex) {
Could you correct it please?
I am also not sure what plug_ins to add.
with great regards
[ September 06, 2008: Message edited by: reda weldu ]
William Brogden
Author and all-around good cowpoke
Posts: 13045
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The stack trace should have included a line number for the exact statement that encountered a null pointer. That would be the place to start looking.

Bear Bibeault
Author and ninkuma
Posts: 64182
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to take the time to compose descriptive subjects for your posts; read this for more information.

Using a title of "servlet help needed" in a forum completely dedicated to questions on Servlets isn't very helpful.

Please go back and change your post to add a more meaningful subject by clicking the .
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic