错误信息:
-------------in sendHeartBeats
-------------in sendHeartBeats
2014-03-24 17:37:51,456 ERROR (com.ylkj.drmt.importer.IndicatorDimensionCompostionImporter:226) - T_JJ_YYJC_JJAQJMjava.sql.SQLException: Io : NL Exception was generated
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:420)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at com.ylkj.drmt.dataquality.detaildata.service.impl.JoinCheckServiceImpl.getStatNum(JoinCheckServiceImpl.java:64)
at com.ylkj.drmt.dataquality.detaildata.service.impl.JoinCheckServiceImpl.addJoinValidate(JoinCheckServiceImpl.java:203)
at com.ylkj.drmt.dataquality.detaildata.service.impl.JoinCheckServiceImpl$$FastClassByCGLIB$$cbd107bc.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
at com.ylkj.drmt.dataquality.detaildata.service.impl.JoinCheckServiceImpl$$EnhancerByCGLIB$$f685b5ea.addJoinValidate(<generated>)
at com.ylkj.drmt.dataquality.detaildata.validate.engine.IdvalidateEngine.joinValidate(IdvalidateEngine.java:112)
at com.ylkj.drmt.dataquality.detaildata.validate.engine.DvalidateEngine$1.processor(DvalidateEngine.java:80)
at com.ylkj.drmt.dataquality.detaildata.validate.engine.IdvalidateEngine.run(IdvalidateEngine.java:126)
at java.lang.Thread.run(Thread.java:595)
-------------in sendHeartBeats
-------------in sendHeartBeats
分析解决:
RAC的配置如下:
node1:ip地址192.168.60.132,实例名:rac1,主机名:rac1
node2:ip地址192.168.60.144,实例名:rac2,主机名:rac2
RAC服务名为oratest
我的应用服务器为apache+weblogic
配置过程如下
1、搜索了一下,发现提供的连接RAC方法很多,拷贝了如下的jdbcURL:
jdbc:oracle:thin:@(description=(address_list= (address=(host=192.168.60.132) (protocol=tcp)(port=1521))(address=(host=192.168.60.144)(protocol=tcp) (port=1521)) (load_balance=yes)(failover=yes))(connect_data=(service_name= oratest)))
但是weblogic报出如下错误:
Io 异常: NL Exception was generated;
2、又从网上google、baidu一番,虽然找到n方法,但就是连不上,总是提示这个错误;
3、无奈之中,打开数据库tnsname.ora,发现其中的配置如下:
oratest=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = rac2)(PORT = 1521))
(LOAD_BALANCE = yes)
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = oratest)
)
)
于是将jdbcUR修改成:
jdbc:oracle:thin:@(description=(address_list= (address=(host=rac1) (protocol=tcp)(port=1521))(address=(host=rac2)(protocol=tcp) (port=1521)) (load_balance=yes)(failover=yes))(connect_data=(service_name= oratest)))
测试一下,结果竟然成功了;
初步认为是:数据库服务采用主机名,而在jdbcURL中采用ip地址的方式就会出现NL Exception的问题;
建议: 对于连接RAC有问题的情况,最好使用tnsnames.ora中连接字符串进行连接;
不知道大家有没有遇到这样的问题?