geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From BenLeino>
Subject Re: Accessing geronimo connection pool from shared library
Date Thu, 17 Apr 2008 07:42:04 GMT

Hi david,

thanks for your reply. I will change the cast to datasource.

The problem is that the shared library should work for all wars or ejbs. So
the validator should work no matter what the referencing application has
inserted in its web.xml and so so.

Let's say the library should have native database and ejb access. But
because the library isn't a JEE component itsself, I just don't get it to

Because the validator, for instance, gets called from a faces context it
seems to be managed (InitialContext works fine etc.). But because the
library itself has no resource-ref etc. I get this error message.

Did you get my point?

Thanks a lot,

djencks wrote:
> 1. I wouldn't expect the cast to ConnectionPoolDataSource to work.  I  
> think you need DataSource.
> 2. What thread is this code running in?  Unless you have created a  
> thread yourself this ought to work as long as
> 3. Does the javaee component (war?) that calls this code have the  
> resource-ref for the datasource set up properly?  Can you look up the  
> datasource from a servlet or jsp page?
> If this doesn't help showing the entire stack trace would be the next  
> step.
> thanks
> david jencks
> On Apr 16, 2008, at 6:21 AM, BenLeino wrote:
>> Hi,
>> I have googled a lot, but I can't figure out the solution myself.  
>> Maybe I
>> have a understanding problem.
>> I have a web application (WAR) that calls several EJBs and so on.  
>> Everything
>> works fine. This WAR includes a shared library within geronimos shared
>> library repository (I have written this library).
>> This library includes a validator (JSF) which needs database  
>> access. The
>> method looks like this:
>> public void validate(FacesContext arg0, UIComponent arg1, Object arg2)
>> throws ValidatorException {
>>     [...]
>>     objConnection = (ConnectionPoolDataSource)
>> context.lookup("java:comp/env/jdbc/hbTest");
>>     [...]
>> }
>> And hbTest is a well known and used connection pool in geronimo.  
>> When doing
>> this I always get "javax.naming.NotContextException".
>> How can I get the lookup to work wthout having to deploy my shared  
>> library
>> as an EJB library? Because the library is not stand alone, it is only
>> included by other EJB and WAR projects.
>> Thanks a lot in advance,
>> Tim
>> -- 
>> View this message in context: 
>> geronimo-connection-pool-from-shared-library- 
>> tp16721707s134p16721707.html
>> Sent from the Apache Geronimo - Users mailing list archive at  

View this message in context:
Sent from the Apache Geronimo - Users mailing list archive at

View raw message