DB2异常com.ibm.db2.jcc.c.DisconnectException: encoding not supported的一种解决方法

如果你的程序在运行的过程中抛出如下异常:

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (encoding not supported!!)
	at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1225)
	at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
	at com.asiainfo.iaet.util.dataSource.DBConnectionFactory.getConnection(DBConnectionFactory.java:34)
	at com.asiainfo.iaet.services.DBOperator.openConnection(DBOperator.java:852)
	at com.asiainfo.iaet.services.DBOperator.select(DBOperator.java:279)
	at com.asiainfo.iaet.helpers.StaticMemData.init(StaticMemData.java:104)
	at com.asiainfo.iaet.servlet.SysInitServlet.init(SysInitServlet.java:53)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4458)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:792)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:528)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:987)
	at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:909)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:497)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1056)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:290)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: com.ibm.db2.jcc.c.DisconnectException: encoding not supported!!
	at com.ibm.db2.jcc.b.bb.b(bb.java:1610)
	at com.ibm.db2.jcc.b.cb.ac(cb.java:4454)
	at com.ibm.db2.jcc.b.cb.a(cb.java:4392)
	at com.ibm.db2.jcc.b.cb.c(cb.java:4314)
	at com.ibm.db2.jcc.b.cb.b(cb.java:4247)
	at com.ibm.db2.jcc.b.cb.a(cb.java:4225)
	at com.ibm.db2.jcc.b.cb.l(cb.java:373)
	at com.ibm.db2.jcc.b.cb.d(cb.java:145)
	at com.ibm.db2.jcc.b.b.Tb(b.java:1274)
	at com.ibm.db2.jcc.b.b.a(b.java:1166)
	at com.ibm.db2.jcc.b.b.q(b.java:934)
	at com.ibm.db2.jcc.b.b.a(b.java:702)
	at com.ibm.db2.jcc.b.b.(b.java:305)
	at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:162)
	at org.apache.tomcat.dbcp.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
	at org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)
	at org.apache.tomcat.dbcp.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1247)
	at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1221)
	at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
	at com.asiainfo.iaet.util.dataSource.DBConnectionFactory.getConnection(DBConnectionFactory.java:34)
	at com.asiainfo.iaet.services.DBOperator.openConnection(DBOperator.java:852)
	at com.asiainfo.iaet.services.DBOperator.select(DBOperator.java:279)
	at com.asiainfo.iaet.helpers.StaticMemData.init(StaticMemData.java:104)
	at com.asiainfo.iaet.servlet.SysInitServlet.init(SysInitServlet.java:48)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4458)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:987)
	at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:909)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:495)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
	... 1 more
你可以尝试着将你的所有的db2的jar包升级一下,升级的java包有

db2java.jar

db2jcc.jar

 db2jcc_license_cu.jar

如果你是web程序,这些包可能在Tomcat的lib目录下


你可能感兴趣的:(DB2异常)