异常[EclipseLink-7114](Eclipse Persistence Services - 2.5.1.v20130824-981335c):org.eclipse.persistence.exceptions.ValidationException异常说明:客户端会话代理当前不支持隔离数据.
在应用程序启动期间发生此异常.这个例外的令人沮丧的方面是它是随机发生的!
该应用程序使用Eclipselink的复合持久性单元功能.在启动应用程序时,它会在抛出此异常之前打印以下日志消息:
[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
Run Code Online (Sandbox Code Playgroud)
之后会打印以下几条消息:
[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.
Run Code Online (Sandbox Code Playgroud)
然后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]: …
Run Code Online (Sandbox Code Playgroud) 我的REST服务部署在Tomcat 7.0.64(http:// localhost:8080/xxx)下.我使用HTML页面源代码的JavaScript库来调用这些服务.这些HTML页面由另一个orgin(http:// localhost:9090/html/yyy.html)提供.
要在服务器上启用跨源请求,我在web.xml中配置了CORSFilter,如下所示:
<filter>
<filter-name>CorsFilter</filter-name>
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
<init-param>
<param-name>cors.allowed.origins</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.methods</param-name>
<param-value>GET,POST,HEAD,OPTIONS,PUT,PATCH,DELETE</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.headers</param-name>
<param-value>Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,X-CUSTOM1,X-CUSOM2,X-CUSTOM3</param-value>
</init-param>
<init-param>
<param-name>cors.exposed.headers</param-name>
<param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials,X-CUSTOM3</param-value>
</init-param>
<init-param>
<param-name>cors.support.credentials</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>cors.preflight.maxage</param-name>
<param-value>10</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CorsFilter</filter-name>
<url-pattern>*</url-pattern>
</filter-mapping>
Run Code Online (Sandbox Code Playgroud)
从RequestDumper的以下输出中,您可以注意到来自浏览器的预检请求已收到成功响应(200).但是,403 Forbidden后面的实际请求失败了:
预检请求和响应
http-apr-8080-exec-6 ===============================================================
http-apr-8080-exec-8 START TIME =26-Sep-2015 21:28:53
http-apr-8080-exec-8 requestURI=/xxxx/zzzz
http-apr-8080-exec-8 authType=null
http-apr-8080-exec-8 characterEncoding=null
http-apr-8080-exec-8 contentLength=-1
http-apr-8080-exec-8 contentType=null
http-apr-8080-exec-8 contextPath=/xxxx
http-apr-8080-exec-8 header=host=localhost:8080
http-apr-8080-exec-8 header=connection=keep-alive
http-apr-8080-exec-8 header=pragma=no-cache
http-apr-8080-exec-8 header=cache-control=no-cache
http-apr-8080-exec-8 header=access-control-request-method=POST
http-apr-8080-exec-8 header=origin=http://localhost:9090
http-apr-8080-exec-8 header=user-agent=Mozilla/5.0 (Windows NT 6.3; …
Run Code Online (Sandbox Code Playgroud)