facebook

javascript errors in jsp files

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #321018 Reply

    teletf
    Member

    Hi

    I just imported an old MyEclipse 3.1 J2EE project into MyEclipse 10.

    I am seeing hundreds of what look like javascript errors in pretty much every jsp file in the project. It looks like the validation of javascript can’t accept jsp tags in the document.

    Is there a way to remove these errors but still validate javascript/jsp?

    Thanks!

    #321037 Reply

    support-swapna
    Moderator

    teletf ,

    Sorry that you are seeing this issue with MyEclipse.

    1) Can you give us an example of an error on the jsp that you are seeing ?

    2) Can you also paste a code snippet which shows the error for us to investigate?

    #321050 Reply

    teletf
    Member

    There are over 500 javascript errors and a few java errors. I’m really just trying to get a build of a legacy project in the new environment, because my new license code didn’t work with the legacy environment.

    Re. JSP eg:
    function myFunction() {
    var someCount= 0;
    <c:if test=”${checkCount> 0}”>
    <c:forEach var=”indexVar” begin=”0″ end=”${checkCount-1}”>
    if(dwr.util.getValue(“deleteThing${instance.thingInstanceList[indexVar].inst}”) == true) {
    someCount++;
    }
    </c:forEach>
    </c:if>
    <c:forEach var=”indexVar” begin=”0″ end=”${bufferSize-1}”>
    if(dwr.util.getValue(“deleteThingNew${indexVar}”) == true) {
    someCount++;
    }
    </c:forEach>
    return someCount;
    }

    reports errors:
    “String literal is not properly enclosed by matching quote” and “Syntax error delete these tokens”

    I also have a Java build problem – I’m trying to use javax.xml.parsers.SAXParser, but for some reason the MyEclipse 10 install insists on using some 1.6.0_13 JRE which has no SAXParser.reset() method.

    My legacy project compiled successfully with a 1.6.0_07 JRE, but whatever project settings I change MyEclipse always uses the 1.6.0_13. I’ve tried changing all the library settings to point at 1.6.0_07 but it doesn’t work 🙁

    #321075 Reply

    Brian Fernandes
    Moderator

    teletf,

    Thanks for the example, we were able to easily replicate this. Are there other errors or is most of your Problems view filled with these?

    While we use 1.6.0_13 by default (since we install that version), there is no code in MyEclipse that forces the use of this version. There are several locations at which a JDK can be specified, could you please check all these locations?

    a) The default JRE for your workspace (Window > Preferences > Java > Installed JREs)

    b) The JRE attached to your project Project properties > Java Build Path – and the libraries Tab. Here you can either specify a specific JRE or choose to use the workspace default – in which case you should make the 1.6.0_07 JRE the default in the Installed JREs preference page.

    c) The launch configuration used to launch your application can also specify a JRE, please check the one in your config (though if this is incorrect, you would see an error at runtime and not at compile time).

    #321076 Reply

    teletf
    Member

    Hi

    I fixed the java build issue by removing a J2EE 1.4 Libraries definition in the Build Path and replacing it with a Java 6 EE. This (I think) then agrees with all my other 1.6 settings (there seem to be lots of them).

    Re. the JSP, the code supplied was an example of what was causing errors – but yes, the same errors are repeated across many files. I can get around this by turning off validation for the entire WebRoot, but that’s not a solution 🙁

    Also, when updating validation settings the GUI frequently hangs for minutes at a time, which is frustrating – so currently I’ve just disabled it completely 🙁

    Thanks

    #321293 Reply

    teletf
    Member

    Hi

    I received no further advice re. validation issues (ie. why it is so slow and why it reports so many errors compared to the legacy environment).

    I am assuming there is disagreement between some legacy setting and the current environment, but the I am finding the settings so impenetrable that it is impossible to see which are affecting the project.

    I have muddled on without validation, and now my app throws a ton of exceptions for many pages eg.

    22-Nov-2011 08:46:18 org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet MYAPP threw exception
    javax.servlet.jsp.JspException: ServletException in ‘/WEB-INF/views/tiles/configuration/somepage-work.jsp’:

    javax.servlet.jsp.JspException: javax.el.ELException: Error Parsing: ${status.error?errorstyle:normalstyle}

    Obviously some tile is causing a parser error, so I am currently deeply analyzing tons of tiles to find out if eg. a particular tag prefix cannot be parsed. Is there an easy way to find out WHY these pages cannot be parsed under v10 when they seemed fine under v3.1??

    Having persuaded my company to purchase licenses, I’d like to try and get to the bottom of these configuration issues. Getting a build out of the v10 IDE is actually requiring more effort than most functional enhancements 🙁

    #321318 Reply

    Brian Fernandes
    Moderator

    teletf,

    Sorry for the delayed response. The changed experience is due to the fact that you have migrated from a version that is literally 7 years old or more. During this time, the validation has changed significantly – I cannot recall if we even had JS validation back in 3.1. Here we’ve stumbled upon a case that perhaps should be validated fine – though I must say we have not come across this sort of use where JS / JSTL is mixed.

    As far as performance is concerned, please see this note: https://www.genuitec.com/forums/topic/troubleshooting-memory-amp-performance-issues/
    On validation, could you tell me what steps you were taking to disable the validation?

    On the errors you mentioned, I would like to clarify; these appear to be at runtime when you are deploying your application. Is this correct or do you see these in your error log during development? If so – what server are you deploying to now? Have you changed any libraries or JEE versions since you moved from 3.1 or are you using exactly the same projects?

    #321328 Reply

    teletf
    Member

    Hi

    Thanks for the response. I appreciate the information I supply can only tell you part of the story, so I guess the aim here is to guide me to settings that may affect this behaviour. Here goes (!) …

    1. Re. system settings:
    – My development machine is WinXP Pro 32bit with 2GB. I noticed that MyEclipse would start at 130MB and slowly climb to eg. 205MB over a few minutes => I changed the -Xmm to 768m and it seems slightly happier. The process now sits at about 230MB, although it does still seem to creep a bit (235MB after 15mins).
    – I am deploying to a local Tomcat 6.0.32 server and using Firefox 7.0.1.

    2. Re. validation
    – I can’t comment much on the use of JSP tags for JS. I guess some pages need specialized JS (although I guess the JS could be better generalized)
    – To disable the validation I did project properties -> MyEclipse -> Validation -> Excluded resources -> WebRoot, which enabled me to produce a deployable app (the validation obscured the Java errors).
    – Now I’ve fixed the Java library issues, I should probably re-enable the validation because it is possibly this that causes my server-side exception. Enabling validation doubles the project build time though 🙁

    3. Re. migrating project
    – The project libraries have been upgraded since the 3.1 legacy build, because this is the only way I could get a consistent environment. I upgraded J2EE libraries from 1.4 to 1.6 (big step!) and kept the JRE as 1.6.
    – I changed the library build paths and the project facets, and checked the compiler Java compliance level.
    – The project includes various libraries explicitly, but I don’t know how this relates to the IDE settings, so I don’t know how this affects the deployment.
    – Eg. there are JARs and tag libraries for DWR, Spring, Hibernate etc. I guess it is possible for these to be incompatible with Java 6/Tomcat 6.0.32 …? Although they seemed fine in the legacy environment (which included a JRE 1.6 and the same Tomcat 6 runtime).

    I guess my next step is to go through all the dependencies and check their compatibility with Java 6/Tomcat 6 (which will take a while!). This may help identify tag library support etc. It still smells like incompatible tag and JAR, though … I just don’t know if this is a project setting or a dependency setting.

    Thanks for any advice!

    #321354 Reply

    Brian Fernandes
    Moderator

    2) On Validation
    The validation exclusion should not disable the Java validation too, you should still be seeing those errors – but JSP validation would be affected.

    You could just disable the JS validation globally at Window > Preferences > MyEclipse > Validation – there are two JS validators listed and you could uncheck these.

    3) JEE 1.6 – is not really supported on Tomcat 6; for the least number of possible issues, I would recommend Tomcat 7 or moving back to JEE 1.5 (http://tomcat.apache.org/whichversion.html)

    As far as deployment goes, we pretty much just deploy everything in your project (except for a few of the JEE API libraries which are present on the server). The libraries and containers in your project do not affect the deployment logic, everything should be transferred over the the deployment location. You may want to browse the deployment location (context menu option in the server view) and check that all your libraries are present.

    I think the first step would be to correct the version of tomcat or JEE version and then check the deployment location to ensure the the libraries and resources you expected to be deployed are present. You may want to compare this with the deployment of your earlier project with ME 3.x. If the deployment looks okay, it’s likely a runtime issue with your application, not something caused by project / workspace settings in MyEclipse.

    Hope this helps, please keep me posted.

    #321393 Reply

    teletf
    Member

    Hi

    I checked the Tomcat version link. It seems Tomcat 6 should support “minimum” of 1.5 (obviously this doesn’t include 1.6!).

    I installed JDK and JRE 1.5 on my dev system, and then reconfigured the project:
    – Set Java Compiler 1.5
    – Set Project Facet to Java 1.5
    – Set Java System libraries and JRE libraries to 1.5
    – Disabled “Javascript validator for JS files”
    – Update JRE for Tomcat to 1.5 NOTE: When starting the server, I was requested to specify a JDK for the Tomcat server, but all the boxes requested a JRE path. I pointed the server at the JDK 1.5 and this allowed it to start.

    Despite having installed Tomcat 6.0.32, I noticed the server log reported:
    25-Nov-2011 09:53:33 org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/6.0.13

    My application caused the same exceptions, to do with JSP parsing:
    25-Nov-2011 09:54:27 org.apache.catalina.core.ApplicationDispatcher invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    javax.servlet.jsp.JspException: ServletException in ‘/WEB-INF/views/tiles/configuration/system-work.jsp’: javax.servlet.jsp.JspException: javax.el.ELException: Error Parsing: ${status.error?errorstyle:normalstyle}

    I also found this bug report for 6.0.13:
    https://issues.apache.org/bugzilla/show_bug.cgi?id=42565

    … which sounds like the problem I am having, although the proposed work around did not seem to solve the issue. My Tomcat isntall directory is labelled 6.0.32 but the servlet reports 6.0.13. Is this likely to be a Tomcat installation issue?

    Thanks for any suggestions …

Viewing 10 posts - 1 through 10 (of 10 total)
Reply To: javascript errors in jsp files

You must be logged in to post in the forum log in