使用 openJPA、DB2 将大 Blob 获取到 byte[] 会引发 NoClassDefFoundError

发布于 2024-11-16 06:20:11 字数 7527 浏览 3 评论 0原文

我有一个具有以下字段的实体。

@Lob
@Column(name = "image", nullable = false)
private byte[] image;

使用 5MB 图像保存我的实体没有任何问题,但是当我尝试获取它时出现异常。 (尽管较小的图像尺寸可以完美地工作!)。 这是一个 NoClassDefFoundError 但它只发生在这张大图像上。

我在这里发布了完整的堆栈跟踪。我希望你能为我指出一个方向。也许有一些我不知道的 jdbc 属性,例如 maxBlobSize :( 泰

2011-06-21 13:48:11 [DEBUG] EXCEPTION LOGGER GOT NoClassDefFoundError Message: com.ibm.db2.jcc.am.d Cause: ClassNotFoundException CauseMsg: com.ibm.db2.jcc.am.d
java.lang.J9VMInternals.verifyImpl(Native Method)
java.lang.J9VMInternals.verify(J9VMInternals.java:72)
java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
com.ibm.db2.jcc.t4.d.c(d.java:1454)
com.ibm.db2.jcc.am.ic.a(ic.java:944)
com.ibm.db2.jcc.am.ic.T(ic.java:1948)
com.ibm.db2.jcc.am.ym.getBlob(ym.java:1356)
com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getBlob(WSJdbcResultSet.java:740)
org.apache.openjpa.lib.jdbc.DelegatingResultSet.getBlob(DelegatingResultSet.java:580)
org.apache.openjpa.jdbc.sql.DBDictionary.getBlob(DBDictionary.java:541)
org.apache.openjpa.jdbc.sql.DBDictionary.getBytes(DBDictionary.java:604)
org.apache.openjpa.jdbc.sql.ResultSetResult.getBytesInternal(ResultSetResult.java:290)
org.apache.openjpa.jdbc.sql.ResultSetResult.getObjectInternal(ResultSetResult.java:421)
org.apache.openjpa.jdbc.sql.AbstractResult.getObject(AbstractResult.java:694)
org.apache.openjpa.jdbc.meta.strats.HandlerStrategies.loadDataStore(HandlerStrategies.java:217)
org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy.load(HandlerFieldStrategy.java:186)
org.apache.openjpa.jdbc.meta.FieldMapping.load(FieldMapping.java:813)
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:1060)
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:1012)
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:378)
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:278)
com.ibm.ws.persistence.jdbc.kernel.WsJpaJDBCStoreManager.initialize(WsJpaJDBCStoreManager.java:144)
org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:111)
org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:913)
org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:871)
org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:793)
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:986)
com.ibm.ws.persistence.jdbc.kernel.WsJpaJDBCStoreManager.load(WsJpaJDBCStoreManager.java:107)
org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:278)
org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(SelectImpl.java:2415)
org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:272)
org.apache.openjpa.jdbc.kernel.InstanceResultObjectProvider.getResultObject(InstanceResultObjectProvider.java:56)
org.apache.openjpa.kernel.QueryImpl.singleResult(QueryImpl.java:1294)
org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1221)
org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:990)
org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:848)
org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:779)
org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:525)
org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:254)
org.apache.openjpa.persistence.QueryImpl.getSingleResult(QueryImpl.java:317)
com.ibm.ompetestweb.ejb.beans.ImageServerBean.findImageByRftLogfileSource(ImageServerBean.java:39)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:600)
com.ibm.ejs.container.EJSContainer.invokeProceed(EJSContainer.java:5874)
com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:586)
com.ibm.ompetestweb.interceptors.LoggingInterceptor.onMethodCall(LoggingInterceptor.java:53)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:600)
com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:227)
com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:566)
com.ibm.ejs.container.interceptors.InvocationContextImpl.doAroundInvoke(InvocationContextImpl.java:217)
com.ibm.ejs.container.EJSContainer.invoke(EJSContainer.java:5766)
com.ibm.ompetestweb.ejb.interfaces.EJSLocal0SLImageServerBean_abf730e0.findImageByRftLogfileSource(EJSLocal0SLImageServerBean_abf730e0.java)
com.ibm.ompetestweb.ui.servlets.ImageServlet.doGet(ImageServlet.java:43)
javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1597)
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:104)
com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908)
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:934)
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3826)
com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:445)
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:504)
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:301)
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:275)
com.ibm.ws390.channel.xmem.XMemConnLink.ready(XMemConnLink.java:844)
com.ibm.ws390.channel.xmem.XMemInboundChannel.handleRequest(XMemInboundChannel.java:340)
com.ibm.ws390.xmem.XMemSRBridgeImpl.httpinvoke(XMemSRBridgeImpl.java:104)
com.ibm.ws390.xmem.XMemSRCppUtilities.httpinvoke(XMemSRCppUtilities.java:74)
com.ibm.ws390.orb.ServerRegionBridge.httpinvoke(ServerRegionBridge.java:215)
com.ibm.ws390.orb.ORBEJSBridge.httpinvoke(ORBEJSBridge.java:281)
sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:600)
com.ibm.ws390.orb.parameters.HTTPInvoke.HTTPInvokeParmSetter(HTTPInvoke.java:101)
com.ibm.ws390.orb.CommonBridge.nativeRunApplicationThread(Native Method)
com.ibm.ws390.orb.CommonBridge.runApplicationThread(CommonBridge.java:464)
com.ibm.ws.util.ThreadPool$ZOSWorker.run(ThreadPool.java:1763)

I have an Entity with the following field.

@Lob
@Column(name = "image", nullable = false)
private byte[] image;

Persisting my entity with a 5MB image worked without problems however when I try to fetch it a get an Exception. (smaller image sizes work flawlessly though!).
It is a NoClassDefFoundError but it happens only with this large image.

I posted the full stacktrace here. I hope you can point me to a direction. Maybe there is some jdbc property like maxBlobSize that I don't know of :(
TY

2011-06-21 13:48:11 [DEBUG] EXCEPTION LOGGER GOT NoClassDefFoundError Message: com.ibm.db2.jcc.am.d Cause: ClassNotFoundException CauseMsg: com.ibm.db2.jcc.am.d
java.lang.J9VMInternals.verifyImpl(Native Method)
java.lang.J9VMInternals.verify(J9VMInternals.java:72)
java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
com.ibm.db2.jcc.t4.d.c(d.java:1454)
com.ibm.db2.jcc.am.ic.a(ic.java:944)
com.ibm.db2.jcc.am.ic.T(ic.java:1948)
com.ibm.db2.jcc.am.ym.getBlob(ym.java:1356)
com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getBlob(WSJdbcResultSet.java:740)
org.apache.openjpa.lib.jdbc.DelegatingResultSet.getBlob(DelegatingResultSet.java:580)
org.apache.openjpa.jdbc.sql.DBDictionary.getBlob(DBDictionary.java:541)
org.apache.openjpa.jdbc.sql.DBDictionary.getBytes(DBDictionary.java:604)
org.apache.openjpa.jdbc.sql.ResultSetResult.getBytesInternal(ResultSetResult.java:290)
org.apache.openjpa.jdbc.sql.ResultSetResult.getObjectInternal(ResultSetResult.java:421)
org.apache.openjpa.jdbc.sql.AbstractResult.getObject(AbstractResult.java:694)
org.apache.openjpa.jdbc.meta.strats.HandlerStrategies.loadDataStore(HandlerStrategies.java:217)
org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy.load(HandlerFieldStrategy.java:186)
org.apache.openjpa.jdbc.meta.FieldMapping.load(FieldMapping.java:813)
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:1060)
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:1012)
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:378)
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:278)
com.ibm.ws.persistence.jdbc.kernel.WsJpaJDBCStoreManager.initialize(WsJpaJDBCStoreManager.java:144)
org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:111)
org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:913)
org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:871)
org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:793)
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:986)
com.ibm.ws.persistence.jdbc.kernel.WsJpaJDBCStoreManager.load(WsJpaJDBCStoreManager.java:107)
org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:278)
org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(SelectImpl.java:2415)
org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:272)
org.apache.openjpa.jdbc.kernel.InstanceResultObjectProvider.getResultObject(InstanceResultObjectProvider.java:56)
org.apache.openjpa.kernel.QueryImpl.singleResult(QueryImpl.java:1294)
org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1221)
org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:990)
org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:848)
org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:779)
org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:525)
org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:254)
org.apache.openjpa.persistence.QueryImpl.getSingleResult(QueryImpl.java:317)
com.ibm.ompetestweb.ejb.beans.ImageServerBean.findImageByRftLogfileSource(ImageServerBean.java:39)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:600)
com.ibm.ejs.container.EJSContainer.invokeProceed(EJSContainer.java:5874)
com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:586)
com.ibm.ompetestweb.interceptors.LoggingInterceptor.onMethodCall(LoggingInterceptor.java:53)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:600)
com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:227)
com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:566)
com.ibm.ejs.container.interceptors.InvocationContextImpl.doAroundInvoke(InvocationContextImpl.java:217)
com.ibm.ejs.container.EJSContainer.invoke(EJSContainer.java:5766)
com.ibm.ompetestweb.ejb.interfaces.EJSLocal0SLImageServerBean_abf730e0.findImageByRftLogfileSource(EJSLocal0SLImageServerBean_abf730e0.java)
com.ibm.ompetestweb.ui.servlets.ImageServlet.doGet(ImageServlet.java:43)
javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1597)
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:104)
com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908)
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:934)
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3826)
com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:445)
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:504)
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:301)
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:275)
com.ibm.ws390.channel.xmem.XMemConnLink.ready(XMemConnLink.java:844)
com.ibm.ws390.channel.xmem.XMemInboundChannel.handleRequest(XMemInboundChannel.java:340)
com.ibm.ws390.xmem.XMemSRBridgeImpl.httpinvoke(XMemSRBridgeImpl.java:104)
com.ibm.ws390.xmem.XMemSRCppUtilities.httpinvoke(XMemSRCppUtilities.java:74)
com.ibm.ws390.orb.ServerRegionBridge.httpinvoke(ServerRegionBridge.java:215)
com.ibm.ws390.orb.ORBEJSBridge.httpinvoke(ORBEJSBridge.java:281)
sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:600)
com.ibm.ws390.orb.parameters.HTTPInvoke.HTTPInvokeParmSetter(HTTPInvoke.java:101)
com.ibm.ws390.orb.CommonBridge.nativeRunApplicationThread(Native Method)
com.ibm.ws390.orb.CommonBridge.runApplicationThread(CommonBridge.java:464)
com.ibm.ws.util.ThreadPool$ZOSWorker.run(ThreadPool.java:1763)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

勿忘初心 2024-11-23 06:20:11

设置驱动程序属性 fullMaterializeLobData。最有可能的是,驱动程序试图抛出异常,但驱动程序中缺少该类。另外,如果可能的话,我建议迁移到 type-4 驱动程序。

Set the driver property fullyMaterializeLobData. Most likely the driver is attempting to throw you and exception but the class for it is missing from drivers. Also, I would recommend migrating to the type-4 drivers if ever possible.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文