异常[EclipseLink-7114](Eclipse持久性服务 - 2.5.1.v20130824-981335c):org.eclipse.persistence.exceptions.ValidationException异常 说明:客户端当前不支持隔离数据 会话经纪人。
此异常发生在应用程序启动期间。 这个例外的令人沮丧的方面是它是随机发生的!
该应用程序使用Eclipselink的Composite Persistence Unit功能。在启动应用程序时,它会在抛出此异常之前打印以下日志消息:
[EL Info]: connection: 2016-11-27 12:26:24.125--ServerSession(1424344630)--PU1 login successful
[EL Info]: connection: 2016-11-27 12:26:24.14--ServerSession(1670276602)--PU2 login successful
[EL Info]: connection: 2016-11-27 12:26:24.14--ServerSession(780412982)-- PU3 login successful
随后会打印以下几条消息:
[EL Warning]: metadata: 2016-11-27 12:26:24.156--ServerSession(1424344630)--Reverting the lazy setting on the OneToOne or ManyToOne attribute [attrname] for the entity class [class fully_qualified_class_name] since weaving was not enabled or did not occur.
然后按如下方式打印PU注销消息:
[EL Info]: connection: 2016-11-27 12:26:24.906--ServerSession(1424344630)--PU1 logout successful
[EL Info]: connection: 2016-11-27 12:26:24.906--ServerSession(1670276602)--PU2 logout successful
[EL Info]: connection: 2016-11-27 12:26:24.906--ServerSession(780412982)--PU3 logout successful
之后,立即抛出有关隔离数据的验证异常:
Nov 27, 2016 12:26:24 PM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource' defined in ServletContext resource [/WEB-INF/mvc dispatcher-servlet.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [fully_qualified_class_name]: Constructor threw exception; nested exception is Exception [EclipseLink-7114] (Eclipse Persistence Services - 2.5.3.v20150122-8d884e3): org.eclipse.persistence.exceptions.ValidationException Exception Description: Isolated Data is not currently supported within a Client Session Broker. Session named PU3 contains descriptors representing isolated data.
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:275)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1143)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.context.support.AbstractApplicationContext.initMessageSource(AbstractApplicationContext.java:697)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:526)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:667)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:633)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:681)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:552)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:493)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5176)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5460)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
以下是Composite PU
persistence.xml:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_1_0.xsd" version="1.0">
<persistence-unit name="compositePu" transaction-type="RESOURCE_LOCAL">
<provider> org.eclipse.persistence.jpa.PersistenceProvider </provider>
<jar-file>PU1-entities.jar</jar-file>
<jar-file>PU2-entities.jar</jar-file>
<jar-file>PU3-entities.jar</jar-file>
<properties>
<property name="eclipselink.composite-unit" value="true" />
</properties>
</persistence-unit>
以下是各个PU的persistence.xml的结构。它们都遵循类似的结构:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="PU3" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
---- list of fully qualified entity class names ----
<properties>
<property name="eclipselink.weaving" value="false" />
<property name="javax.persistence.validation.group.pre-update" value="none" />
<property name="eclipselink.target-database" value="MySQL" />
<property name="eclipselink.ddl-generation" value="none" />
<property name="eclipselink.persistence-context.flush-mode" value="COMMIT" />
<property name="eclipselink.persistence-context.close-on-commit" value="true" />
<property name="javax.persistence.validation.group.pre-persist" value="" />
<property name="eclipselink.cache.shared.default" value="false" />
<property name="eclipselink.logging.parameters" value="true" />
<property name="eclipselink.logging.level" value="FINEST" />
<property name="eclipselink.logging.parameters" value="true" />
<property name="eclipselink.cache.shared.default" value="false" />
</properties>
</persistence-unit>
</persistence>
答案 0 :(得分:0)
警告:这不是正确的答案。问题再次出现!
将eclipselink.cache.shared.default
和eclipselink.multitenant.tenants-share-cache
设置为 false 可消除隔离数据异常。
将eclipselink.cache.shared.default
设置为false并具有多租户加入表继承实体,触发Cache Isolation Level Warning on Parent Entity中解释的行为的随机发生。但请注意,我对随机行为一无所知。
eclipselink.multitenant.tenants-share-cache
设置为false之外,将eclipselink.cache.shared.default
设置为false会导致一致消除隔离数据异常。