Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/378.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Java1.7中运行junits的H2抛出异常在1.6中有效_Java_Eclipse_Junit_H2 - Fatal编程技术网

在Java1.7中运行junits的H2抛出异常在1.6中有效

在Java1.7中运行junits的H2抛出异常在1.6中有效,java,eclipse,junit,h2,Java,Eclipse,Junit,H2,我们正在更新以在1.7上运行,在junit测试中遇到了这个错误 org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "warning: Supported source version 'RELEASE_6' from annotation processor 'org.apache.openjpa.persistence.meta.AnnotationProcessor6' less than -source '1.7' 1

我们正在更新以在1.7上运行,在junit测试中遇到了这个错误

org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "warning: Supported source version 'RELEASE_6' from annotation processor 'org.apache.openjpa.persistence.meta.AnnotationProcessor6' less than -source '1.7'
1 warning
在编制本报告时:

CREATE alias TO_DATE AS $$
java.util.Date toDate(String d, String p) throws Exception {
p = p.replaceAll("Y","y").replaceAll("m","M");
return new java.text.SimpleDateFormat(p).parse(d);
}
$$;

H2/openjpa version:
<openjpa.version>2.3.0</openjpa.version>
<dependency>
    <groupId>com.h2database</groupId>
    <artifactId>h2</artifactId>
    <version>1.4.178</version>
    <scope>test</scope>
</dependency>
消息以“警告”而不是“注意”开头,因此引发异常。 我的eclipse.ini指向1.7。项目也在1.7中编译。 是什么导致了警告信息


谢谢你的帮助

由于失败的包是一个
org.apache
包,我猜您需要获得一个更新的(>1.7)版本的apache库。问题的根本原因可能是-一个解决方法是在H2中扩展
throwSyntaxError
以忽略警告(实际上,所有警告)。
private static void throwSyntaxError(String err) {
if (err.startsWith("Note:")) {
// unchecked or unsafe operations - just a warning
    } else if (err.length() > 0) {
        err = StringUtils.replaceAll(err, COMPILE_DIR, "");
        throw DbException.get(ErrorCode.SYNTAX_ERROR_1, err);
    }
}