tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mohammad Nour El-Din" <nour.moham...@gmail.com>
Subject Re: OpenEJB - Datasource lookup problem
Date Sun, 06 Jan 2008 15:37:53 GMT
Hi ManojS...

  First thanks for using OpenEJB and thanks again for sharing your problems
with us to tyr make OpenEJB better :). I recommend to use OpenEJB 3.0 as it
is the most updated version and all of the current development is made on
it. I still can't understand from where you call this method, is it a method
in your bean ??? but from what I see in the code, you have to initialize the
naming conext first with the proper poperties to be able to use. If it is
applicable we would like to look at your code to give a more precise answer.

On Jan 6, 2008 11:51 AM, ManojS <manoj_mrs@yahoo.co.in> wrote:

>
> Hello,
>
> I was playing with openejb and a test ejb application in my machine. My
> intention was to identify how much openejb is useful for me as an ejb
> container, so that I can recommend to use at my workplace. While I was
> trying to integrate openejb along with the application I cannot able to
> lookup the datasource connection defined in the openejb.conf file. If I
> explain in detail, my openejb.conf has the following connection
> configuration.
>
> <Connector id="MyDatasource" type="Datasource">
>    JdbcDriver   org.gjt.mysql.Driver
>    JdbcUrl      jdbc:mysql://localhost:3306/test_db
>    UserName     root
>    Password     12345
>    jtamanaged   true
> </Connector>
>
> I am using the "Default Stateless Container" with ctype="STATELESS". And
> my
> ejb code (my ejbs are stateless session beans) for datasource lookup is as
> follows,
>
> public Connection getConnection () throws Exception {
>        Context ctx = new InitialContext();
>        Datasource ds = (Datasource) ctx.lookup( "MyDatasource" );
>        return (ds!=null?ds.getConnection():null);
> }
>
> This code is throwing a javax.naming.NameNotFoundException. I tried with
> various other JNDI names like "java:comp/MyDatasource",
> "java:openejb/MyDatasource" etc. But the same result.
>
> The openejb version I am using is 1.0, because the EJB version I was using
> is 2.0.
>
> Can anyone help me to figure out what is the JNDI name to use for
> connector
> lookup ?
>
> Thanks in advance.
>
> Manoj.
>
> --
> View this message in context:
> http://www.nabble.com/OpenEJB---Datasource-lookup-problem-tp14645858p14645858.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
>


-- 
Thanks
- Mohammad Nour

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message