我正在使用 JSP、Java 和 PostgreSQL 构建一个用于特征提取和比较图像特征的 Web 应用程序。
我的特征提取是从图像中提取一些特征,然后我可以比较它们(一些特征是关于颜色的,一些关于图像的直方图等等。我有使用特定库提取它们的特殊方法(我添加到lib),如您在以下示例中所见!
然后这些功能被成功添加到我的 PostgreSQL 数据库中。
public void GetImageProperties(String targetPath, ImageProperties imagesProperties) throws Exception
{
// load image
FileInputStream imageStream;
imageStream = new FileInputStream(targetPath);
BufferedImage bimg = ImageIO.read(imageStream);
// get properties
imagesProperties.cl = new ColorLayoutImpl(bimg);
imagesProperties.eh = new EdgeHistogramImplementation(bimg);
imagesProperties.sc = new ScalableColorImpl(bimg);
}
然后我将它们添加到 postgresql 数据库中(只有功能,而不是图像)
String query = "CREATE TABLE Images (" +
" imageid SERIAL PRIMARY KEY," +
" fname VARCHAR(128)," +
" colorlayout VARCHAR(512), " +
" edgehist VARCHAR(512), " +
" scalablecolor VARCHAR(512) " +
")";
每次我加载图像并想将它与目录中的所有其他图像进行比较时,我都会收到此错误。
HTTP Status 500 -
type Exception report
信息:
description The server encountered an internal error () that prevented it from fulfilling this request.
例外:
org.apache.jasper.JasperException: An exception occurred processing JSP page /query.jsp at line 124
121: if (bSearch) {
122: // get form params
123: query.setTopK(new Integer(request.getParameter("frm_topk")));
124: query.setColorHistogramWeight(new Integer(request.getParameter("frm_weight_c1")));
125: query.setColorDistributionWeight(new Integer(request.getParameter("frm_weight_c2")));
126: query.setTextureWeight(new Integer(request.getParameter("frm_weight_c3")));
127: }
堆栈跟踪:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
根本原因:
java.lang.NumberFormatException: For input string: "1.0"
java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
java.lang.Integer.parseInt(Integer.java:492) java.lang.Integer.<init>
(Integer.java:677) org.apache.jsp.query_jsp._jspService(query_jsp.java:256)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.27 logs.