[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to extract datasource from persistance.xml file

Posted on 2009-05-13
1
Medium Priority
?
485 Views
Last Modified: 2013-12-29
Hello,

I have 3 files pom.xml of my web application, the persistence.xml file, gral-ds which contains all details of datasources. When I deploy it using maven I get:

--- MBeans waiting for other MBeans ---
ObjectName: persistence.units:ear=mdm-ear-1.0.ear,jar=xx.jar,unitName=EntityFacadeBean
  State: NOTYETINSTALLED
  I Depend On:
    jboss.jca:name=${ds.name},service=DataSourceBinding

--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss.jca:name=${ds.name},service=DataSourceBinding
  State: NOTYETINSTALLED
  Depends On Me:
    persistence.units:ear=mdm-ear-1.0.ear,jar=xxx.jar,unitName=EntityFacadeBean

What can I do so maven can read the defined connection Oracle and get the datasource?

Thanks!
pom.xml of my application
<properties>
    <AppVersion>1.0</AppVersion>
    <ds.name>Oracle</ds.name>
    <classifier>dev</classifier>
</properties>
------
persistence.xml 
<jta-data-source>java:/${ds.name}</jta-data-source> 
-----
file in jboss call gral-ds.xml
<datasources>
<local-tx-datasource>
 <jndi-name>Oracle</jndi-name>
<connection-url>jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = )(PORT = ))) (CONNECT_DATA = (SID = STV) (SERVER = DEDICATED)))</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>admin</user-name>
<password>admin</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<metadata>
<type-mapping>Oracle10g</type-mapping>
</metadata>
</local-tx-datasource>

Open in new window

0
Comment
Question by:Fionageo80
1 Comment
 
LVL 12

Accepted Solution

by:
Gibu George earned 1500 total points
ID: 24383132
I don't think you will be able to get the ds name from the jboss xml, You can do this using filters

add a filter

<filters>
      <filter>datasource.properties</filter>
    </filters>
in the datasource.properties add property ds.name=<value>, when the resources are filtered maven will replace the value from the property file will be replaced with the value. you need to add the persistence.xml into a resource
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month19 days, 18 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question