File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Servlet  + Oracle9Ii  help needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet  + Oracle9Ii  help needed" Watch "Servlet  + Oracle9Ii  help needed" New topic

Servlet + Oracle9Ii help needed

reda weldu

Joined: Sep 05, 2008
Posts: 1
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

Joined: Mar 22, 2000
Posts: 13036
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

Joined: Jan 10, 2002
Posts: 63844

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 .

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Servlet + Oracle9Ii help needed
It's not a secret anymore!