部署在glassfish中的FileOutputStream NPE

时间:2019-05-14 08:21:09

标签: spring-boot glassfish-5

正如标题所述,该程序在tomcat中部署时运行良好。但是,当部署到我们的生产服务器glassfish中时,它将在此行中引发空指针异常。

@Autowired
ServletContext context;

FileOutputStream fileOut = new FileOutputStream(new File(context.getRealPath("resources/"+filename)));

0 个答案:

没有答案