Solved

How to extract datasource from persistance.xml file

Posted on 2009-05-13
1
441 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 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Requested array size exceeds VM limit 3 84
Strange loading of website behaviour 3 32
ForLoop Example 3 40
couple of eclipse 5 21
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now