0 Replies Latest reply on Mar 4, 2009 11:06 AM by Alex Cougarman

    Connect app to static content folder

    Alex Cougarman Apprentice

      Hi. I'm new to JBoss and have installed version 4.2.3.GA on my WinXP Pro system to match our server. The Java servlet needs to write an uploaded file to a folder on my machine. The app's is located in this folder:

      C:\jboss\jboss-4.2.3.GA\server\default\deploy\premupload.war


      Its structure is like this:
      ...\premupload.war
       \uploads\
       \WEB-INF\
       upload.jsp


      The upload folder (which is off the root of the app) is defined in the web.xml file as this:

      <context-param>
       <param-name>UploadDirectory</param-name>
       <param-value>/uploads/</param-value>
       </context-param>


      I try to fetch the upload folder using this line in the servlet:

      String uploadDirectory = this.getServletContext().getInitParameter("UploadDirectory");


      The app blows up with the following error referring to the above line:

      java.lang.NullPointerException
       org.unctv.fileupload.UploadHandler.doPost(UploadHandler.java:47)
       javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
       javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


      How do I refer to the upload directory? Does it need to be outside of the premupload.war folder? Your guidance is much appreciated. Thanks.