Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

How to extract datasource from persistance.xml file

Posted on 2009-05-13
1
Medium Priority
?
483 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 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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 learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

647 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