1

在创建用户定义函数期间,我在 Win64 环境中遇到错误。我正在使用 flyway 执行以下简单脚本:

CREATE ALIAS TRANSLATE_NAME AS $$
String TRANSLATE_NAME(String value) {
  ...
return null;
}
$$

我收到以下错误:

java.io.IOException: CreateProcess error=2, The system cannot find the file specified

17:10:38 ERROR (ApacheCommonsLog.java:51) - com.googlecode.flyway.core.api.FlywayException: 
Error executing statement at line 1: 
CREATE ALIAS TRANSLATE_NAME AS $$

String TRANSLATE_NAME(String value) {
return null;
}
$$

这仅出现在 Win64 上,不会出现在 32 位 Linux 或 32 位 Windows 上。

有任何想法吗?我会很感激!请!

日志:

17:10:37 INFO (DriverManagerDataSource.java:153) - Loaded JDBC driver: org.h2.Driver
17:10:37 INFO (AbstractApplicationContext.java:1374) - Bean 'dataSource' of type [class org.springframework.jdbc.datasource.DriverManagerDataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
17:10:38 INFO (ApacheCommonsLog.java:43) - Creating Metadata table: "PUBLIC"."schema_version"
17:10:38 INFO (ApacheCommonsLog.java:43) - Current version of schema "PUBLIC": << Empty Schema >>
17:10:38 INFO (ApacheCommonsLog.java:43) - Migrating schema "PUBLIC" to version 1.1
17:10:38 INFO (ApacheCommonsLog.java:43) - Migrating schema "PUBLIC" to version 1.2
17:10:38 INFO (ApacheCommonsLog.java:43) - Migrating schema "PUBLIC" to version 1.3
17:10:38 INFO (ApacheCommonsLog.java:43) - Migrating schema "PUBLIC" to version 1.4
17:10:38 ERROR (ApacheCommonsLog.java:51) - com.googlecode.flyway.core.api.FlywayException: Error executing statement at line 1: CREATE ALIAS TRANSLATE_NAME AS $$
String TRANSLATE_NAME(String value) {
    if (value.equals("Ilya")) {
        return "Юлия";
    }
    return null;
}
$$
17:10:38 ERROR (ApacheCommonsLog.java:51) - Caused by java.io.IOException: CreateProcess error=2, The system cannot find the file specified
17:10:38 INFO (DefaultSingletonBeanRegistry.java:444) - Destroying singletons in...
4

2 回答 2

1

H2 需要类路径中的 JDK(类路径中的 tools.jar),或者javac需要作为外部进程使用。要查看是否javac在类路径中,请打开命令提示符并键入javac[Enter]。

于 2013-04-23T18:46:21.187 回答
0

在我的例子中,JAVA_HOME 被定义为一个环境变量并且指向了错误的 JRE(没有 javac 命令)。我删除了它,因为它不再需要了,这就成功了。虽然这不太可能是您的特定场景,但它证明这与环境变量解析到 jdks 的路径有关。

于 2014-12-29T08:31:46.743 回答