1

When build my application with the command:

$> git push heroku master

The application works normally and I can run the automated testing, but when building my application by Jenkins, I get the following message from the browser:

 HTTP Status 500 - An exception occurred processing JSP page /university/universityList.jsp at line 18

 15: 
 16:    <jsp:include page="universitiesMenu.jsp" />
 17: 
 18:        <jsp:include page="universities.jsp" />
 19: 
 20:    </div>
 21: 

 Stacktrace:

    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
    ...

    root cause

    javax.servlet.ServletException: java.lang.UnsupportedClassVersionError: br/usp/icmc/rest/ClientRestUniversity : Unsupported major.minor version 51.0 (unable to load class br.usp.icmc.rest.ClientRestUniversity)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:343)

    ...

    root cause

    java.lang.UnsupportedClassVersionError: br/usp/icmc/rest/ClientRestUniversity : Unsupported major.minor version 51.0 (unable to load class br.usp.icmc.rest.ClientRestUniversity)
        org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2899)

    ...

Complete log file Jenkins: http://ricardoramos.url.ph/log_Jenkins.txt

Why when I run the command to push the heroku the application and automated testing works normally and when deployed by Jenkins I receiving an exception? Where am I wrong?

ricardoramos
  • 891
  • 3
  • 18
  • 35
  • Based upon the stacktrace its the issue of the different versions of java being used for compiletime and runtime. Please ensure the java versions are same. – Rahul Yadav Aug 12 '15 at 11:39
  • I have tested versions 7 and 8 of java in my system.properties file, but still giving the same problem. How do I know which versions of java'm using at compiletime and runtime on my project? – ricardoramos Aug 12 '15 at 11:56
  • 1
    You can check the java version of the compiler in your IDE and for runtime you can check the version of java supported by your web or application server. – Rahul Yadav Aug 12 '15 at 12:03
  • I checked the version of java 8 in my IDE and heroku well as the Jenkins both are also in version 8, was using version 7 of java in my project and upgraded to version 8. – ricardoramos Aug 12 '15 at 12:29
  • 1
    Can you verify that Jetty is configured to use proper JDK version? – Maciej Lach Aug 12 '15 at 12:32
  • How to check if my Jetty is configured to use proper JDK version? – ricardoramos Aug 12 '15 at 12:35
  • Did changing the version of the project work? – Rahul Yadav Aug 12 '15 at 12:57
  • I was using version 7 of java in heroku, and never had a problem with that, but the now updated to version 8 as it is the version that is set in eclipse and installed on my ubuntu. – ricardoramos Aug 12 '15 at 13:10
  • 1
    It looks ([Jetty changelog](https://webtide.com/jetty-9-2-0-released/)) that JDK 8 is supported as of version 9.2.0. This might be a potential place to look for compatibility issues. – Maciej Lach Aug 12 '15 at 16:21

1 Answers1

1

It looks like Jenkins is using JDK version incompatible with one required by your source code.

You can read on configuring Jenkins and JDK Configuring Your JDKs

Also check this SO post

Community
  • 1
  • 1
Maciej Lach
  • 1,622
  • 3
  • 20
  • 27