Hi Mohammad,
sorry but i dont see the light. I think my datasource is not deployed, but i
dont get howto do it. I've already investigated the forum and mailing list
and the examples i've found at search engine.
I get the following exception
javax.naming.NameNotFoundException: Name "java:/APPLDB" not found.
at
org.openejb.core.ivm.naming.IvmContext.federate(IvmContext.java:184)
at org.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:147)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
if i do the following:
DataSource db = (DataSource) myInitialContext.lookup("java:/APPLDB");
file: default.hsql_database.conf
#
# the path and file name of the first database file to use
#
server.database.0=database/Kollektiv
#
#lowercase server alias for the first database file
#
server.dbname.0=""
#
#SqlTool urlid used by UNIX init script. (This property is not used if your
are running Server/Webserver on a
#platform other than UNIX, or of you are not using our UNIX init script).
#
server.urlid.0=NONE
#
#no extensive messages displayed on console
#
server.silent=true
#
#JDBC trace messages displayed on console
#
server.trace=false
file: openejb.conf
...
<Connector id="APPLDB">
# HSqlDB example
#
# This connector does work as is, the drivers are shipped
# with every OpenEJB distribution and should be in the
# OPENEJB_HOME/lib directory.
#
# Information on HsqlDB can be found at:
# http://www.hsqldb.org
JdbcDriver org.hsqldb.jdbcDriver
JdbcUrl jdbc:hsqldb:file:conf/default.hsql_database.conf
UserName sa
Password
</Connector>
<Connector id="APPLDBnoTx">
# HSqlDB example
#
# This connector does work as is, the drivers are shipped
# with every OpenEJB distribution and should be in the
# OPENEJB_HOME/lib directory.
#
# Information on HsqlDB can be found at:
# http://www.hsqldb.org
JdbcDriver org.hsqldb.jdbcDriver
JdbcUrl jdbc:hsqldb:file:conf/default.hsql_database.conf
UserName sa
Password
</Connector>
...
file: openejb-jar.xml
<?xml version="1.0"?>
<openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1">
<ejb-deployment ejb-name="ExportDatabaseUC" deployment-id="ExportDatabaseUC"
container-id="Default Stateful Container">
<resource-link res-ref-name="APPLDB" res-id="APPLDB"/>
<resource-link res-ref-name="APPLDBnoTx" res-id="APPLDBnoTx"/>
</ejb-deployment>
</openejb-jar>
file: ejb-jar.xml
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans
2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
<ejb-jar>
<description></description>
<enterprise-beans>
<session>
<ejb-name>ExportDatabaseUC</ejb-name>
<home>my.common.ejb.UseCaseHome</home>
<remote>my.common.ejb.UseCaseRemote</remote>
<ejb-class>my.misc.backup.ejb.ExportDatabaseUcEJB</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Bean</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
Cheers
Per