Solved

How to extract datasource from persistance.xml file

Posted on 2009-05-13
1
429 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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
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 …

762 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

6 Experts available now in Live!

Get 1:1 Help Now