The real name is openejb:Resource/yourName Le 27 juin 2013 14:36, "amol.p.dongare" <[email protected]> a écrit :
> Hi,I am trying to configure derby database in tomee+. Following is my > configurationtomee.xml #Embedded Derby example JdbcDriver > org.apache.derby.jdbc.ClientDriver JdbcUrl > jdbc:derby://127.0.0.1:56445/derbyData;create=false UserName XX > Password XX When I start my server I got a successfully configured > message > - INFO: Configuring Service(id=DerbyDatabase, type=Resource, > provider-id=Default JDBC Database)but when I am trying to look up I am > getting following messageMy client code - 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"); > //DataSource dsn= > > (DataSource)PortableRemoteObject.narrow(ctx.lookup("DerbyDatabase"),DataSource.class); > Connection con=dsn.getConnection();and After running above client I am > getting following error - *Jun 27, 2013 4:33:31 PM > org.apache.openejb.client.EventLogger logINFO: > 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) at > javax.naming.InitialContext.lookup(InitialContext.java:392) at > client.DerbyDatabaseClient.main(DerbyDatabaseClient.java:21)*Please help me > > > > -- > View this message in context: > http://openejb.979440.n4.nabble.com/Problem-while-configuring-Derby-Database-tp4663975.html > Sent from the OpenEJB User mailing list archive at Nabble.com.
