- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试同时修改大约 14 个 REST 实体。
前几次修改是成功的(以及中间的一些修改),其他一些修改偶尔会失败,出现 HibernateException。
这是我的 servlet:
public class ReSTAPIFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
if (request instanceof HttpServletRequest && response instanceof HttpServletResponse) {
HttpServletResponse res = (HttpServletResponse) response;
HttpServletRequest req = (HttpServletRequest) request;
AnnotationConfigWebApplicationContext ctx = (AnnotationConfigWebApplicationContext) request
.getServletContext()
.getAttribute("org.springframework.web.servlet.FrameworkServlet.CONTEXT.Restful-Spring");
RESTEntityModifier bean = ctx.getBean(RESTEntityModifier.class);
if (bean.canHandle(req)) {
try {
bean.handle(req, res);
return;
} catch (Exception e) {
System.out.println(
req.getRequestURI() + "-T" + Thread.currentThread().hashCode() + " - " + e.getMessage());
return;
}
}
}
chain.doFilter(request, response);
}
@Override
public void destroy() {
}
}
这是句柄方法:
@Transactional
public void handle(HttpServletRequest r, HttpServletResponse response) throws Exception {
LOG.fine("Handle " + r.getMethod() + " " + r.getRequestURL() + " - Transaction: "
+ TransactionAspectSupport.currentTransactionStatus() + " T" + Thread.currentThread().hashCode());
entityManager.persist(...);
这是日志输出:
2019-06-18 11:32:15 FEIN x.web.rm.RESTEntityModifier handle Handle POST https://localhost/X/rest/BuildResult - Transaction: org.springframework.transaction.support.DefaultTransactionStatus@3b6dbbb5 T1440613991
2019-06-18 11:32:15 FEIN x.web.rm.RESTEntityModifier handle Handle PUT https://localhost/x/rest/buildResult/202/params - Transaction: org.springframework.transaction.support.DefaultTransactionStatus@51269d65 T1440613991
2019-06-18 11:32:15 FEIN x.web.rm.RESTEntityModifier handle Handle PUT https://localhost/x/rest/buildResult/202/params - Transaction: org.springframework.transaction.support.DefaultTransactionStatus@74e3d56b T590958110
2019-06-18 11:32:15 FEIN x.web.rm.RESTEntityModifier handle Handle PUT https://localhost/x/rest/buildResult/202/params - Transaction: org.springframework.transaction.support.DefaultTransactionStatus@2d07e97b T1576512215
2019-06-18 11:32:15 FEIN x.web.rm.RESTEntityModifier handle Handle PUT https://localhost/x/rest/buildResult/202/params - Transaction: org.springframework.transaction.support.DefaultTransactionStatus@3652c837 T590958110
2019-06-18 11:32:15 INFO org.hibernate.event.internal.DefaultLoadEventListener doOnLoad HHH000327: Error performing load command : org.hibernate.HibernateException: Unable to access lob stream
2019-06-18 11:32:15 INFO org.hibernate.event.internal.DefaultLoadEventListener doOnLoad HHH000327: Error performing load command : org.hibernate.HibernateException: Unable to access lob stream
2019-06-18 11:32:15 FEIN x.web.rm.RESTEntityModifier handle Handle PUT https://localhost/x/rest/buildResult/202/params - Transaction: org.springframework.transaction.support.DefaultTransactionStatus@684c4367 T590958110
/x/rest/buildResult/202/params-T1440613991 - Unable to access lob stream; nested exception is org.hibernate.HibernateException: Unable to access lob stream
/x/rest/buildResult/202/params-T1576512215 - Unable to access lob stream; nested exception is org.hibernate.HibernateException: Unable to access lob stream
2019-06-18 11:32:15 FEIN x.web.rm.RESTEntityModifier handle Handle PUT https://localhost/x/rest/buildResult/202/params - Transaction: org.springframework.transaction.support.DefaultTransactionStatus@571090c6 T1395592956
2019-06-18 11:32:15 FEIN x.web.rm.RESTEntityModifier handle Handle PUT https://localhost/x/rest/buildResult/202/params - Transaction: org.springframework.transaction.support.DefaultTransactionStatus@3b12eb0 T1440613991
2019-06-18 11:32:15 FEIN x.web.rm.RESTEntityModifier handle Handle PUT https://localhost/x/rest/buildResult/202/params - Transaction: org.springframework.transaction.support.DefaultTransactionStatus@5dd9b196 T590958110
2019-06-18 11:32:15 INFO org.hibernate.event.internal.DefaultLoadEventListener doOnLoad HHH000327: Error performing load command : org.hibernate.HibernateException: Unable to access lob stream
/x/rest/buildResult/202/params-T1395592956 - Unable to access lob stream; nested exception is org.hibernate.HibernateException: Unable to access lob stream
2019-06-18 11:32:15 FEIN x.web.rm.RESTEntityModifier handle Handle PUT https://localhost/x/rest/buildResult/202/params - Transaction: org.springframework.transaction.support.DefaultTransactionStatus@1ac1fbe9 T1395592956
2019-06-18 11:32:15 INFO org.hibernate.event.internal.DefaultLoadEventListener doOnLoad HHH000327: Error performing load command : org.hibernate.HibernateException: Unable to access lob stream
/x/rest/buildResult/202/params-T1440613991 - Unable to access lob stream; nested exception is org.hibernate.HibernateException: Unable to access lob stream
2019-06-18 11:32:15 FEIN x.web.rm.RESTEntityModifier handle Handle PUT https://localhost/x/rest/buildResult/202/params - Transaction: org.springframework.transaction.support.DefaultTransactionStatus@ba7efb6 T1440613991
2019-06-18 11:32:15 FEIN x.web.rm.RESTEntityModifier handle Handle PUT https://localhost/x/rest/buildResult/202/params - Transaction: org.springframework.transaction.support.DefaultTransactionStatus@7dabe5fc T590958110
2019-06-18 11:32:15 INFO org.hibernate.event.internal.DefaultLoadEventListener doOnLoad HHH000327: Error performing load command : org.hibernate.HibernateException: Unable to access lob stream
/x/rest/buildResult/202/params-T1395592956 - Unable to access lob stream; nested exception is org.hibernate.HibernateException: Unable to access lob stream
2019-06-18 11:32:16 FEIN x.web.rm.RESTEntityModifier handle Handle PUT https://localhost/x/rest/buildResult/202/params - Transaction: org.springframework.transaction.support.DefaultTransactionStatus@5df4cf5e T1395592956
2019-06-18 11:32:16 FEIN x.web.rm.RESTEntityModifier handle Handle PUT https://localhost/x/rest/buildResult/202/params - Transaction: org.springframework.transaction.support.DefaultTransactionStatus@279dc900 T590958110
2019-06-18 11:32:16 INFO org.hibernate.event.internal.DefaultLoadEventListener doOnLoad HHH000327: Error performing load command : org.hibernate.HibernateException: Unable to access lob stream
/x/rest/buildResult/202/params-T1395592956 - Unable to access lob stream; nested exception is org.hibernate.HibernateException: Unable to access lob stream
2019-06-18 11:32:16 INFO org.hibernate.event.internal.DefaultLoadEventListener doOnLoad HHH000327: Error performing load command : org.hibernate.HibernateException: Unable to access lob stream
2019-06-18 11:32:16 FEIN x.web.rm.RESTEntityModifier handle Handle PUT https://localhost/x/rest/buildResult/202/params - Transaction: org.springframework.transaction.support.DefaultTransactionStatus@fa7fdbd T1395592956
/x/rest/buildResult/202/params-T1440613991 - Unable to access lob stream; nested exception is org.hibernate.HibernateException: Unable to access lob stream
2019-06-18 11:32:16 FEIN x.web.rm.RESTEntityModifier handle Handle PUT https://localhost/x/rest/buildResult/202/params - Transaction: org.springframework.transaction.support.DefaultTransactionStatus@b0f4477 T1440613991
2019-06-18 11:32:16 FEIN x.web.rm.RESTEntityModifier handle Handle PUT https://localhost/x/rest/buildResult/202/params - Transaction: org.springframework.transaction.support.DefaultTransactionStatus@4026ebe4 T384544935
2019-06-18 11:32:16 INFO org.hibernate.event.internal.DefaultLoadEventListener doOnLoad HHH000327: Error performing load command : org.hibernate.HibernateException: Unable to access lob stream
/x/rest/buildResult/202/params-T1395592956 - Unable to access lob stream; nested exception is org.hibernate.HibernateException: Unable to access lob stream
2019-06-18 11:32:16 INFO org.hibernate.event.internal.DefaultLoadEventListener doOnLoad HHH000327: Error performing load command : org.hibernate.HibernateException: Unable to access lob stream
/x/rest/buildResult/202/params-T1440613991 - Unable to access lob stream; nested exception is org.hibernate.HibernateException: Unable to access lob stream
2019-06-18 11:32:16 FEIN x.web.rm.RESTEntityModifier handle Handle PATCH https://localhost/x/buildResult/202/finished - Transaction: org.springframework.transaction.support.DefaultTransactionStatus@415fd4ad T384544935
我使用 hibernate-envers:5.4.3-final、Hibernate-core:5.4.3-final 和 Spring-tx-5.1.7-Release
这些请求未成功:
所有其他请求均成功。
这是堆栈跟踪:
org.springframework.orm.jpa.JpaSystemException: Unable to access lob stream; nested exception is org.hibernate.HibernateException: Unable to access lob stream
at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:407)
at org.springframework.orm.jpa.DefaultJpaDialect.translateExceptionIfPossible(DefaultJpaDialect.java:127)
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:242)
at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:545)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:746)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:714)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:534)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:305)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
at X.RESTEntityModifier$$EnhancerBySpringCGLIB$$b9cd3ce3.handle(<generated>)
at X.ReSTAPIFilter$1.run(ReSTAPIFilter.java:39)
Caused by: org.hibernate.HibernateException: Unable to access lob stream
at org.hibernate.type.descriptor.java.PrimitiveByteArrayTypeDescriptor.wrap(PrimitiveByteArrayTypeDescriptor.java:123)
at org.hibernate.type.descriptor.java.PrimitiveByteArrayTypeDescriptor.wrap(PrimitiveByteArrayTypeDescriptor.java:26)
at org.hibernate.type.descriptor.sql.BlobTypeDescriptor$1.doExtract(BlobTypeDescriptor.java:48)
at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:47)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:257)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:253)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:243)
at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:329)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:3014)
at org.hibernate.loader.plan.exec.process.internal.EntityReferenceInitializerImpl.loadFromResultSet(EntityReferenceInitializerImpl.java:305)
at org.hibernate.loader.plan.exec.process.internal.EntityReferenceInitializerImpl.hydrateEntityState(EntityReferenceInitializerImpl.java:233)
at org.hibernate.loader.plan.exec.process.internal.AbstractRowReader.readRow(AbstractRowReader.java:103)
at org.hibernate.loader.plan.exec.internal.EntityLoadQueryDetails$EntityLoaderRowReader.readRow(EntityLoadQueryDetails.java:254)
at org.hibernate.loader.plan.exec.process.internal.ResultSetProcessorImpl.extractResults(ResultSetProcessorImpl.java:122)
at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:122)
at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:86)
at org.hibernate.loader.entity.plan.AbstractLoadPlanBasedEntityLoader.load(AbstractLoadPlanBasedEntityLoader.java:197)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:4278)
at org.hibernate.event.internal.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:480)
at org.hibernate.event.internal.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:450)
at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:201)
at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:260)
at org.hibernate.event.internal.DefaultLoadEventListener.doOnLoad(DefaultLoadEventListener.java:103)
at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:71)
at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1286)
at org.hibernate.internal.SessionImpl.internalLoad(SessionImpl.java:1163)
at org.hibernate.internal.ExceptionConverterImpl.wrapStaleStateException(ExceptionConverterImpl.java:220)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:93)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)
at org.hibernate.internal.ExceptionConverterImpl.convertCommitException(ExceptionConverterImpl.java:65)
at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:107)
at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:532)
... 9 more
Caused by: org.postgresql.util.PSQLException: LargeObjects (LOB) dürfen im Modus 'auto-commit' nicht verwendet werden.
at org.postgresql.largeobject.LargeObjectManager.open(LargeObjectManager.java:265)
at org.postgresql.largeobject.LargeObjectManager.open(LargeObjectManager.java:251)
at org.postgresql.jdbc.AbstractBlobClob.getLo(AbstractBlobClob.java:283)
at org.postgresql.jdbc.AbstractBlobClob.getBinaryStream(AbstractBlobClob.java:127)
at org.hibernate.type.descriptor.java.PrimitiveByteArrayTypeDescriptor.wrap(PrimitiveByteArrayTypeDescriptor.java:120)
... 40 more
为什么有些不成功?
最佳答案
我发现了一个被抑制的异常:
它指出该异常是 hibernate 或 spring-tx 内部的错误,隐藏了原始异常(同时更新行问题)。
所以答案是将它们放入同步方法中:
private synchronized void handle(HttpServletResponse res,
HttpServletRequest req, RESTEntityModifier bean) throws Exception {
bean.handle(req, res);
}
关于java - 偶尔出现 HibernateException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56646309/
我有 4 个 TextView。它们一开始都是不可见的,我将它们动画到屏幕上(从底部滑入)。我启动一个线程来为每个动画制作动画,每个动画开始时间间隔 200 毫秒。问题是:开始 Activity 后第
我有一个奇怪的问题,我似乎无法解决。 :(我有一个基于 Web 的应用程序,可以发送电子邮件。它通过连接在本地网络上设置的基于 Windows 的 SMTP 服务器来实现。此 SMTP 服务器不需要我
从昨天开始,我一直遇到一些设备收不到推送通知的问题。证书/设备 token 似乎是正确的,因为直到昨天,该设备还可以成功接收推送通知。 在服务器端,没有错误或连接拒绝,而且推送通知似乎每次都发送成功。
我有一个将 Angular 错误记录到数据库的应用程序,并且我偶尔会看到此错误的日志 Error: [$compile:tpload] http://errors.angularjs.org/1.5.
我收到一个 ImportError from azure.storage.blob import BlobServiceClient 但是我意识到当我安装依赖项时会发生错误 pip install a
我已经完成了使用AVAudioPlayer实现的简单音频播放GUI。 播放声音时,我使用UISlider提供播放反馈... 这是奇怪的地方。 我有一个非常偶尔发生的问题-而且大多数情况都不会发生,因此
在我的 XNA 游戏中,我的计算机(2.5 Ghz 双核 Intel Centrino 2)在 Debug模式下有一个大约需要 10 毫秒的操作。它只会每隔几分钟运行一次,它基本上只是整数数学/按位运
我相信我的应用程序编码正确(至少大部分是这样),因为它在大约 98% 的时间里都能正常工作。但是,大约 2% 的时间,我得到的似乎是有效的身份验证 token ,但是当我去发布照片时,我收到以下错误“
我在 apple store 上有一个应用程序,在 iOS6 更新后,我在 MKMapView 中收到了数百份崩溃报告。我无法在我的设备上重现崩溃。它看起来像是 EAGLContext 的问题。我们不
我最近开始使用 Foundation 5(我第一次使用 Foundation),我遇到了一个问题,似乎任何元素都响应了 .click 事件(例如顶部导航栏,单击元素时显示的数据下拉列表)将随机不起作用
花了大约一整天的时间试图解决这个问题,希望有人能帮助我!我是新来的,所以如果这是一个重复的问题,我深表歉意(我做了我的研究,但无法提前找到任何东西)。 我正在为我的咨询公司构建的网站使用浏览器缓存,但
我有一个表格,使用了以下 CSS 和 HTML: .price { position:relative; display:block; text-align:center; }
我们使用 ansible 将多个节点配置为一个集群。这些机器是在自定义 AWS 类似基础设施上创建的实例。 我们在不同的剧本上有大约一百个任务,它们在每个节点上执行。 问题是,我们收到零星的主机无法访
我们偶尔会从用户那里收到崩溃报告(我们使用崩溃报告程序包将崩溃发送到我们的服务器),并出现以下错误: “非法尝试在不同上下文中的对象之间建立关系‘...’” (不同的报表可能有不同的关系,并非所有报表
我是一名优秀的程序员,十分优秀!