Hi,

I am trying to configure derby database in tomee+. Following is my
configuration

tomee.xml

 <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:56445/derbyData;create=false
    UserName XX
    Password XX
  </Resource>

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 message

My 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 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)
        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-in-Tomee-tp4663976.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Reply via email to