Hi

DerbyDatabase is not the jndi name of your datasource, it should be
java:openejb/Resource/DerbyDatabase i guess + you'd need to define the
resource on client side to be efficient (see
http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/client-resource-lookup-preview/
).

*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/16 amol.p.dongare <[email protected]>

> Hello,
>
> I have successfully configured derby data source in TomEE and accessed
> through my EJB. However when I am trying to access the same datasource
> through command client it throws following error
>
> Aug 16, 2013 3:11:08 PM org.apache.openejb.client.EventLogger log
> INFO:
> RemoteInitialContextCreated{providerUri=http://localhost:8080/tomee/ejb}
> Exception in thread "main" java.lang.ClassCastException:
> org.apache.openejb.client.ThrowableArtifact cannot be cast to
> java.lang.Error
>         at
> org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:294)
>
>
>
> My command lien client is as follows -
>
> Properties props = new Properties();
>                 props.put(Context.INITIAL_CONTEXT_FACTORY,
> "org.apache.openejb.client.RemoteInitialContextFactory");
>                 props.put(Context.PROVIDER_URL, "
> http://localhost:8080/tomee/ejb";);
>
>
>                 InitialContext ctx = new InitialContext(props);
>                 DataSource dsn = (DataSource)ctx.lookup("DerbyDatabase");
>
>
>
> Please help me.
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Error-while-looking-Derby-Datasource-from-Command-Client-in-TomEE-tp4664669.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Reply via email to