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 Tue, 08 Jan 2008 15:30:29 GMT
Please ManojS can oyu send us the code to look at ?

On Jan 8, 2008 7:15 AM, ManojS <manoj_mrs@yahoo.co.in> wrote:

>
>
> hmmm... I could able to configure openejb 3.0 locally. But for my
> enterprise
> application I must not use it for the timebeing since I am using java 1.4
> and tomcat 4.1.24 versions there. So I would prefer to solve the
> datasource
> issue mentioned earlier in openejb 1.0. Can anyone help me ?
>
> Manoj.
>
>
> David Blevins wrote:
> >
> >
> > On Jan 6, 2008, at 9:29 AM, ManojS wrote:
> >
> >>
> >> Thank you very much Mohammad and Jacek for your quick replies.
> >>
> >> Yes, I missed to set the JNDI context factory setting at first. Now
> >> the API
> >> has changed as follows.
> >>
> >> public Connection getConnection () throws Exception {
> >>      Properties properties = new Properties();
> >>        properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
> >> "org.apache.openejb.client.LocalInitialContextFactory");
> >>      Context ctx = new InitialContext(properties);
> >>      Datasource ds = (Datasource) ctx.lookup( "MyDatasource" );
> >>      return (ds!=null?ds.getConnection():null);
> >> }
> >>
> >> I have implemented this method in a session bean only. Also, for your
> >> information, I have added the datasource as resource referense in my
> >> "ejb-jar.xml" and "openejb-jar.xml" files for the session bean as
> >> follows.
> >>
> >> <resource-ref>
> >>   <res-ref-name>MyDatasource</res-ref-name>
> >>   <res-type>javax.sql.DataSource</res-type>
> >> </resource-ref>
> >>
> >> Still the problem exist.
> >>
> >> Now, as you all suggested, I will use the latest openejb 3.0. Let me
> >> configure it first, and then in any case of issues I will come back
> >> to you
> >> for help.
> >
> > As a general practice I recommend checking the log files too.  We
> > print very specific information there as well.  Say for example you
> > forgot to implement some methods from your EJBObject interface in your
> > bean, we will print a list of every method you need to add.   Say you
> > decide to start using ejb3 annotations and you try something like this
> > '@Resource EntityManager', we're going to output a message saying that
> > you need to use '@PersistenceContext EntityManager' for injection of
> > an EntityManager, etc. etc.
> >
> > It's our belief that if you make a mistake and we didn't catch it in a
> > good way and tell you enough information to move forward that the
> > mistake is really ours.  So definitely let us know if you run into any
> > situation where the error could be more helpful.
> >
> > -David
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/OpenEJB---Datasource-lookup-problem-tp14645858p14682665.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