On Jun 28, 2011, at 11:50 AM, mafranko wrote:
> Hi all,
>
> I'm looking to a way to lookup a datasource deployed on WAS CE from a
> external application using the JNDI name (for example:
> jca:/console.dbpool/MYDATASOURCE/JCAManagedConnectionFactory/MYDATASOURCE).
> That's possible?
No, it's not possible. For this to make sense you would be setting up a
transaction manager and connection pool on your client. You should configure
these explicitly in your client along with the datasource.
In trunk we have recently added support for looking up @Datasource defined
datasources set up in the java:global namespace from javaee 6 geronimo app
clients. In this case the transaction manager is already set up and accessible
in a known way and we only have to set up the connection pool. I don't think
doing this is ever a very good idea, but it's required by the ee6 spec.
thanks
david jencks
>
> I'm trying to do something like that:
>
> Properties prop = new Properties();
> prop.put(Context.INITIAL_CONTEXT_FACTORY,
> "org.apache.openejb.client.RemoteInitialContextFactory");
> prop.put(Context.PROVIDER_URL, "ejbd://localhost:4201");
>
> try {
> Context initialContext = new InitialContext(prop);
> DataSource datasource =
> (DataSource)initialContext.lookup("jca:/console.dbpool/DIS_DS/JCAManagedConnectionFactory/DIS_DS");
>
>
> } catch (NamingException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
>
> This code returns the following exception:
> javax.naming.NamingException: Expected an ejb proxy, found unknown object:
> type=org.tranql.connector.jdbc.TranqlDataSource,
> toString=org.tranql.connector.jdbc.TranqlDataSource@6b106b10
> at
> org.apache.openejb.server.ejbd.JndiRequestHandler.doLookup(JndiRequestHandler.java:337)
> at
> org.apache.openejb.server.ejbd.JndiRequestHandler.processRequest(JndiRequestHandler.java:125)
> at
> org.apache.openejb.server.ejbd.EjbDaemon.processJndiRequest(EjbDaemon.java:168)
>
>
> I'm using the openEJB initial context factory but I'm not sure about that...
>
> Thanks.
>
> --
> View this message in context:
> http://apache-geronimo.328035.n3.nabble.com/Datasource-remote-lookup-tp3118919p3118919.html
> Sent from the Users mailing list archive at Nabble.com.