db2jcc.jar的坏版本与JRE 1.7一起使用? [英] Bad version of db2jcc.jar used with JRE 1.7?

查看:1179
本文介绍了db2jcc.jar的坏版本与JRE 1.7一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

找到解决方案:我将Tomcat 8中的db2jcc4.jar放在Tomcat lib文件夹中,我们很好。然而,对于Tomcat7而言并不起作用,所以我将db2jcc.jar从项目外部jar引用中引出,让服务器确定使用哪个版本。

Solution Found: I wound up putting db2jcc4.jar on Tomcat 8 in the Tomcat lib folder and we're good to go. Same doesn't work for Tomcat7 however, so I took the db2jcc.jar out of the project external jar references and let the server determine which version to use instead

原始问题

谷歌已经为此问题产生了一些神秘的参考:哪个版本的db2jcc要用于jre 1.7。

Googling has produced a slew of cryptic references for this question: which version of db2jcc to use with jre 1.7.

此页列出驱动程序下载由db2版本,但不是JRE。

This page lists the driver downloads by db2 version, but not JRE.

导致我这个谜题的问题是我们有两个Tomcat服务器,一个运行JRE 1.8一个运行1.7。奇怪的是,前者正在运行Tomcat 7和后来的Tomcat 8.(你可以问,但是我没有答案)

The problem that led me to this mystery is we have two Tomcat servers, one running JRE 1.8 and one running 1.7. Oddly enough, the former is running Tomcat 7 and the later Tomcat 8. (you can ask but I don't have an answer for this)

所以我们的开发代码是运行良好的连接到我们的Tomcat 7 JRE 1.8系统的db2,但是部署到我们的Tomcat 8 JRE 1.7服务器的其他东西可以通过在那里更新到JRE 1.8而被破坏,所以我们怀疑如下所示的错误是JRE 1.7和我们的db2jcc.jar文件。

So our development code is running fine making connections to db2 from our Tomcat 7 JRE 1.8 system, but other things deployed to our Tomcat 8 JRE 1.7 server are feared breakable by updating to JRE 1.8 there, so we suspect an error, shown below, to be a version mismatch between JRE 1.7 and our db2jcc.jar file.

可能这是Tomcat 8的一个问题。

Perhaps it is a problem with Tomcat 8, though.

从堆栈跟踪中提取的错误:

The error, extracted from the stack trace:

java.lang.AbstractMethodError: com.ibm.db2.jcc.t4.b.isValid(I)Z

现在最后的皱纹,我在Tomcat上开发和测试的项目7 JRE 1.8内置Eclipse,符合JRE 1.7标准。那么为什么我们会得到这个错误?它是否似乎是版本兼容性问题?

Now a final wrinkle, the project that I have developed and tested on Tomcat 7 JRE 1.8 is built in Eclipse with JRE 1.7 compliance. So why would we get this error? Does it appear to be a version compatibility issue?

更完整(但不是完整)堆栈跟踪

More complete (but not full) stack trace

    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:574)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:461)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
 root cause javax.servlet.ServletException: java.lang.AbstractMethodError: com.ibm.db2.jcc.t4.b.isValid(I)Z
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:908)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:837)
    org.apache.jsp.getTimesheetsForUser_jsp._jspService(getTimesheetsForUser_jsp.java:112)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    root cause java.lang.AbstractMethodError: com.ibm.db2.jcc.t4.b.isValid(I)Z
    org.apache.tomcat.dbcp.dbcp2.DelegatingConnection.isValid(DelegatingConnection.java:913)
    org.apache.tomcat.dbcp.dbcp2.PoolableConnection.validate(PoolableConnection.java:226)
    org.apache.tomcat.dbcp.dbcp2.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:302)
    org.apache.tomcat.dbcp.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2208)
    org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2191)
    org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:1945)
    org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1412)
    com.hr.timesheets.JDBCConnection.queryProdData(JDBCConnection.java:226)
    com.hr.timesheets.TimeSheetQueryManager.getTimesheets(TimeSheetQueryManager.java:624)
    com.hr.timesheets.TimeSheetQueryManager.generateUploadsForUser(TimeSheetQueryManager.java:343)
    org.apache.jsp.getTimesheetsForUser_jsp._jspService(getTimesheetsForUser_jsp.java:94)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

任何人都可以看到我们的团队缺席的明显的东西?其他任何人都有此问题?

Can anyone see something obvious here that our team is missing? Anyone else have this problem before?

注意:我们正在使用我们的context.iml文件中配置的池化连接资源,如下所示:

Note: we are using pooled connection resources configured in our context.iml file, as shown here:

<Resource auth="Container" 
name="jdbc/hrdb2"
type="javax.sql.DataSource" 
driverClassName="com.ibm.db2.jcc.DB2Driver"
url="jdbc:db2://hrdb2.hr.com:50200/time"
username="redacted" 
password="redacted"
maxIdle="10"
maxActive="400"
maxWait="5"
removeAbandoned="true"
removeAbandonedTimeout="1200"
/> 


推荐答案

此问题已在上述评论和更新中得到回答

This question has been answered in the comments and update above.

具体来说:将jar文件与给定的Tomcat版本一起放在服务器上的lib文件夹中,并从应用程序中删除它,允许服务器处理连接而不是应用程序,特别是当我们使用连接池。

Specifically: putting the jar file known to work with a given Tomcat release in the lib folder on the server, and removing it from the application, allows the server to handle the connectivity instead of the application, especially as we use connection pooling.

所以我们可以将db2jcc.jar放在tomcat 8上的db2jcc4.jar上,而在部署到任一服务器时,应用程序代码不需要更改。

So we can put db2jcc.jar on tomcat 7 and db2jcc4.jar on tomcat 8 and the application code need not change when deploying to either server.

这篇关于db2jcc.jar的坏版本与JRE 1.7一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆