[2009-12-01 10:34:59,590] ERROR - java.sql.SQLException: Io 异常: NL Exception was generated
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:334)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:418)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:521)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:325)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at com.yourcompany.business.database.DbConnection.getConnection(Unknown Source)
at com.yourcompany.business.busindessdetail.busindessdetailinfo.UserInfo.getUserInfo(Unknown Source)
at com.yourcompany.business.busindessdetail.busindessdetailinfo.UserInfo.toXML(Unknown Source)
at com.yourcompany.business.MochaSearchServlet.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:76)
at com.yourcompany.business.util.EncodingFilter.doFilter(Unknown Source)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1027)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:544)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:210)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:139)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:332)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:255)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:657)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:453)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:937)
**********************************
【分析】
如果你是使用的应用服务器,如:webshpere的话,可以先在was控制台检查此数据源是否能正常连接。
如果was的数据源正常,需要检查你的应用中取数据库连接的地方是如何实现的:
(1)。直连数据库方式
(2)。通过jndi访问
如果是(1),需要检查你的url的写法是否正确,注意在属性文件中,需要对符号【:】和【=】进行转义,需要用到转义符【\】
NL exception is Null Pointer Exception,即取到的数据库连接是null。
【总结】
一般如果was数据源没有问题的话,都是因为数据库的url的写法有问题或者jndi发生变化了,程序中没有及时调整过来。
8 个解决方案
#1
RAC的配置如下:
node1:ip地址192.168.60.132,实例名:rac1,主机名:rac1
node2:ip地址192.168.60.144,实例名:rac2,主机名:rac2
RAC服务名为oratest
我的应用服务器为apache+tomcat
www.ixdba.net
配置过程如下
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)))
但是tomcat报出如下错误:
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中连接字符串进行连接;
不知道大家有没有遇到这样的问题?
node1:ip地址192.168.60.132,实例名:rac1,主机名:rac1
node2:ip地址192.168.60.144,实例名:rac2,主机名:rac2
RAC服务名为oratest
我的应用服务器为apache+tomcat
www.ixdba.net
配置过程如下
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)))
但是tomcat报出如下错误:
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中连接字符串进行连接;
不知道大家有没有遇到这样的问题?
#2
#3
jf
#4
我不知道啊 我不知道啊
#5
我遇到的一个引用,jdbc.url是这样子写的,一直不成功
jdbc:oracle:thin:@(DESCRIPTION=(FAILOVER=ON)(ADDRESS_LIST=(LOAD_BALANCE=OFF)(ADDRESS=(PROTOCOL=TCP)(HOST=yecdb01-vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=yecdb02-vip)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=osscms)))
后来我换成楼主的写法就OK了!感谢楼主
jdbc:oracle:thin:@(DESCRIPTION=(FAILOVER=ON)(ADDRESS_LIST=(LOAD_BALANCE=OFF)(ADDRESS=(PROTOCOL=TCP)(HOST=yecdb01-vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=yecdb02-vip)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=osscms)))
后来我换成楼主的写法就OK了!感谢楼主
#6
Io 异常: SO Exception was generated
也可以由此解决。
也可以由此解决。
#7
不错哦。O(∩_∩)O~
#8
问题处理,谢谢楼主了!!但是我还是用的IP地址也是可以成功的!!
#1
RAC的配置如下:
node1:ip地址192.168.60.132,实例名:rac1,主机名:rac1
node2:ip地址192.168.60.144,实例名:rac2,主机名:rac2
RAC服务名为oratest
我的应用服务器为apache+tomcat
www.ixdba.net
配置过程如下
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)))
但是tomcat报出如下错误:
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中连接字符串进行连接;
不知道大家有没有遇到这样的问题?
node1:ip地址192.168.60.132,实例名:rac1,主机名:rac1
node2:ip地址192.168.60.144,实例名:rac2,主机名:rac2
RAC服务名为oratest
我的应用服务器为apache+tomcat
www.ixdba.net
配置过程如下
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)))
但是tomcat报出如下错误:
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中连接字符串进行连接;
不知道大家有没有遇到这样的问题?
#2
#3
jf
#4
我不知道啊 我不知道啊
#5
我遇到的一个引用,jdbc.url是这样子写的,一直不成功
jdbc:oracle:thin:@(DESCRIPTION=(FAILOVER=ON)(ADDRESS_LIST=(LOAD_BALANCE=OFF)(ADDRESS=(PROTOCOL=TCP)(HOST=yecdb01-vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=yecdb02-vip)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=osscms)))
后来我换成楼主的写法就OK了!感谢楼主
jdbc:oracle:thin:@(DESCRIPTION=(FAILOVER=ON)(ADDRESS_LIST=(LOAD_BALANCE=OFF)(ADDRESS=(PROTOCOL=TCP)(HOST=yecdb01-vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=yecdb02-vip)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=osscms)))
后来我换成楼主的写法就OK了!感谢楼主
#6
Io 异常: SO Exception was generated
也可以由此解决。
也可以由此解决。
#7
不错哦。O(∩_∩)O~
#8
问题处理,谢谢楼主了!!但是我还是用的IP地址也是可以成功的!!