facebook

MyEclipse 7.0 and Java Server Faces JDK 6 Tomcat 5/6 problem

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse IDE
  2.  > 
  3. Installation, Configuration & Updates
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #291855 Reply

    DougMH
    Participant

    You may be getting some posts about JSF enabled web apps not working now that the MyEclipse default JDK is JDK 6. My app broke and I had to go back and download JDK 5.5 Update 17 to get it to work again.

    Reported Bug: 6434149 is the problem.

    The problem is actually anything that uses…

    classLoader.loadClass(className)

    … instead of the newer…

    Class.forName(className, false, classLoader).

    The error you will get is something like…

    SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
    javax.faces.FacesException: java.lang.ClassNotFoundException: [Ljava.lang.String;

    … when running the server with offending programs deployed.

    I can almost guarantee you will see this in any project used J2EE 1.4 and added JSF capabilities… now attempting to run with JDK 6 under Tomcat. When I deploy my project under Glassfish 2.X, it works fine and I’ve specified JDK 6. It’s rather weird. If I go back to JDK 5, it works fine under Tomcat 5. It may be a combination of JDK 6 and Tomcat. Maybe Glassfish 2.X doesn’t load these classes in the same way.

    I notice that under 7.0, when you create a new Web project with J2EE 5, it automatically put the JSF jars under the Java EE 5 Libraries. When you say you want to add JSF capability, it doesn’t seem to make any difference? When you do it under J2EE 1.4, it adds them separately under the Referenced Libraries. Do you know what version of JSF is added under J2EE 5? All my JSF projects created under J2EE 5 work just find under JDK 6.

    The workaround maybe simple enough for people who completely control their server environment. In my case, I have a hosting service that doesn’t directly support JSF in a shared way and I have to provide those libraries myself.

    I hope you will take a look at this soon and get back to me and the rest of the user community.

    #291887

    Riyad Kalla
    Member

    You may be getting some posts about JSF enabled web apps not working now that the MyEclipse default JDK is JDK 6.

    I believe you are referring to the compiler compliance level? The default for that is still set to Java 5 (1.5). (see Screenshot)

    The problem is actually anything that uses…

    classLoader.loadClass(className)

    … instead of the newer…

    Class.forName(className, false, classLoader).

    The error you will get is something like…

    SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
    javax.faces.FacesException: java.lang.ClassNotFoundException: [Ljava.lang.String;

    This is very handy info for anyone else running into this issue, thanks for posting the issue as well as the solution.

    I can almost guarantee you will see this in any project used J2EE 1.4 and added JSF capabilities

    Actually if you create a J2EE 1.4 project, MyEclipse will popup a warning that unless your default Java Compiler Compliance level is set to Java 1.4, you could get errors. And actually offers to correct that for you (see Screenshot)

    now attempting to run with JDK 6 under Tomcat.

    You might be confusing compiler compliance level (generate byte code compatibility) and runtime environment… it can be a confusing mess, but it sounds to be like you created a Java 1.4 J2EE project, so your compiler compliance level was fine *but* the only JDK you had configured on your build path was Java 6, so that got added to the build path for that project *which* exposed the updated Java 6 API Class.forName call to your code.

    The end result was that all your code was compiled with the correct byte-code compatibility level (1.4), but was calling into an Java 6 API, which is not available in your deployed environment.

    This *can* be a very confusing issue. The correction is to do exactly what you did, download the right JDK to match your deployment environment, configure it and set it as your Default so all new projects get it in the build path.

    I notice that under 7.0, when you create a new Web project with J2EE 5, it automatically put the JSF jars under the Java EE 5 Libraries.

    Actually JSF 1.2 is part of the Java EE 5 spec. Those JARs are added to the Java EE 5 project build path regardless of if you add JSF capabilities or not in order to be spec compliant. The capabilities will just enable MyEclipse to provide extended tooling for you if you choose to use JSF in that project.

    When you do it under J2EE 1.4, it adds them separately under the Referenced Libraries.

    Correct, because JSF 1.1 was not part of the J2EE 1.4 spec.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: MyEclipse 7.0 and Java Server Faces JDK 6 Tomcat 5/6 problem

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