geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepesh <deepesh...@yahoo.co.in>
Subject error in connecting to database
Date Sat, 12 Nov 2005 05:51:51 GMT
Hi,

 I am having an application [.jar]

 This contains a BMP entity Bean

 The problem is that i am not able to connect to the
database. I am trying to invoke this bean from a
client java program.

 The database is postgresql and geronimo version is
M5.

 The database connection is making in the bean class.

  The database plan is as below.

 <connector
    
xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector"
     version="1.5"
     configId="PostDS"
     parentId="org/apache/geronimo/Server" >
<dependency>
 <uri>postgresql/postgresql.jar</uri> 

</dependency>  
  <resourceadapter>
    <outbound-resourceadapter>
      <connection-definition>
           <connectionfactory-interface>
            javax.sql.DataSource
           </connectionfactory-interface>
        <connectiondefinition-instance>
          <name>PostDS</name>
          <config-property-setting name="UserName">
            postgres
          </config-property-setting>
          <config-property-setting name="Password">
            postgres
          </config-property-setting>
          <config-property-setting name="Driver">
            org.postgresql.Driver
          </config-property-setting>
          <config-property-setting
name="ConnectionURL">
          jdbc:postgresql@10.239.32.76:5432:test 
          </config-property-setting>
          <config-property-setting
name="CommitBeforeAutocommit">
            true
          </config-property-setting>
          <config-property-setting
name="ExceptionSorterClass">
           
org.tranql.connector.NoExceptionsAreFatalSorter
          </config-property-setting>
          <connectionmanager>
                
<local-transaction></local-transaction>
                   <single-pool>
                  <max-size>10</max-size>
                  <min-size>0</min-size>
                 
<blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
                 
<idle-timeout-minutes>30</idle-timeout-minutes>
                  <match-one></match-one>
                  </single-pool>
          </connectionmanager>
         
<global-jndi-name>jdbc/SavingsAccountDB</global-jndi-name>
        </connectiondefinition-instance>
      </connection-definition>
    </outbound-resourceadapter>
  </resourceadapter>
</connector>


The openejb-jar.xml is as below

?xml version="1.0"?>
<openejb-jar
xmlns="http://www.openejb.org/xml/ns/openejb-jar"
  
xmlns:naming="http://geronimo.apache.org/xml/ns/naming"
  
xmlns:sys="http://geronimo.apache.org/xml/ns/deployment"
   parentId="org/apache/geronimo/SystemJMS"
   configId="savings">

<enterprise-beans>
 <entity>
  <ejb-name>SavingsAccountBean</ejb-name>
<jndi-name>SavingsAccountEJB</jndi-name>
<resource-ref>
<ref-name>jdbc/SavingsAccountDB</ref-name>
    <resource-link>PostDS</resource-link>  
</resource-ref> 
</entity>
</enterprise-beans>
</openejb-jar>

the Database look up is as below


private final static String dbName =
"java:comp/env/jdbc/SavingsAccountDB";



Properties props = new Properties();
             
props.setProperty("java.naming.factory.initial",
                 
"org.openejb.client.RemoteInitialContextFactory");
             
props.setProperty("java.naming.provider.url","localhost:4201");
             
props.setProperty("java.naming.security.principal",
"system");
             
props.setProperty("java.naming.security.credentials",
"manager");

              Context ic = new InitialContext(props);

              DataSource ds = (DataSource)
ic.lookup(dbName);

            con = ds.getConnection();

The stack trace is as below 

javax.ejb.EJBException: ejbCreate: Unable to connect
to database. null
        at
SavingsAccountBean.ejbCreate(SavingsAccountBean.java:104)
        at
SavingsAccountBean$$FastClassByCGLIB$$2fb7ad24.invoke(<generated>)
        at
org.openejb.entity.bmp.BMPCreateMethod.execute(BMPCreateMethod.java:118)
        at
org.openejb.dispatch.DispatchInterceptor.invoke(DispatchInterceptor.java:72)
        at
org.apache.geronimo.naming.java.ComponentContextInterceptor.invoke(ComponentContextInterceptor.java:56)
        at
org.openejb.ConnectionTrackingInterceptor.invoke(ConnectionTrackingInterceptor.java:81)
        at
org.openejb.entity.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:136)
        at
org.openejb.transaction.ContainerPolicy$TxRequired.invoke(ContainerPolicy.java:140)
        at
org.openejb.transaction.TransactionContextInterceptor.invoke(TransactionContextInterceptor.java:80)
        at
org.openejb.SystemExceptionInterceptor.invoke(SystemExceptionInterceptor.java:82)
        at
org.openejb.GenericEJBContainer.invoke(GenericEJBContainer.java:238)
        at
org.openejb.server.ejbd.EjbRequestHandler.invoke(EjbRequestHandler.java:297)
        at
org.openejb.server.ejbd.EjbRequestHandler.doEjbHome_CREATE(EjbRequestHandler.java:342)
        at
org.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java:205)
        at
org.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:150)
        at
org.openejb.server.ejbd.EjbServer.service(EjbServer.java:87)
        at
org.openejb.server.ejbd.EjbServer$$FastClassByCGLIB$$d379d2ff.invoke(<generated>)
        at
net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
        at
org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
        at
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:118)
        at
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:760)
        at
org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
        at
org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvoker.java:36)
        at
org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.java:96)
        at
org.activeio.xnet.ServerService$$EnhancerByCGLIB$$21b2f92c.service(<generated>)
        at
org.activeio.xnet.ServicePool$2.run(ServicePool.java:67)
        at
org.activeio.xnet.ServicePool$3.run(ServicePool.java:90)
        at
org.apache.geronimo.pool.ThreadPool$ContextClassLoaderRunnable.run(ThreadPool.java:138)
        at
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown
Source)
        at java.lang.Thread.run(Thread.java:534)


can any one tell that what is wrong with this.

Regards

Deepesh



		
__________________________________________________________ 
Enjoy this Diwali with Y! India Click here http://in.promos.yahoo.com/fabmall/index.html

Mime
View raw message