tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <david.blev...@visi.com>
Subject Re: LocalInitialContextFactory - DataSource JNDI
Date Thu, 19 Jun 2008 01:30:48 GMT

On Jun 18, 2008, at 7:34 AM, Jaime Geovane Marcondes wrote:

>
> Hello!
>
>    OpenEJB is amazing to boost the development of EJB3.0.

Quite a lot of effort goes into making things as easy as possible, so  
we definitely appreciate the positive feedback!  Thank you!

>    I tried to configure OpenEJB to run in Local Mode, for debugging
> purposes. When it runs, the log shows:
>
>    javax.naming.NameNotFoundException: Name "jdbc_SecurityDS" not  
> found
>
>    I then tried to configure in ejb-jar.xml, but it didn't work.
>    But the log shows:
>
>   2008-06-18 11:22:57,671 - INFO  - Creating  
> Resource(id=jdbc_SecurityDS)
>
>    And then:
> 2008-06-18 11:22:58,125 - DEBUG - finished invoking method  
> getMovement with
> exception java.sql.SQLException: Name "jdbc_SecurityDS" not found.
>
>    My openejb.conf:
> <openejb>
> 	<Resource id="jdbc/SecurityDS" type="DataSource">
> 	    JdbcDriver  oracle.jdbc.driver.OracleDriver
> 	    JdbcUrl     jdbc:oracle:thin:@xxx.xx.xx.xxx:9921:source
> 	    UserName    sec_usr
> 	    Password    sec_usr
> 	</Resource>
>
> 	
> 	<Deployments dir="C:\projects\Services\classes\" />
> 	<Deployments jar="C:\temp\deploy\Services.jar" />
> </openejb>
>
>
>    My ejb-jar.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <ejb-jar>
> 	<enterprise-beans>
> 		<session>
> 			<ejb-name>AccountService</ejb-name>
> 			<remote>
> 				acme.com.accountservices.both.iface.AccountServices
> 			</remote>
> 			<ejb-class>
> 				acme.com.accountservices.server.ejb.AccountServicesBean
> 			</ejb-class>
> 			<session-type>Stateless</session-type>
> 			<transaction-type>Container</transaction-type>
> 			<resource-ref>
> 				<res-ref-name>jdbc/SegurancaDS</res-ref-name>
> 				<res-type>javax.sql.DataSource</res-type>
> 				<auth-type>Container</auth-type>
> 			</resource-ref>
> 		</session>
> 	</enterprise-beans>
> </ejb-jar>

With a resource-ref like that in your ejb-jar.xml, you should be able  
to lookup the DataSource from inside the AccountServicesBean like so:

    DataSource sequrancaDs = (DataSource) new  
InitialContext().lookup("java:comp/env/jdbc/SegurancaDs");

If that doesn't work, post your log output and the full stack trace  
and we probably figure out what's going on.

-David



Mime
View raw message