Hi,

you have mostly two ways:
0/ avoid to put the datasource in the deploy folder, else you mix deploy and boot features 1/ you define the datasource blueprint in the feature (using <configfile/>), and so you can define the features dependency chain 2/ you package the blueprint in OSGI-INF/blueprint of a bundle (just a wrap bundle) that you can also define in the feature XML

Regards
JB

On 06/16/2014 04:01 PM, jkraushaar wrote:
Hello,

I try to create a custom distribution. My distribution contains a data
source and a bundle containing EJB and JPA classes referencing the data
source. The data source is deployed as Blueprint XML file in the deploy
folder. The EJB/JPA bundle is part of a custom feature which is set as
featuresBoot in etc/org.apache.karaf.features.cfg.

When I start Karaf the first time, I get the following exception:

org.apache.openejb.OpenEJBException: Creating application failed:
/.../karaf.customdistro/target/karaf.customdistro-0.0.1-SNAPSHOT/data/cache/bundle157/version0.0/bundle.jar:
org.apache.openejb.OpenEJBException: Could not lookup <jta-data-source>
'openejb/Resource/osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/example)'
for unit 'Example': Unknown JNDI name prefix 'openejb/Resource/osgi:': Could
not lookup <jta-data-source>
'openejb/Resource/osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/example)'
for unit 'Example': Unknown JNDI name prefix 'openejb/Resource/osgi:'

It seems that the data source is deployed after the EJB/JPA bundle, even if
the EJB/JPA bundle has a higher start level. Hence the OSGi service is not
available and the initialization fails.

Is there any chance to deploy the data source before the EJB/JPA bundle or
to defer the initialization?

Of course I can move my data source into a new bundle and deploy it as part
of the same feature, but then it would be extremly dificult for other
developers to alter user name and password in the data source.

Thanks,
Jochen



--
View this message in context: 
http://karaf.922171.n3.nabble.com/How-to-deploy-data-source-before-EJB-JPA-bundle-tp4033529.html
Sent from the Karaf - User mailing list archive at Nabble.com.


--
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to