java - tomcat UnsupportedClassVersionError -
i have bitnami tomcat 7 installation (apache + tomcat + mysql) on mac, uses java 1.7 76. mac uses java 1.8 runtime. when deploy project (made in intellij on same mac) tomcat , try run unsupportedclassversionerror. not matter version of jdk use compile project (i've tried apple 1.6, oracle 1.7 , oracle 1.8 versions) , not seem te matter language level set. way app running using language level 1.3 (using jdk 1.7 of 1.8)
to fix problem have set tomcat run on 1.8 jdk installed on mac, configured intellij use same jdk. works fine.
my question: need compile using exact same version of jdk java version runs tomcat? or doing wrong.
the complete error: (sometimes shows unsupportedclassversionerror: minor version)
http status 500 - javax.servlet.servletexception: java.lang.unsupportedclassversionerror: test/testclass type exception report message javax.servlet.servletexception: java.lang.unsupportedclassversionerror: test/testclass description server encountered internal error prevented fulfilling request. exception org.apache.jasper.jasperexception: javax.servlet.servletexception: java.lang.unsupportedclassversionerror: test/testclass org.apache.jasper.servlet.jspservletwrapper.handlejspexception(jspservletwrapper.java:549) org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:455) org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:395) org.apache.jasper.servlet.jspservlet.service(jspservlet.java:339) javax.servlet.http.httpservlet.service(httpservlet.java:731) org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:52) root cause javax.servlet.servletexception: java.lang.unsupportedclassversionerror: test/testclass org.apache.jasper.runtime.pagecontextimpl.dohandlepageexception(pagecontextimpl.java:916) org.apache.jasper.runtime.pagecontextimpl.handlepageexception(pagecontextimpl.java:845) org.apache.jsp.index_jsp._jspservice(index_jsp.java:94) org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:70) javax.servlet.http.httpservlet.service(httpservlet.java:731) org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:432) org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:395) org.apache.jasper.servlet.jspservlet.service(jspservlet.java:339) javax.servlet.http.httpservlet.service(httpservlet.java:731) org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:52) root cause java.lang.unsupportedclassversionerror: test/testclass org.apache.jsp.index_jsp._jspservice(index_jsp.java:74) org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:70) javax.servlet.http.httpservlet.service(httpservlet.java:731) org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:432) org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:395) org.apache.jasper.servlet.jspservlet.service(jspservlet.java:339) javax.servlet.http.httpservlet.service(httpservlet.java:731) org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:52) note full stack trace of root cause available in apache tomcat/7.0.61 logs.
it practice use 1 version of jdk , jre compile time , runtime phases, whether used ide or tomcat. make sure use same version of jre used running test cases (if any) & tomcat avoid running these kind of issues.
my question: need compile using exact same version of jdk java version runs tomcat?
sometime might away issue if compile code on lower version , run on higher version should avoid situation if possible. try use same jdk version ide compilation , same version of jre tomcat deploying project.
Comments
Post a Comment