Search code examples
javaspringjardb2numberformatexception

java.lang.NumberFormatException in db2jcc.jar


I am hitting this exception in a Java application. I extract the JAR file and try to check what is the root cause of this, but I fail to get it, because I can't debug on it.

I have the source JAR file, but every time I attach it in my workspace, it still shows me "the source attachment does not contain the source for the file ad.class".

The following is the error stack:

Caused by: java.lang.NumberFormatException: For input string: "A"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:59)
    at java.lang.Integer.parseInt(Integer.java:460)
    at java.lang.Integer.parseInt(Integer.java:510)
    at com.ibm.db2.jcc.c.ad.<init>(ad.java:80)
    at com.ibm.db2.jcc.b.f.<init>(f.java:55)
    at com.ibm.db2.jcc.b.b.ib(b.java:1760)
    at com.ibm.db2.jcc.c.p.a(p.java:2490)
    at com.ibm.db2.jcc.b.b.a(b.java:470)
    at com.ibm.db2.jcc.b.b.<init>(b.java:264)
    at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:163)
    at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
    at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)
    at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1247)
    at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1221)
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
    at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:46)
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:111)
    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)
    at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
    at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
    ... 12 more

How can I debug this?


Solution

  • I found the solution, its cause by the db2jcc.jar is too old for the db2 version. I found the solution here and manage to fix it.

    https://www-01.ibm.com/support/docview.wss?uid=swg21625290