Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

java code to export file from java application which is deployed in Unix Server to windows PC

I have a java application which I runs as expected on localhost (Windows 7). Basically the purpose of this application is to pull the data from database and display's on screen, if user wants this content to export it to his local machine then he can export it. This working as expected from my local machine (windows 7). After deploying the WAR file in Unix server and run it, then it is looking for location that I gave, it's not downloading the file. Here is the exception that I'm getting...

Error while generating report: C:/ArchieveTool/ArchieveTool/output/02012014020842.xls (No such file or directory)

java.lang.NullPointerException

at java.io.File.<init>(File.java:277)

at com.sw.sirax.process.MainServlet.exportFile(Unknown Source)

at com.sw.sirax.process.MainServlet.doPost(Unknown Source)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:205)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)

at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:744)

Here is the piece of code that I'm using to export the file:

enter code here

public String createExcelReport(DataHelper helper) throws Exception{

logger.finest("Entering");

Workbook wb = new HSSFWorkbook();

setCellData(helper, wb);

SimpleDateFormat format = new SimpleDateFormat("MMddyyyyhhmmss");

String filePath = "C:/ArchieveTool/ArchieveTool/output/" + System.getProperty("file.separator") + "ArchiveUtility_" + format.format(new Date()) + ".xls";

FileOutputStream stream = new FileOutputStream(filePath);

wb.write(stream);

stream.close();

logger.finest("Exiting");

return filePath;

}

private String generateReport(DataHelper helper){

String filePath = null;

try{

ExcelGenerator generator = new ExcelGenerator();

filePath = generator.createExcelReport(helper);

}catch(Exception ex){

logger.severe("Error while generating report: " + ex.getMessage());

}

return filePath;

}

Please let me know what to change in the code If I need to download that file to downloads folder in win 7 from application which is running on UNIX server...

please someone assist me here.

1 answer

0 votes

Could you explain what this has to do with Atlassian products?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Off-topic

Help us choose the ultimate fictional dream team! (Game + giveaway)

Hey everyone,  With Atlassian Team ‘21 just around the corner on April 28 (are you registered yet?) we’ve got teams on the brain. We need your help to answer a big question: what’s the ultima...

119 views 7 8
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you