我正在编写一个简单的 Spring / Hibernate 应用程序,它必须查询远程 Oracle 12 数据库并返回一行数据。
问题是 Tomcat 服务器需要花费大量时间来启动,而且在通过 Eclipse 启动时永远不会。
它卡在下面给出的日志中:
INFO: HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
Sep 22, 2017 6:57:55 PM org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl makeLobCreatorBuilder
INFO: HHH000422: Disabling contextual LOB creation as connection was null
Sep 22, 2017 6:57:56 PM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource
INFO: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, dataSourceName -> 2vkgsu9q1b3tesb1o3y14g|38bd327a, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> oracle.jdbc.driver.OracleDriver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> 2vkgsu9q1b3tesb1o3y14g|38bd327a, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:oracle:thin:@remus.corp.apple.com:1529:gsxt, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 30000, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 20, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 5, numHelperThreads -> 3, preferredTestQuery -> null, privilegeSpawnedThreads -> false, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
Sep 22, 2017 6:57:56 PM com.mchange.v2.resourcepool.BasicResourcePool
WARNING: Bad pool size config, start 3 < min 5. Using 5 as start.
请注意,我已经在 Hibernate config xml中设置了以下属性:
<prop key="hibernate.temp.use_jdbc_metadata_defaults">false</prop>
源代码位于Git repository。