issue with ant and project builds w/ Java Server Pages project

Discussion in 'Java' started by Damon Getsman, Sep 16, 2008.

  1. I have a large project that I'm working on right now written primarily
    in .jsp. It is used primarily to enter, sort, and process data from
    several MySQL tables on the back-end. Unfortunately the previous coder
    has written it almost entirely in JSP; to the point where almost all
    of the logic, database access, and other functions that should
    normally go in beans is written in JSP tags. Anyway, I digress...

    This project was handed off to me in a NetBeans project bundle. I had
    a lot of issues with NetBeans, so I switched to Eclipse. The new
    version of eclipse seemed broken in some areas, too, so I ended up
    switching to editing my files with 'vim' on my Linux system,
    rebuilding with 'ant', and then redeploying and troubleshooting under
    tomcat6+apache on my local webserver.

    I recently completed the first round of changes to this project. These
    consisted of edits only to one .jsp file; not one that is loaded
    immediately upon entering index.jsp of the project. When I moved on to
    the next section of edits, it consisted primarily of edits to one of
    the few JavaScript files that implements AJAX functions for the
    project. The source file was in <project_home>/web/js/
    AjaxFunctions.js. The first few times that I implemented changes and
    rebuilt the project I found (with ant -v) that it was allegedly
    including the new .js file due to it being outdated; yet when I looked
    with firebug at the javascript include when I went to that portion of
    the project, I was still seeing the previous javascript with none of
    my changes implemented.

    I attempted a few things to try to get it to see my changes, and
    although it stated that it was including it due to it being outdated,
    I could not see my new javascript code in firebug. So after awhile
    (this being my first JSP project and first time working with ant), I
    was running out of ideas for troubleshooting and I ended up doing 'ant
    clean; ant' to attempt to force a complete rebuild.

    This broke the entire project. I don't even see the index.jsp login
    page, it just takes me immediately to the unexplained server error
    page; I find this rather odd being as I never made changes to any of
    the files that are loaded immediately upon entry into the project. I
    tried replacing the modified AjaxFunctions.js file with the old one
    and it made no difference. Upgraded ant from 1.7.0 to 1.7.1 and still
    nothing. Eventually I had to wipe the project directory and reinstall
    from the backup that I made yesterday before leaving work.

    Due to my unfamiliarity with ant I'm really at a loss here. Can
    anybody give me some tips or ideas on what the issue might be here and
    where I might look to resolve this? Anything you can offer that would
    point me in the right direction is very much appreciated.

    Thanks in advance.

    Damon Getsman
    -=-=-=-
    ITRx http://www.itrx-nd.com/
    Programmer/Systems Administrator
    -=-=-=-
     
    Damon Getsman, Sep 16, 2008
    #1
    1. Advertising

  2. Okay, after a little bit more digging it seems to me that there are
    actually 2 problems. The first of which I described fairly well
    above; if I do an 'ant clean; ant' it hoses the entire project, even
    if I do it from the original netbeans environment that the project was
    created from by the original coder.

    The second problem, the one that is more important to me at this
    point, is that ant and tomcat refuse to see any changes to my
    <project_home>/web/js/AjaxFunctions.js file. For the longest time
    rebuilding & redeploying wouldn't even copy the new version of
    AjaxFunctions.js to the tomcat6 container. I finally got past this by
    'touch'ing the <project_home>/web/js directory. However even now that
    I can verify the new edits to AjaxFunctions.js are present in that
    directory, FireBug still shows that it is the OLD javascript being
    executed when I go to the applicable page.

    How do I get ant and tomcat to recognize the changes and begin using
    my new JavaScript code? I can't seem to find any documentation
    applicable to this by googling; admittedly my google-fu is not the
    best, but I would think I should've stumbled across something by now.

    Any help appreciated, especially on the JavaScript issue.

    -Damon Getsman
    -=-=-=-
    ITRX http://www.itrx-nd.com/
    Programmer/Systems Administrator
    -=-=-=-
     
    Damon Getsman, Sep 16, 2008
    #2
    1. Advertising

  3. Pick one group and post to it, please.

    Damon Getsman wrote:
    > Okay, after a little bit more digging it seems to me that there are
    > actually 2 problems. The first of which I described fairly well
    > above; if I do an 'ant clean; ant' it hoses the entire project, even
    > if I do it from the original netbeans environment that the project was
    > created from by the original coder.
    >
    > The second problem, the one that is more important to me at this
    > point, is that ant and tomcat refuse to see any changes to my
    > <project_home>/web/js/AjaxFunctions.js file. For the longest time
    > rebuilding & redeploying wouldn't even copy the new version of
    > AjaxFunctions.js to the tomcat6 container. I finally got past this by
    > 'touch'ing the <project_home>/web/js directory. However even now that
    > I can verify the new edits to AjaxFunctions.js are present in that
    > directory, FireBug still shows that it is the OLD javascript being
    > executed when I go to the applicable page.


    Tomcat is probably not responsible for any of this. It's pretty good
    about serving current versions of static files (JS and HTML), and
    noticing changes to .jsp files. If an app is marked as reloadable,
    changes to .class files will also be noticed.

    You can always make sure by deleting the cached copy for the web app ...
    Stop Tomcat and delete the folder with your webapp's name in <Tomcat
    home>/work/Catalina/localhost/

    Tomcat will then start with fresh copiues. But I've never had to do that
    for HTML or JS files.

    Your browser cache may be at fault if Tomcat has the right files. One
    version of one browser (Opera?) used to drive me crazy because it
    refused to believe JS files had changed, even with a hard reload, e.g.,
    shift-refresh page.

    What do you see if you enter the full URL for the JS file in your
    browser's address field?

    As for why Ant is not redeploying correctly, that must be something
    basically mis-configured somewhere, most likely in the Ant file. Finding
    changed files is core to what Ant does and unlikely to be something
    broken in Ant itself. You could try posting the Ant file in some Ant forum,

    http://ant.apache.org/resources.html



    >
    > How do I get ant and tomcat to recognize the changes and begin using
    > my new JavaScript code? I can't seem to find any documentation
    > applicable to this by googling; admittedly my google-fu is not the
    > best, but I would think I should've stumbled across something by now.
    >
    > Any help appreciated, especially on the JavaScript issue.
    >
    > -Damon Getsman
    > -=-=-=-
    > ITRX http://www.itrx-nd.com/
    > Programmer/Systems Administrator
    > -=-=-=-
     
    Chris Riesbeck, Sep 17, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. john martin
    Replies:
    2
    Views:
    2,244
    john martin
    Apr 7, 2005
  2. Danno
    Replies:
    19
    Views:
    852
    Chris Uppal
    Oct 6, 2006
  3. Just D
    Replies:
    0
    Views:
    283
    Just D
    Jun 7, 2007
  4. =?Utf-8?B?Sm9obiBTLg==?=
    Replies:
    0
    Views:
    370
    =?Utf-8?B?Sm9obiBTLg==?=
    Sep 11, 2007
  5. Markus Gessner

    Dependency resolution in Java builds

    Markus Gessner, Feb 8, 2011, in forum: Java
    Replies:
    26
    Views:
    896
Loading...

Share This Page