Include file - Bad file argument to include

Hi,
I have <%@ include file="includes/header.jsp" %> and it seems to be returning "Bad file argument to include" and i cannot work out why.
Thanks

Careful with full paths: It's a standard relative jsp path: See this explanation from the syntax reference:
"If the relative URL starts with /, the path is relative to the JSP application's context, [...] . If the relative URL starts with a directory or file name, the path is relative to the JSP file. "

Similar Messages

  • Apache-zip.jar name attachment file bad encoding

    I have following code. which create zip archive, but name attachment files bad encoding.
    name attachment files in encoding UTF-8. letters of Russian alphabet -"&#1080;&#1084;&#1103;.txt". get - "¯à¨ï⨥  à鸞.txt" OS - Ubuntu 9.10 64-b
    package action;
    import org.apache.tools.zip.ZipEntry;
    import org.apache.tools.zip.ZipOutputStream;
    import java.io.*;
    import java.util.Arrays;
    import java.util.List;
    public class CreateArchive {
        private byte[] getByteFromFile(String file) throws IOException {
            InputStream is = new FileInputStream(file);
            long length = file.length();
            if (length > Integer.MAX_VALUE) {
                throw new IOException("Size file bad: "+file);
            byte[] bytes = new byte[(int)length];
            int offset = 0;
            int numRead;
            while (offset < bytes.length && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {
                offset += numRead;
            if (offset < bytes.length) {
                throw new IOException("Could not completely read file "+file);
            is.close();
            return bytes;
        public void createZip(OutputStream outputStream, List<String> files) {
            byte[] buf = new byte[1024];
            try {
                ZipOutputStream out = new ZipOutputStream(outputStream);
                out.setEncoding("UTF-8");
                for (String fileName: files) {
                    ByteArrayInputStream sourceStream = new ByteArrayInputStream(getByteFromFile(fileName));
                    out.putNextEntry(new ZipEntry(fileName));
                    int len;
                    while ((len = sourceStream.read(buf)) != -1) {
                        out.write(buf, 0, len);
                    out.closeEntry();
                out.close();
            } catch (IOException e) {
                System.out.print(e);
        public static void main(String[] args) throws IOException {
            CreateArchive files = new CreateArchive();
            OutputStream outputStream = new FileOutputStream("file.zip");
            files.createZip(outputStream, Arrays.asList("&#1080;&#1084;&#1103;.txt"));
            outputStream.close();
    }Sorry for me bad english
    Edited by: P1tBull on Mar 24, 2010 5:35 AM

    Real task was create general archive is selected users files and transmission he in one stream
    package action;
    import org.apache.tools.zip.ZipEntry;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.*;
    import java.util.Arrays;
    import java.util.List;
    import java.util.zip.ZipOutputStream;
    public class StreamFiles extends HttpServlet {
        protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            doGet(request, response);
        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            OutputStream out = response.getOutputStream();
            try {
                response.setContentType("'application/zip'; charset='UTF-8'");
                response.setContentType("name=AllFile");
                response.setHeader("Content-disposition", "attachment; filename*=utf-8" + "''" + java.net.URLEncoder.encode("AllFile.zip", "UTF-8") + ";");
                if (request.getHeader("user-agent") != null) {
                    if (request.getHeader("user-agent").indexOf("Safari") != -1) {
                        response.setHeader("Content-Disposition", "attachment");
                        response.setContentType("application/octet-stream");
                    } else if (request.getHeader("user-agent").indexOf("MSIE") != -1 || request.getHeader("user-agent").indexOf("Chrome") != -1) {
                        response.setHeader("Content-disposition", "attachment; filename=" + java.net.URLEncoder.encode("AllFile.zip", "UTF-8"));
                List<String> files = Arrays.asList("catalina.bat", "startup.sh", "version.sh", "tomcat-juli.jar");
                createZip(out, files);
            } catch (Exception ex) {
                request.setAttribute("javax.servlet.jsp.jspException", ex);
                RequestDispatcher requestDispatcher = request.getRequestDispatcher("/error.jsp");
                requestDispatcher.forward(request, response);
            } finally {
                out.flush();
                out.close();
        private byte[] getByteFromFile(String file) throws IOException {
            InputStream is = new FileInputStream(file);
            long length = file.length();
            if (length > Integer.MAX_VALUE) {
            byte[] bytes = new byte[(int)length];
            int offset = 0;
            int numRead;
            while (offset < bytes.length && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {
                offset += numRead;
            if (offset < bytes.length) {
                throw new IOException("Could not completely read file "+file);
            is.close();
            return bytes;
        public void createZip(OutputStream outputStream, List<String> files) {
            byte[] buf = new byte[1024];
            try {
                ZipOutputStream out = new ZipOutputStream(outputStream);
                for (String fileName: files) {
                    ByteArrayInputStream sourceStream = new ByteArrayInputStream(getByteFromFile(fileName));
                    out.putNextEntry(new ZipEntry(fileName));
                    int len;
                    while ((len = sourceStream.read(buf)) != -1) {
                        out.write(buf, 0, len);
                    out.closeEntry();
                out.close();
            } catch (IOException e) {
                System.out.print(e);
    }but mistake on real host don't repeated, so thanks for answer
    Edited by: P1tBull on Mar 24, 2010 8:14 AM

  • Mhddfs / FUSE 'Bad file descriptor' issue

    Hi,
    I have a Seagate Goflex Home running archlinuxarm. Everything is working fine other than an issue I'm having with mhddfs while unioning several hard drives. I seem to be able to write to any of the drives individually but when I use the union share via mhddfs, it always returned this error when writing a file: 'Bad file descriptor'.
    When I try to do nano <new file name.txt>, it gives me the bad file descriptor error. However, if I persist after the initial error and try to save a second time it saves without any addition errors.
    Also, if I try to copy a file over samba to the union share, I get the error 'Invalid file name'. This happens for all files whether they have special characters or not.
    I'm a bit confused as to why this is happening. I've had mhddfs working well in the past. Does anyone know what could be causing this?
    Last edited by LightC (2013-05-09 15:15:24)

    Drawing Business wrote:
    I then tried using "find" to look for single large files, using "sudo find / -size +94371840" (anything larger than 90Gb), and I get the following errors:
    find: /dev/fd/3: Bad file descriptor
    find: /dev/fd/4: Not a directory
    find: /dev/fd/5: Not a directory
    This is not an error and always happens with find unless you exclude the /dev hierarchy from the search. (Interestingly this seems to have gone away with 10.5??)
    To locate your missing space, try WhatSize. Another alternative which I have not used personally is Disk Inventory X.
    As an additional point, with 10.4 it is actually better to use Disk Utility, since it does more than fsck: Resolve startup issues and perform disk maintenance with Disk Utility and fsck, quote:
    Note: If you're using Mac OS X 10.4 or later, you should use Disk Utility instead of fsck, whenever possible.

  • How do I include a JAVA file in my website  using DreamweaverCC ?

    Hi.  I searched the forums and it seems that all questions relating to JAVA and Dreamweaver elicit zero replies.
    I hope that someone has some direction.  Thanks again.
    I have a JAVA file that I want to include or have run within one of my pages in my WebSite.
    file > new > create > and there is not an option for JAVA but there is one for PHP etc. etc.
    How do I incorporate a java script into my Web Site ?
    I thought that I could just copy the code into the file here - at least to begin with  - but JAVA  runs in the background.
    I am lost
    conceptually
    and I do not know how to go about this task
    structurally.
    Thanks again,
    Regina

    JQuery is a core JavaScript library used by millions of web sites.  It's the "do more & write less code framework."  If you're into re-inventing the wheel every time you need an advanced feature (plugin), feel free to manually code it yourself with JavaScript.  However, you'll need to test & debug your scripts in every conceivable browser and OS before you can be sure it's viable for use on a production site.
    On the other hand, you could use a plugin and be up & running in 5 minutes or less. See the code below.
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>HTML5, with Fancybox2 Viewer</title>
    <!--[if lt IE 9]>
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <!--LATEST JQUERY CORE LIBRARY-->
    <script src="http://code.jquery.com/jquery-latest.min.js"></script>
    <!--FANCYBOX plugins-->
    <link href="http://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.4/jquery.fancybox.css" rel="stylesheet" media="screen">
    <script src="http://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.4/jquery.fancybox.pack.js"></script>
    <style>
    body {
        background: silver;
        font-family:Segoe, "Segoe UI", "DejaVu Sans", "Trebuchet MS", Verdana, sans-serif;
    #wrapper {
        width: 1000px; margin:0 auto;
        background:#FFF;
    /**this styles image container**/
    #thumbs p {
        float: left;
        width: 180px;
        height: 12.5em;
        margin: 10px 22px 0 22px; /**space between containers**/
        padding: 10px; /**space around containers**/
        border: 1px solid silver;
        /**rounded borders**/
        -moz-border-radius: 20px;
        -webkit-border-radius: 20px;
        border-radius: 20px;
        /**this styles caption text**/
        font: italic 14px/1.5 Geneva, Arial, Helvetica, sans-serif;
        color: #666;
        text-align: center;
    /**recommend using same size images**/
    #thumbs img {
        width: 160px; /**adjust width to thumbnail**/
        height: 120px; /**adjust height to thumbnail**/
        margin-bottom: 1.5em;
        opacity: 0.75;
    #thumbs img:hover { opacity: 1.0 }
    /**float clearing**/
    #thumbs:after {
        content: ".";
        clear: left;
        font-size: 0px;
        line-height: 0;
        display: block;
        visibility: hidden;
    </style>
    </head>
    <body>
    <div id="wrapper">
    <h1><a href="http://fancyapps.com/fancybox/">Fancybox2</a> Viewer with images</h1>
    <!--insert thumbnails with links to full size images below-->
    <div id="thumbs">
    <p><a class="fancybox" data-fancybox-group="gallery" href="http://placehold.it/400x320.jpg" title="optional captions"><img src="http://placehold.it/160x120.jpg" alt="Thumbnail 1" /></a> <br />
    Caption 1 </p>
    <p><a class="fancybox" data-fancybox-group="gallery" href="http://placehold.it/400x320.jpg" title="optional captions"><img src="http://placehold.it/160x120.jpg" alt="Thumbnail 2" /></a> <br />
    Caption 2 </p>
    <p><a class="fancybox" data-fancybox-group="gallery" href="http://placehold.it/400x320.jpg" title="optional captions"><img src="http://placehold.it/160x120.jpg" alt="Thumbnail 3" /></a> <br />
    Caption 3 </p>
    <p><a class="fancybox" data-fancybox-group="gallery" href="http://placehold.it/400x320.jpg" title="optional captions"><img src="http://placehold.it/160x120.jpg" alt="Thumbnail 4" /></a> <br />
    Caption 4 </p>
    <!--end thumbs--></div>
    <!--end wrapper--></div>
    <!--FancyBox function code-->
    <script>
    $(document).ready(function() {
        $('.fancybox').fancybox();
    </script>
    </body>
    </html>
    Nancy O.

  • Is there a way to import Raw files into LR catalog ..including..any edits performed in an external raw file editor such as Capture One?

    Is there a way to import Raw files into LR catalog ..including..any edits performed in an external raw file editor such as Capture One?
    I can import the Raw file successfully but cannot see any edits that were applied in Capture One. Im assuming no but just checking.

    Your assumption is correct, Capture One, Lightroom and other third party raw processors have their own proprietary processes and profiles for rendering the raw data.
    They do not make permanent changes to the raw data and store the changes to an .xmp file or to a catalog file like Lightroom.

  • How to include a .class file in a jsp page

    hi everyone,
    i know the syntax as:
    <%@ include file = "filename.class" %>
    then at run time the server could not find the class file
    if i use,
    <%@ page import = "FileName.class" %>
    then also the same problem persists
    & if i use
    <jsp:include page = "Relative address"/>
    the problem still remains as it is...
    please help me out...i am working on developing an EJB application in which client interacts with server's Stateful session bean through a jsp page...it is necessary for me to include the home interface class file in my jsp page.
    P.S. do not suggest me to include the class file in a package & then use
    <%@ page import = "packageName.ClassFileName" %>
    i
    Edited by: Ankit_JIITU on 6 Jul, 2008 1:55 AM

    Ankit_JIITU wrote:
    i have already included the remote interface class file by <%@ page import = "University.RemoteInterfaceName" %>in my jsp page ...
    if i try to make a new package called test & then include my home interface in that package...i need to import University.*to generate the class file of my home interface ; but the class file generation is not taking place as i am getting the error..
    "package University does not exist".How can i overcome this problem. The package University, which you are trying to import, must be in the classpath. If you removed it then you will have to add it back.
    i have tried my best..but tell me if there's any possible way of including a class file in the jsp page without involving a package.No, there isn't.
    If not,then pls help me to generate the class file of my home interface within a package called test.Read the New To Java Tutorial and understand how packages work.
    >
    i am assuming that u have a deep knowledge of developing EJB applications.

  • I have a Windows 7 laptop using I tunes 64 and all my music files are on an external disc. I rarely use I tunes and at one point moved all my files (including the music files) from one external disc to another without considering what affect this wou

    I have a Windows 7 laptop using I tunes 64 and all my music files are
    on an external disc. I rarely use I tunes and at one point moved all my files
    (including the music files) from one external disc to another without
    considering what affect this would have on the I tunes library. When I eventually
    attempted to use I tunes, every selected a song from the library resulted in a
    message stating that the file couldn't be located. After following some of the procedures
    explained in this community I was able to reconnect the library back to where
    the associated music files are presently stored. However, there are still 2
    problems that need to be corrected. 1) Every song file now has a duplicate. One
    file works and the other file will result in the same message stating that the
    file couldn't be located. Before there were 4,000 songs in the library, now
    there are 8,000 songs. I need to eliminate the 4,000 dead song files. 2) All
    the playlists are still associated with the dead song files which makes the
    playlists unusable. Can the playlists be reconnected to the usable files
    without manually having to recreate them? Thanks in advance for the help.
    sdkr

    So am I understanding correctly?
    You used your iPod as a hard drive (drag and drop) instead of having iTunes install the music?
    If you used drag and drop your choices are different than if you used iTunes to transfer.
    Good luck!

  • Problem while including the header file in C source code in CIN

    While Creating code interface node....
    In the C source code we are supposed to include the Header file "extcode.h".In my system i have installed
    Turbo C. I couldn't able to find the above header files.When i am trying to use the above header file i am getting error,what could be the reason

    Hi,
    You need to point your turbo C to ..\labview\cintools which is where you will find the extcode.h and other h file and also the lib file.
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • How to include a html file in jsp

    hi all
    I have a question about including a html in jsp.
    here's the sample of my jsp file:
    <%
    String filename = "helloworld.html";
    %>
    <%@ include file="helloworld.html" %>
    how will you go about doing it so that the included file depends on the variable "filename"? I've tried doing the following but I got an error:
    <%@ include file=filename %>
    Thank you very much :)

    try this:-
    <%
    String filename = "helloworld.html";
    %>
    <jsp:include page='<%= filename %>' />
    This should work.

  • Portlets Issues:-  Included resource or file  not found

    I am facing some problems in the loading of portlets with Weblogic 9.2.When I access the portal url all the portlets are displayed blank by giving the following error message on the server :
    <Error> <HTTP> <BEA-101214> <Included resource or file "/mysamples/exampleView.jsp" not found from requested resource "/portal/ep/home.do".>
    My application is using pluto portlet container,
    When I change the jsp file and reload portlet displays but after restarting the server it is again gone ,
    Can someone please provide some pointers on this , I will really appreciate the help .
    Thanks a lot
    -- Vandana

    has anyone got the solution I am getting the same error.
              mine is weblogic 6.1 in clustered env and when I am opening the browser and clicking on the link first time it is showing me no content in the pop up browser and I am getting the same error on the server as you people have got. help will be appreciated a lot as I am facing this in production env

  • IE crash and closed down when trying to include a PDF file into a web page

    Hi,
    I am trying to include pdf file into my webpage by using
    tag. The whole page is created dynamically on the run-time. I am using IFrame to contain all the controls (included the object). The system works fine in the WindowXP but when I run it under Vista, the whole IE crash and IE closed by itself.
    I have tried to debug the problem and it gave me the following messages:
    [partial]
    'iexplore.exe': Loaded 'C:\Windows\System32\msacm32.drv', No symbols loaded.
    'iexplore.exe': Loaded 'C:\Windows\System32\msacm32.dll', No symbols loaded.
    'iexplore.exe': Loaded 'C:\Windows\System32\midimap.dll', No symbols loaded.
    'iexplore.exe': Loaded 'C:\Windows\System32\dxtrans.dll', No symbols loaded.
    'iexplore.exe': Loaded 'C:\Windows\System32\atl.dll', No symbols loaded.
    'iexplore.exe': Loaded 'C:\Windows\System32\ddrawex.dll', No symbols loaded.
    'iexplore.exe': Loaded 'C:\Windows\System32\ddraw.dll', No symbols loaded.
    'iexplore.exe': Loaded 'C:\Windows\System32\dciman32.dll', No symbols loaded.
    'iexplore.exe': Loaded 'C:\Windows\System32\nvd3dum.dll', No symbols loaded.
    'iexplore.exe': Loaded 'C:\Windows\System32\dxtmsft.dll', No symbols loaded.
    'iexplore.exe': Loaded 'C:\Program Files\Common Files\Adobe\Acrobat\ActiveX\AcroPDF.dll', No symbols loaded.
    'iexplore.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.1434_none_d08b600244 2c891f\msvcp80.dll', No symbols loaded.
    The thread 'Win32 Thread' (0x18d4) has exited with code 0 (0x0).
    Windows has triggered a breakpoint in iexplore.exe.
    This may be due to a corruption of the heap, and indicates a bug in iexplore.exe or any of the DLLs it has loaded.
    The output window may have more diagnostic information
    Could anyone shed some light into this issue.
    Currently I have installed Adobe Reader 8 version 8.1.2 in that Vista machine
    Thanks in advance
    Rob

    You have two PDF "reader" plugins installed. Try disabling one of them. Tools > Addons > Plugins

  • How to include external JavaScript files

    Hello All,
    i'm wondering haow can i include externel JavaScrip files, there is an clip-example with a function in the same JSP file
    but not how to include a file?
    <body>
    <script language='JavaScript' src="menu/menu.js'></script>
    If some one has a clip i would appreciate.
    Thanks
    Gino

    <script src="resources/myscript.js"></script>
    I did this exact thing in my jsp but it did not work, nothing popped up.
    When I tried replacing it with:
    <script language="JavaScript" type="text/javascript"><![CDATA[
    function postMessage(message) {
    alert(message);
    ]]></script>
    It worked. Can someone tell me why? Can't i refer to javascript files this way?

  • How to include a .js file into .jsp file.[.js file resides in a package]

    Hi,
    How do i include an external .js(JavaScript) file into a JSP file?My .js file is located in some package(lets say abc.jar). Below is my application structure:-
      jsp
       |
       ->MyJsp.jsp
      lib
       |
       |
    abc.jar
        |
        |
        ->com.abc.test
                     |
                     |
                     ->Test.java
                     ->abc.jsHow do i include "abc.js" file in "MyJsp.jsp" file?
    Please help.
    Thanks,
    Kiran
    Edited by: Adimulam on Jun 2, 2008 1:22 PM

    Even this is also not possible because, the code in that package is developed by DWR and i am just adding it to my lib folder and importing the respective classes. In the same manner i need to include the *.js* file in the JSP.It took me about 3 minutes reading through the [DWR Getting Started|http://getahead.org/dwr/getstarted] page to learn that you don't have to do any of that. Perhaps you should read that page?

  • How to include external javascript file in an html

    hello
    i've an html file placed in apache/webapps/test folder this html file includes an external javascript file placed at same level
    i'm includind the file as
    <script src="file1.js"></script>but the file does not gets included
    but when the sam folder "test" is paste outside apache the html file including the external file runs properly.
    Thank You

    flounder wrote:
    cotton.m wrote:
    What's really pathetic is that this is your third cross post on this same stupid off topic topic.
    You are really a dumb f&#117;ck you know that?If they knew that they were a dumb f&#117;ck then they wouldn't be a dumb f&#117;ck!That's a logical and reasonable conclusion. Therefore I very much doubt that the OP is capable of it.
    Hmmm this is interesting. It now shows the entity escapes rather than their values when you quote.

  • How to include external .js file into .ear file using NetBean 5.5.1?

    is it possible to include external .js file into .ear file using NetBean 5.5.1? if not, then where should I placed the external .js file and how to write the src="xxx" element? (that is , how to write the path of "xxx"?)
    I am using JBOSS 4.2.2 GA as server
    thx!!

    Even this is also not possible because, the code in that package is developed by DWR and i am just adding it to my lib folder and importing the respective classes. In the same manner i need to include the *.js* file in the JSP.It took me about 3 minutes reading through the [DWR Getting Started|http://getahead.org/dwr/getstarted] page to learn that you don't have to do any of that. Perhaps you should read that page?

Maybe you are looking for

  • How to show no. of actual working days in Payslip in case of +ve time mgt

    Dear Experts, We have a requirement of showing no. of actual working days in payslip, which should be Calendar Days-(Paid+Unpaid absence). I created an w/t 1WRD for actual working days. Our paid absence w/t is 2006 and unpaid absence is 2005 copied f

  • How to do a left join to create a timesheet status report in Power View

    I am trying to create a very simple report in power view for Project Online. It's a timesheet status report that should show a list of resources, and the current status of their timesheet (in progress, not started, etc). In Excel, I created an odata

  • Imported stills come in as sequence

    Sometimes when I import stills into my AE projects they come in as normal .jpegs or .psd.  Other times they come in as Photoshop sequence images that I can't use.  There must be a preference item that will allow me to defeat that type of import, righ

  • Premiere Pro CC: Pre-Render stalls and hangs occassionally

    Hi all, is everyone else experiencing that after hitting enter to do a quick pre-render, the progress bar pops up but then the system just "hangs". The application doesn't really stop working, but there is no progress. It almost feels that the applic

  • Enquiry in form 16A

    Hi, I have done  with hold tax printing layout in which program name is J_1IEWT_CERT. I copied the std script z and made changes. The problem I am facing is 4 pages are coming instead of 2. Output data is satisfied in 2 pages only , but extra 2 pages