设为首页 收藏本站
查看: 769|回复: 0

[经验分享] Proper definition of Oracle XA datasource in configuration

[复制链接]

尚未签到

发表于 2016-8-2 22:55:25 | 显示全部楼层 |阅读模式
I'm trying to make an XA datasource with Oracle in JBoss 7 (standalone-preview).  I'm getting errors from this (I'll attach the relevant log file at the end of the post) -- saying it can't find the driver-name child.
 
From my understanding, I need to create the datasource definition in the standalone.xml (or standalone-preview.xml) file.  I first created the Oracle module:
 
1.  In /modules/com/oracle directory I put the ojdbc6.jar file and created a new file called modules.xml that reads:
 
<module xmlns="urn:jboss:module:1.0" name="com.oracle.db">
    <resources>
        <resource-root path="ojdbc6.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
    </dependencies>
</module>
 
2.  In my standalone-preview.xml I added the following section to the xml file (replacing the sample h2 datasource that was there):
 
     <subsystem xmlns="urn:jboss:domain:datasources:1.0">
         <subsystem xmlns="urn:jboss:domain:datasources:1.0">
            <datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:noNamespaceSchemaLocation="http://www.jboss.org/ironjacamar/schema/datasources_1_0.xsd">
               <xa-datasource jndi-name="ds/MYDATASOURCE" pool-name="ds/MYDATASOURCE"
                  enabled="true" jta="true" use-java-context="true" use-ccm="true">
                  <xa-datasource-property name="URL">jdbc:oracle:thin:@MYSERVER.DOMAIN.COM:1521:MYSCHEMA
                  </xa-datasource-property>
                  <xa-datasource-property name="User">USERNAME</xa-datasource-property>
                  <xa-datasource-property name="Password">PASSWORD</xa-datasource-property>
 
 
                  <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
                  <xa-pool>
                     <is-same-rm-override>false</is-same-rm-override>
                     <no-tx-separate-pools />
                  </xa-pool>
                  <validation>
                     <valid-connection-checker
                        class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"></valid-connection-checker>
                     <stale-connection-checker
                        class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"></stale-connection-checker>
                     <exception-sorter
                        class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"></exception-sorter>
                  </validation>
               </xa-datasource>
               <drivers>
                  <driver name="ojdbc6.jar" module="com.oracle">
                     <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
                  </driver>
               </drivers>
            </datasources>
         </subsystem>
 
I have tried finding an example of an XA datasource for the new JBoss 7 but unable to find one.  I did find some documentation in the IronJacamar web page (http://docs.jboss.org/ironjacamar/userguide/1.0/en-US/html_single/#ex_datasources_oracle_xa) but that seems out of date and incorrect.  It references a note saying to change "pad-true" in transaction.xml but no file of that name exists in JBoss 7.  It also has a reference to <no-tx-separate-pools /> which is incompatible with the XSD when I had it in there -- so I basically don't think I can trust that documentation.
 
Here's the log file output I get.  It makes it appear as though it's a problem with the xa-datasource xml fragment, not fro mthe driver fragment in my definition:
 
12:32:13,311 INFO  [org.jboss.modules] JBoss Modules version 1.0.1.GA
12:32:13,467 INFO  [org.jboss.msc] JBoss MSC version 1.0.0.GA
12:32:13,506 INFO  [org.jboss.as] JBoss AS 7.0.1.Final "Zap" starting
12:32:14,132 WARN  [org.jboss.as] No security realm defined for native management service, all access will be unrestricted.
12:32:14,186 INFO  [org.jboss.as] creating http management service using network interface (management) port (9990)
12:32:14,188 WARN  [org.jboss.as] No security realm defined for http management service, all access will be unrestricted.
12:32:14,197 INFO  [org.jboss.as.logging] Removing bootstrap log handlers
12:32:14,203 ERROR [org.jboss.as.controller] (Controller Boot Thread) Operation ("add") failed - address: ([
    ("subsystem" => "datasources"),
    ("xa-data-source" => "ds/GAPCore")
]): java.util.NoSuchElementException: No child 'driver-name' exists
          at org.jboss.dmr.ModelValue.requireChild(ModelValue.java:362)
          at org.jboss.dmr.ObjectModelValue.requireChild(ObjectModelValue.java:298)
          at org.jboss.dmr.ModelNode.require(ModelNode.java:703)
          at org.jboss.as.connector.subsystems.datasources.AbstractDataSourceAdd.performRuntime(AbstractDataSourceAdd.java:87)
          at org.jboss.as.controller.AbstractAddStepHandler$1.execute(AbstractAddStepHandler.java:50)
          at org.jboss.as.controller.OperationContextImpl.executeStep(OperationContextImpl.java:351)
          at org.jboss.as.controller.OperationContextImpl.doCompleteStep(OperationContextImpl.java:298)
 
 
Any help or pointers to documentation would be much appreciated.
 
thanks,
Mike
 

Re: Proper definition of Oracle XA datasource in configuration

[size=1em]I found my problem(s) -- first, I needed to update/fix the module name to match what I had used in the modules/com/oracle/modules.xml file, so it now reads in my standalone-preview.xml file:
[size=1em] 

   <driver name="ojdbc6.jar" module="com.oracle.db">
[size=1em] 
[size=1em]and I also have to reference the driver in the <xa-datasource> xml fragment before the <drivers> fragment:
[size=1em] 

   <driver>ojdbc6.jar</driver>
[size=1em] 
[size=1em]and that ended up pretty much fixing things.
[size=1em] 
[size=1em]I'm still confused where to put the padding="true" like I used to configure in my older JBoss 4.2.2.  Is that still needed?

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-252188-1-1.html 上篇帖子: 查看oracle用户权限表空间等常用方法 下篇帖子: 官方免安版Oracle客户端(PLSQL Developer 8.0.3.1510),使用PL/SQL Developer连接Oracle__自己总结
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表