1 2 Previous Next 17 Replies Latest reply on Jan 19, 2010 6:41 PM by peterj

    Where to deploy files for users to download

    notify

      I have a file which I will the user to be able to download by going to say;

       

      www.mydomain.com/downloadthis.pdf.

       

      Where in the JBoss directory structure would I put this file and do I need to configure anything?

       

      Currently my app is deployed as an EAR file in the directory;

       

      JBoss/Server/default/deploy/

       

      Many thanks.

        • 1. Re: Where to deploy files for users to download
          peterj

          There are several possibilites.

           

          a) You could place the downloadable file in the ROOT.war directory (if you told me which version of JBoss AS I could give you the exact location, but a find within the service configuration directory should locate it)

           

          b) You could deploly your EAR, and it's embedded WAR, as exploded directories. Then you could place the file in your WAR directory.

          http://community.jboss.org/wiki/ExplodedDeployment

           

          c) You can setup up an external directory

          http://community.jboss.org/wiki/ExternalDirectories

          • 2. Re: Where to deploy files for users to download
            notify

            jboss-4.2.3.GA

             

            Thanks.

            • 3. Re: Where to deploy files for users to download
              peterj
              server/xxx/deploy/jboss-web.deployer/ROOT.war
              • 4. Re: Where to deploy files for users to download
                notify

                If I deploy the file there I still get;

                 

                The requested resource (/MyFile.xxx) is not available.

                • 5. Re: Where to deploy files for users to download
                  peterj

                  What URL are you using?

                   

                  If you placed a file named downloadthis.pdf into the ROOT.war directory, then from a browser you would be able to access it using the URL you gave in your original post.

                  • 6. Re: Where to deploy files for users to download
                    notify

                    I've put a PDF in the ROOT.war directory on my server.

                     

                    and try and access it by;

                     

                    www.mydomain.com/test.pdf

                     

                    I get;

                     

                    The requested resource (/Test.pdf) is not available.

                    • 7. Re: Where to deploy files for users to download
                      peterj

                      Looks like a letter casing mismatch (test.pdf vs Test.pdf). What is the real name of the file (test.pdf or Test.pdf), and what is the actual URL you used? And are you running on Linux - if you are then casing matters.

                       

                      Also, just to double-check, your host's name is "www.mydomain.com" and you configured JBoss AS to listen to port 80. right?

                       

                      Or are you running Apache HTTP at port 80 and having it filter and forward the requests?

                       

                      Here is the full path of my PDF file: /opt/jbia/jboss-4.2.3.GA/server/admin/deploy/jboss-web.deployer/ROOT.war/test.pdf

                       

                      I can access it just fine using: http://localhost:8080/test.pdf

                       

                      On Linux, using http://localhost:8080/Test.pdf yields a "resourse not available" error.

                      • 8. Re: Where to deploy files for users to download
                        notify

                        www.mydomain.com has the beta version of my website and is in use on port 80. I have also put the PDF file on the localhost

                         

                        The PDF file is lowercase test.pdf. I am using the correct URL for both tests;

                         

                        www.mydomain.com/test.pdf & http://localhost:8080/test.pdf

                         

                        And in both cases I get;

                         

                        The requested resource (/test.pdf) is not available.

                         

                        I didn't mention that my web app is deployed under JBoss Seam;

                         

                        jboss-seam-2.2.0.GA

                         

                        Also tried;

                        Serving Static External Files in recent 4.x versions of jboss

                         

                        This works for Jboss 4.2.x and probably other versions as well.

                         

                        Step 1 (optional): Copy a default web.xml from <JBOSS_HOME>/server/<config-name>/deploy/http-invoker.sar/invoker.war/WEB-INF and place it in your external directory, for example: /home/pgib/images/WEB-INF


                        Step 2: Edit <JBOSS_HOME>/server/<config-name>/deploy/jboss-web.deployer/server.xml and add a Context element under Host.(Step similar to standalone TC)

                        <Host name="localhost" ...>
                                <!-- ADD static images DIRECTORY -->
                                <Context path="/images" 
                                        docBase="/home/pgib/images"
                                        reloadable="true">
                                </Context>
                                <!-- The rest of your Host entity -->
                        </Host>
                        

                         

                        This didn't work either!

                         

                        Is Seam the cause?

                         

                        Thanks for all you help.

                        • 9. Re: Where to deploy files for users to download
                          peterj

                          Seam is not the fault because Seam is not used by the ROOT app.

                           

                          How are you starting the app server? Are you using the -b option and is so what value are you specifying? See if this helps:

                          https://community.jboss.org/wiki/JBoss42FAQ

                          • 10. Re: Where to deploy files for users to download
                            notify

                            On the server the only way I could get the the application to run when the URL www.mydomain.com was entered was by starting JBoss with the command;

                             

                            run.bat -b 0.0.0.0

                             

                            On development machine (localhost) I start JBoss with the standard;

                             

                            run.bat

                             

                            (NO -b parameters)

                             

                            As it doesn't work with either I not sure what to do!

                            • 11. Re: Where to deploy files for users to download
                              peterj

                              Well, there is something about your environment or configuration that is causing this, but at this point I have run out of ideas of what it could be. I have asked every question I can think of.

                               

                              You say you cannot even access the file on your local development machine. I gave you the full path for my PDF file, and also the URL I used to successfully access it. Could you supply the same information for your development machine?

                              • 12. Re: Where to deploy files for users to download
                                notify

                                The test.pdf is located in;

                                 

                                C:\jboss-4.2.3.GA\server\default\deploy\jboss-web.deployer\ROOT.war\test.pdf

                                 

                                Thanks for all your help.

                                 

                                I need this facilty for users to download a BlackBerry application from the website. It's a bit of a show stopper.

                                • 13. Re: Where to deploy files for users to download
                                  peterj

                                  Based on the PDF file's location, and the way you start the app server, entering http://localhost:8080/test.pdf into the browser's address bar and hitting enter should cause the PDF to be downloaded (or opened, depending on the browser you are using and the browser's configuration). Heck, I even just now checked with Explorer and Chrome, my earlier attempt was with Firefox. All three worked.

                                   

                                  For now, let's try to get this working on just your development machine; once that is working we will go back to www.mydomain.com.

                                   

                                  Have you made any changes to any of the files that came with 4.2.3?

                                   

                                  Could you try using a clean installation of 4.2.3 in another location (say at c:\temp\jboss-4.2.3.GA)? Deploy only the test.pdf file - do not deploy your app.

                                   

                                  Also, what happens when you enter just http://localhost:8080?

                                  • 14. Re: Where to deploy files for users to download
                                    notify

                                    http://localhost:8080;

                                     

                                    The home (seam) page of my app loads and displays. Maybe this is the cause?

                                     

                                    A number of changes to deploy my EJBs, SEAM configuration ejb-jar.xml, jboss.xml, web.xml.

                                     

                                    ***** UPDATE *****

                                     

                                    Deployed the PDF to a clean installation of JBoss 5.1 and I can open the PDF with;

                                     

                                     

                                    http://localhost:8080/test.pdf

                                     

                                     

                                    I now suspect it is the configuration to open the home page when I type http://localhost:8080

                                    1 2 Previous Next