'用戶必須在 weblogic 重新啟動時提供 JDBC 連接' ('The user must supply a JDBC connection' on weblogic restart)


問題描述

'用戶必須在 weblogic 重新啟動時提供 JDBC 連接' ('The user must supply a JDBC connection' on weblogic restart)

I am using Weblogic 11. After initial deployment of all JMS configurations, JDBC configuration (from XADS‑jdbc.xml) and ears everything works properly.

But after weblogic restart application fails to initialize with error

Caused By: java.lang.UnsupportedOperationException: The user must supply a JDBC connection
 at org.hibernate.connection.UserSuppliedConnectionProvider.getConnection(UserSuppliedConnectionProvider.java:54)
 at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51)
 at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:130)
 at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:349)
 at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
 at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
 at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
 at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)...

According to log JDBC and EAR start their initialization simultaniously. So when EAR tries to validate DB scheme JDBC configuration initialization is not completed yet.

What could fix such situation? Are there any weblogic configurations using which deployment items initialization could be ordered?

Thanks in Advance.

persistence.xml:

<?xml version="1.0" encoding="UTF‑8"?>
<persistence version="1.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_1_0.xsd">
<persistence‑unit name="TestDSPU" transaction‑type="JTA">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <jta‑data‑source>jdbc/testN/test/TestXADS</jta‑data‑source>
    <mapping‑file>META‑INF/orm.xml</mapping‑file>
    <properties>
        <!‑‑ <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9iDialect"/>  ‑‑>
        <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/> 
        <property name="hibernate.max_fetch_depth" value="3"/>
        <!‑‑ <property name="hibernate.cache.use_query_cache" value="true"/> ‑‑>
        <property name="hibernate.cache.region_prefix" value="hibernate.test"/>
        <property name="hibernate.jdbc.use_streams_for_binary" value="true"/>
        <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
        <property name="show_sql" value="true"/>
        <property name="hibernate.query.factory_class" value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory"/>
        <property name="hibernate.hbm2ddl.auto" value="validate" /> 
    </properties>
</persistence‑unit>
‑‑‑‑‑ ## 參考解法 #### 方法 1:

Did you try creating the JDBC connections through admin console? If not, please try creating the data source through admin console. Once done, open your config.xml, you should see something like below:

      <jdbc‑system‑resource>
        <name>TestXADS</name>
        <target>AdminServer</target>
        <descriptor‑file‑name>jdbc/TestXADS‑jdbc.xml</descriptor‑file‑name>
      </jdbc‑system‑resource>

Please Note: The outer node should be  <jdbc‑system‑resource >

方法 2:

I would double check WebLogic is deploying resources in the default order as stated in docs.

(by MarijaYogendra Singhfglez)

參考文件

  1. 'The user must supply a JDBC connection' on weblogic restart (CC BY‑SA 3.0/4.0)

#jdbc #java #initialization #weblogic






相關問題

在不啟動事務的情況下通過 Hibernate 對 MySQL 數據庫運行查詢意味著什麼? (What are the implications of running a query against a MySQL database via Hibernate without starting a transaction?)

Праблема з заявай аб абнаўленні Java (Java Update statement issue)

我的 Jar 應用程序(myapplication.jar + Mysql 連接器)在其他計算機上不起作用 (My Jar application(myapplication.jar + Mysql connector) doesnt work on other computer)

executeBatch JDBC 的堆大小錯誤 (Heapsize error with executeBatch JDBC)

格式為“07-apr-2016”的 Java 日期字符串在轉換為 sqldate 時會產生錯誤的結果 (A Java date string in the format "07-apr-2016" produces wrong result when converted to sqldate)

SQLite 中的臨時內存數據庫 (Temporary in-memory database in SQLite)

Websphere 6.1 中的 SQL 日誌記錄 (SQL logging in Websphere 6.1)

我在哪裡可以下載 MySQL Connector/J 的源代碼 (Where can I download source for MySQL Connector/J)

'用戶必須在 weblogic 重新啟動時提供 JDBC 連接' ('The user must supply a JDBC connection' on weblogic restart)

配置 Jetty 6 以使用 commons.dbcp 數據源 (Configuring Jetty 6 to use commons.dbcp datasource)

在netbeans上訪問mysql (Access mysql on netbeans)

spark中的jdbc更新語句 (Jdbc update statement in spark)







留言討論