Solved

How to extract datasource from persistance.xml file

Posted on 2009-05-13
1
473 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 12

Accepted Solution

by:
Gibu George earned 500 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

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…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

705 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