Erreur : Bad version number in .class file
bonjour,
Je ne comprends pas pourquoi ma console me donne cette erreur
Citation:
java.lang.UnsupportedClassVersionError: Bad version number in .class file (unable to load class servletImage)
sous Eclipse et apache Tomcat 5.5.
Etant donné que j'ai bien tout placé en 1.5 dans mes propriétés de projet.
J'ai bien fait un clean puis un run (avec build automatically).
Citation:
JRE System Library jre 1.5.0_07
Java compiler 1.5
Java Project Facets 5.0
voici le contenu de ma servlet:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.sql.Blob;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.CallableStatement;
import java.util.Vector;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpSession;
public class servletImage extends HttpServlet {
private static final Logger logger = Logger.getLogger(HandlePDA.class);
public void init(){
}
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
//connexion a*la base
String imageId = request.getParameter("id");
// imageId.substring(4);
int codeRetour = 0;
String Retour = new String();
String imageBalise = new String();
String hexaImage = new String();
[ ..]
Connection conn = tool.getConnection();
try{
// Create the statement
Statement stmt = conn.createStatement();
// Query all columns from the EMP table
ResultSet rset = stmt.executeQuery(query);
while (rset.next()) {
logger.debug(rset.getBlob("IM_PHOTO").toString());
byte[] imageBytes = rset.getBytes("IM_PHOTO") ; //récupération sur la db
InputStream is = new ByteArrayInputStream(imageBytes);
BufferedImage image = ImageIO.read(is);
// manipulation de l'image
// set the content type so the browser can see this as a picture
response.setContentType("image/jpeg");
response.getOutputStream().write(imageBytes);
}
logger.debug("bye bye");
}catch(Exception e){
logger.debug(e.getMessage());
}
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
} |
Detail de l'erreur:
Citation:
une instance de servlet
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:873)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
java.lang.Thread.run(Unknown Source)
cause mère
java.lang.UnsupportedClassVersionError: Bad version number in .class file (unable to load class servletImage)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1884)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:889)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1353)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1232)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:873)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
java.lang.Thread.run(Unknown Source)
merci