GeeCON Prague 2014*
The moose likes JBoss/WildFly and the fly likes unable to open excel document Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "unable to open excel document" Watch "unable to open excel document" New topic
Author

unable to open excel document

rutuja patil
Greenhorn

Joined: Dec 17, 2009
Posts: 23
I am trying to open the excel document in my web application. I am using apache poi api for excel documents. My application runs on jboss and it is not able to open the excel sheet. It works fine on weblogic. But when I run it on jboss it doesn't open the excel document.

Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42061
    
  64
What does "it doesn't open" mean? What happens when you run the code that is supposed to open the file? Also post the code using CODE tags.


Ping & DNS - my free Android networking tools app
rutuja patil
Greenhorn

Joined: Dec 17, 2009
Posts: 23
actually in application there is a jsp page which opens the excel document in new window:


when user clicks on Excel link it gives the pop up box saying could not open the userList.xls document.

As per application, when user clicks on Excel link it calls the servelet which creates the excel document using apache poi. I put some log messages in app code and all code getting executed successfully.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42061
    
  64
How have you verified that what the server streams to the browser upon clicking the link is, in fact, a proper Excel document?
rutuja patil
Greenhorn

Joined: Dec 17, 2009
Posts: 23
The server didn't have a problem creating this stream in WebLogic 9.2. The code used to create the document and associated stream have not been altered in the conversion to JBoss. Upon examining the logs it also appears that the stream is created successfully, but the results don't show up in the browser tab. IE will display the message "Microsoft Office Excel cannot access the file. There are several possible reasons: The filename or path doesn't exist, The file is being used by another program, The workbook you are trying to save has the same name as a currently open workbook." I believe that this message is a red herring to the real problem, but the application logs have been less than forthcoming.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42061
    
  64
So what's the answer to my question?
rutuja patil
Greenhorn

Joined: Dec 17, 2009
Posts: 23
I am sorry, but I don't know how to verify the stream. can you please tell me how to verify? i just tried to explain what i did to figure out the problem...
rutuja patil
Greenhorn

Joined: Dec 17, 2009
Posts: 23
I found the solution. I added the following two lines in servelet and it worked:
response.setHeader("Pragma", "public");
response.setHeader("Cache-Control", "max-age=0");

Thanks.
 
GeeCON Prague 2014
 
subject: unable to open excel document