我在我的 Windows 7 机器上本地安装了 apache-tomcat-6.0.35。我也确实有尝试在 Tomcat 上运行的 Hiberanate Java 应用程序。后端使用的 RDBMS 是 Oracle 11g,因此我的机器上确实安装了 Oracle 客户端(11.2.0)。Java 应用程序使用 c3p0-0.9.1.2 在后端创建与 Oracle 的连接池。所有连接信息都存储在 tnsnames.ora 文件中。
整个项目代码都在版本控制系统中,因此完全相同的代码在我同事的机器上运行没有问题,但 Tomcat 无法在我的机器上启动,并显示以下日志。自今年年初(2012 年 2 月)以来,我就遇到了这个问题,但从未得到解决。我再试一次,看看是否有人能注意到我遗漏的东西。感谢您花时间研究这个问题!非常感谢!
这是我运行 Tomcat 服务器后日志文件中的内容:
Using CATALINA_BASE: "C:\Users\MyName\.IntelliJIdea11\system\tomcat\Unnamed_cerdoafebd8b4"
Using CATALINA_HOME: "C:\Program Files (x86)\Apache\Tomcat6\apache-tomcat-6.0.35"
Using CATALINA_TMPDIR: "C:\Program Files (x86)\Apache\Tomcat6\apache-tomcat-6.0.35\temp"
Using JRE_HOME: "C:\Program Files\Java\jdk1.6.0_31"
Using CLASSPATH: "C:\Program Files (x86)\Apache\Tomcat6\apache-tomcat-6.0.35\bin\bootstrap.jar"
...
2012-10-29T03:37:54.054Z INFO [main] EnvironmentProperties - Filtering properties using environment dev
2012-10-29T03:38:51.693Z INFO [main] MLog - MLog clients using log4j logging.
2012-10-29T03:39:40.497Z INFO [main] C3P0Registry - Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]
2012-10-29T03:39:45.066Z INFO [main] AbstractPoolBackedDataSource - Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@f1bda9a6 [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@1091d257 [ acquireIncrement -> 1, acquireRetryAttempts -> 3, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, debugUnreturnedConnectionStackTraces -> false, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 2zggjq8q1bc3mwlm6u21f|3bf60430, idleConnectionTestPeriod -> 0, initialPoolSize -> 2, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 604800, maxIdleTime -> 7200, maxIdleTimeExcessConnections -> 120, maxPoolSize -> 10, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 2, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@7c977f23 [ description -> null, driverClass -> null, factoryClassLocation -> null, identityToken -> 2zggjq8q1bc3mwlm6u21f|2bbef4c6, jdbcUrl -> jdbc:oracle:thin:@TRACKER_DEV, properties -> {user=******, .username=cerdo_app, password=******, .password=PEOPLE_WHOUSE_ADHOC, url.dev=jdbc:oracle:thin:@TRACKER_DEV, .url=jdbc:oracle:thin:@DW_DEV, .url.dev=jdbc:oracle:thin:@DW_DEV} ], preferredTestQuery -> select 1 from dual, propertyCycle -> 0, testConnectionOnCheckin -> true, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false; userOverrides: {} ], dataSourceName -> null, factoryClassLocation -> null, identityToken -> 2zggjq8q1bc3mwlm6u21f|293a985, numHelperThreads -> 3 ]
oracle.net.TNSAddress.SOException
at oracle.net.TNSAddress.ServiceAlias.initFromNVPair(Unknown Source)
at oracle.net.TNSAddress.ServiceAlias.initFromString(Unknown Source)
at oracle.net.resolver.AddrResolution.resolveAddrTree(Unknown Source)
at oracle.net.resolver.AddrResolution.resolveAndExecute(Unknown Source)
at oracle.net.ns.NSProtocol.establishConnection(Unknown Source)
at oracle.net.ns.NSProtocol.connect(Unknown Source)
at oracle.jdbc.ttc7.TTC7Protocol.connect(TTC7Protocol.java:1213)
at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:209)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:252)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:365)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)