System.setProperty("openejb/Resource/DerbyDatabase", ...) ?
*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*
2013/8/19 amol.p.dongare <[email protected]>
> Hello Romain,
>
> I just have a plain command client- see below
> *Main{
> Properties props = new Properties();
> props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
> "org.apache.openejb.client.RemoteInitialContextFactory");
> props.setProperty(Context.PROVIDER_URL, "http://localhost:8080/tomee/ejb
> ");
> DataSource dsn =
> (DataSource)ctx.lookup("java:openejb/Resource/DerbyDatabase");
> }*
>
> where in tomee.xml I have configured
>
> * <Resource id="DerbyDatabase" type="DataSource" provider="Default JDBC
> Database">
> #Embedded Derby example
>
> JdbcDriver org.apache.derby.jdbc.ClientDriver
> JdbcUrl jdbc:derby://127.0.0.1:1527/data;create=false
> UserName fiperacs
> Password fiperacs
>
> </Resource>*
>
> And accessing it through above client. But throwing Following error -
>
> Aug 19, 2013 2:52:28 PM org.apache.openejb.client.EventLogger log
> INFO:
> RemoteInitialContextCreated{providerUri=http://localhost:8080/tomee/ejb}
> Exception in thread "main" javax.naming.NameNotFoundException:
> openejb/Resource/DerbyDatabase does not exist in the system. Check that
> the
> app was successfully deployed.
> at
> org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:281)
> at javax.naming.InitialContext.lookup(InitialContext.java:392)
> at com.engineous.test.Datasource.main(Datasource.java:38)
>
>
> *Is there any additional system property do I need to add at client side.I
> tried following but unfortunately no use*
>
> *System.setProperty("Resource/DataSource",
> "datasource:org.apache.derby.jdbc.ClientDataSource:jdbc:derby://
> 127.0.0.1:1527/data");*
>
>
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Error-while-looking-Derby-Datasource-from-Command-Client-in-TomEE-tp4664669p4664716.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>