【问题标题】:MDB not persisting data in sql serverMDB 不在 sql server 中持久化数据
【发布时间】:2017-11-30 13:06:42
【问题描述】:

我已将 MDB 配置为接收传入消息并使用 JPA (eclipseLink) 通过 SLSB 将其持久化。数据库为一条消息插入工作,但在负载条件下(每秒 3 或 4 条消息),数据不会持久保存在数据库中。我可以在日志中看到 sql Insert 查询,但在 DB 中没有数据。 持久性文件:

<?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="mainPU" transaction-type="JTA"> -->
    <persistence-unit name="mainPU" transaction-type="JTA">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <jta-data-source>ecpcPool</jta-data-source>
        <class>com.fc.ECP.domain.Address</class>
        <class>com.fc.ECP.domain.Customer</class>
        <class>com.fc.ECP.domain.DocumentationSignature</class>
        <class>com.fc.ECP.domain.EcpSystem</class>
        <class>com.fc.ECP.domain.EcpTransaction</class>
        <class>com.fc.ECP.domain.EcpWkflw</class>
        <class>com.fc.ECP.domain.EidVerify</class>
        <class>com.fc.ECP.domain.EsignDetail</class>
        <class>com.fc.ECP.domain.Finpln</class>
        <class>com.fc.ECP.domain.FinplnDocumentation</class>
        <class>com.fc.ECP.domain.ThirdPartyCrdntl</class>
        <class>com.fc.ECP.domain.ThirdPartyDocumentation</class>
        <class>com.fc.ECP.domain.TransactionType</class>
        <class>com.fc.ECP.domain.Advice</class>
        <class>com.fc.ECP.domain.Advcln</class>
        <exclude-unlisted-classes>false</exclude-unlisted-classes>
        <shared-cache-mode>NONE</shared-cache-mode>
        <properties>
            <property name="eclipselink.target-server" value="WebLogic_10" 
/>
            <property name="javax.persistence.jtaDataSource" 
value="ecpcPool" />
            <!-- <property name="javax.persistence.jtaDataSource" 
value="jdbc/MicrosoftSQLServer"/> -->
            <!-- <property name="javax.persistence.jtaDataSource" 
value="ecp_prx_ds"/> -->
            <property name="eclipselink.target-database"

value="org.eclipse.persistence.platform.database.SQLServerPlatform" />
            <property name="eclipselink.session.customizer" 
value="com.fc.adr.jpa.JPASessionCustomizer" />
            <property name="com.fc.adr.jpa.schema" value="$(mainPU.schema)" 
/>
            <property name="com.fc.adr.jpa.schema.sequences" 
value="$(mainPU.schema.sequences)" />
            <property name="eclipselink.logging.logger" 
value="DefaultLogger" />
            <property name="eclipselink.logging.level.sql" value="FINE" />
            <property name="eclipselink.logging.level" value="FINE" />
            <property name="eclipselink.logging.parameters" value="true" />
            <property name="eclipselink.persistence-context.flush-mode" 
value="commit" />
        </properties>
    </persistence-unit>
</persistence>

【问题讨论】:

    标签: sql-server jpa weblogic12c


    【解决方案1】:

    切换到 MDB 的 EJB2 样式配置。
    根本原因: EJB3 风格的 MDB 的方法由 CDI 注入包装。 堆栈跟踪中的包装类之一是:com.oracle.pitchfork.intercept.MethodInvocationInvocationContext 它在 weblogic 的 spring 框架模块 jar 中 MethodInvocationInvocationContext 在“java:comp/WebServiceContext”的 JNDI 树中查找 WebServiceContext 拥有 jax-ws 服务会将 WebServiceContext 置于“java:comp/WebServiceContext” 如果存在 WebServiceContext,则 MethodInvocationInvocationContext 尝试访问其 MessageDrivenContext 的值 如果在 Web 服务调用之外访问,规范要求 WebServiceContext 抛出 IllegalStateException

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-18
      • 2022-08-10
      • 2021-09-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多