-
1. Re: How to deploy a data source inside an archive on 4.0.3?
kabirkhan Jun 28, 2005 1:26 PM (in response to pesalomo)If you go to the JMX console, you should find your datasource listed. It's ObjectName should be something like:
jboss.jca:service=DataSourceBinding,name=MYDSNAME
You can use the @org.jboss.annotation.ejb.Depends annotation to specify dependencies on other services.
Example:
@Stateless
@Depends ("jboss.jca:service=DataSourceBinding,name=MYDSNAME")
public class MyBean implements ....
{
]
See the Service bean tutorial example for more information regarding Depends. -
2. Re: How to deploy a data source inside an archive on 4.0.3?
donniedarko Jun 28, 2005 4:28 PM (in response to pesalomo)I'm having similiar problems with packaging under 4.0.3 and I wonder how the @Depends attribute solves the case when you have a .ear with one .war, one .sar that contains the definition of a database login module that requires a DS and a .par which contains the persistence.xml and some ejb's.
In my case no matter what the application.xml says the ejbs inside of the .par always gets deployed first and therefore the DS is not registered until after the ejb's are deployed (which uses Default DS instead of the one defined inside of the .par in persistence.xml).
Note that im not using any .ejb3 extension since that seems to have the effect that the default DS is always used.
There must be a more smooth way to solve this? I have two datasources defined in the persistence.xml inside the .par, and in the stateless session beans i want to use them both with the @PersistenceContext attribute, but the real issue is that I cant get the datasources and their entity managers to be registered prior to the .sar and the ejb's inside of the .par since the ejbs inside of the .par always - with no exception is deployed before the actual DS definition in the persistence.xml.
Best regards
Jon Åkerström -
3. Re: How to deploy a data source inside an archive on 4.0.3?
pesalomo Jun 28, 2005 5:00 PM (in response to pesalomo)A service bean seems to solve the dependency issue for that particular service bean. But it still seams that the parsing of persistence.xml takes place before the datasource is bound. And so all my entitybeans crashes. Does this mean I have to put a depends annotation on every bean? It would be better to set the dependency in i.e. jboss.xml - but somehow that file doesn't seem to be processed during deployment...
22:57:07,013 INFO [Ejb3Module] Found persistence.xml file in EJB3 jar
22:57:07,052 INFO [Configuration] processing extends queue
22:57:07,052 INFO [Configuration] processing collection mappings
22:57:07,053 INFO [Configuration] processing association property references
22:57:07,053 INFO [Configuration] processing foreign key constraints
22:57:07,093 INFO [Configuration] processing extends queue
22:57:07,093 INFO [Configuration] processing collection mappings
22:57:07,093 INFO [Configuration] processing association property references
22:57:07,093 INFO [Configuration] processing foreign key constraints
22:57:07,094 INFO [NamingHelper] JNDI InitialContext properties:{}
22:57:07,107 FATAL [DatasourceConnectionProvider] Could not find datasource: java:LMCMSDS
javax.naming.NameNotFoundException: LMCMSDS not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:491)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:499)
at org.jnp.server.NamingServer.getObject(NamingServer.java:505)
at org.jnp.server.NamingServer.lookup(NamingServer.java:278) -
4. Re: How to deploy a data source inside an archive on 4.0.3?
bill.burke Jun 29, 2005 12:00 AM (in response to pesalomo)-ds.xml files should be deployed before EJB3's and .PARs. I'll add a jira task.
-
5. Re: How to deploy a data source inside an archive on 4.0.3?
asael Sep 16, 2005 2:04 PM (in response to pesalomo)I saw that this JIRA was closed but the issue still exists.
( http://jira.jboss.com/jira/browse/EJBTHREE-205 )
Simply think of an EAR with a datasource. The EAR deployer will first deploy the par wher it finds the reference to the datasource but the datasource hasn't been deployed yet ?
Or are there any workarounds? -
6. Re: How to deploy a data source inside an archive on 4.0.3?
asael Sep 16, 2005 2:30 PM (in response to pesalomo)Sorry clicked submit too fast.
But I think the dependency shouldn't be on the persistence object. How about adding a kind of depends child in the application.xsd of ejb ?
Or even a default depends if a entitymanager is referenced ? -
7. Re: How to deploy a data source inside an archive on 4.0.3?
bill.burke Sep 17, 2005 8:48 PM (in response to pesalomo)The ds.xml file should be deployed before ejb3, not sure why its not. I'll look into it.
But I should do this:
I'll set up a dependency between:
1) The entity manager and the datasource
2) the EJB and the entity-manager
Eventually, i'll add one between the war and the EM too.
BTW, not sure why I closed the bug the first time. Sorry! -
8. Re: How to deploy a data source inside an archive on 4.0.3?
asael Sep 18, 2005 8:03 AM (in response to pesalomo)I think everything would work fine when simply the datasource is bound before the .par is deployed.
Lets close this one and do the rest on this topic -->
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=69457
Because there you added the JIRA etc -
9. Re: How to deploy a data source inside an archive on 4.0.3?
khoyaraaz Nov 11, 2005 2:34 PM (in response to pesalomo)"pesalomo" wrote:
A service bean seems to solve the dependency issue for that particular service bean. But it still seams that the parsing of persistence.xml takes place before the datasource is bound. And so all my entitybeans crashes. Does this mean I have to put a depends annotation on every bean? It would be better to set the dependency in i.e. jboss.xml - but somehow that file doesn't seem to be processed during deployment...
22:57:07,013 INFO [Ejb3Module] Found persistence.xml file in EJB3 jar
22:57:07,052 INFO [Configuration] processing extends queue
22:57:07,052 INFO [Configuration] processing collection mappings
22:57:07,053 INFO [Configuration] processing association property references
22:57:07,053 INFO [Configuration] processing foreign key constraints
22:57:07,093 INFO [Configuration] processing extends queue
22:57:07,093 INFO [Configuration] processing collection mappings
22:57:07,093 INFO [Configuration] processing association property references
22:57:07,093 INFO [Configuration] processing foreign key constraints
22:57:07,094 INFO [NamingHelper] JNDI InitialContext properties:{}
22:57:07,107 FATAL [DatasourceConnectionProvider] Could not find datasource: java:LMCMSDS
javax.naming.NameNotFoundException: LMCMSDS not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:491)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:499)
at org.jnp.server.NamingServer.getObject(NamingServer.java:505)
at org.jnp.server.NamingServer.lookup(NamingServer.java:278)