ensuring datasource loads first
columod Jun 6, 2003 5:24 AMhi all,
i'm having a problem restarting jboss and my hibernate sar not redeploying properly.
basically it can't find the datasource. if i start jboss and deploy the sar everything works fine and i can then access the datasource through hibernate.
however, when i restart jboss i get the following error :
2003-06-04 15:10:45,893 FATAL [cirrus.hibernate.connection.DatasourceConnectionProvider] Could not find datasource: java:/ymmgeurope
javax.naming.NameNotFoundException: ymmgeurope not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:492)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:471)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at cirrus.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:41)
at cirrus.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:74)
at cirrus.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:138)
at cirrus.hibernate.impl.DatastoreImpl.buildSessionFactory(DatastoreImpl.java:403)
at cirrus.hibernate.impl.DatastoreImpl.buildSessionFactory(DatastoreImpl.java:392)
at cirrus.hibernate.jmx.HibernateService.bindSessionFactory(HibernateService.java:153)
at cirrus.hibernate.jmx.HibernateService.start(HibernateService.java:125)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
i think this is happening because the mysql datasource hasn't been loaded before the hibernate.sar but unsure how to get the hibernate.sar file to wait until the datasource is bound?
my mysql-ds.xml is :
<?xml version="1.0" encoding="UTF-8"?>
<local-tx-datasource>
<jndi-name>ymmgeurope</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/ymmgeurope</connection-url>
<driver-class>org.gjt.mm.mysql.Driver</driver-class>
<user-name>user</user-name>
pswd
</local-tx-datasource>
and the jboss-service.xml in the hibernate.sar is :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE server>
<!--
automatically generated by xdoclet. do not edit
-->
jboss.jca:service=RARDeployer
com/yahoo/app/ymmg/hibernate/UserProfile.hbm.xml
java:/hibernate/ymmg
java:/ymmgeurope
cirrus.hibernate.sql.MySQLDialect
user
pswd
false
true
i think the solution is to create a depends relationship in my hibernate.sar but unsure how to do this with a datasource??
any help with this much appreciated.
cheers,
colum.