[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Regarding Connetion pooling
Chinni
do-not-reply at jboss.com
Mon Oct 22 10:44:27 EDT 2007
In jboss-4.2.1 I am able to execute a Stored Procedure by taking connection normally
like this,
Connection con = null;
Class.forName("com.inet.tds.TdsDriver");
con = DriverManager.getConnection(
"jdbc:inetdae:172.16.72.46:1433?database=Main?, "sa", ??);
System.out.println((new StringBuilder("1. *********************** ")).append(con).toString());
CallableStatement cs = con.prepareCall("dal_ps_get_suborders_ready_to_auth");
System.out.println((new StringBuilder("2. *********************** ")).append(cs).toString());
ResultSet rs = null;
boolean flag = cs.execute();
it is working fine.
But with connection fooling, it is not working.
I am taking the connection like this ,
InitialContext initialContext = new InitialContext();
System.out.println("2. ");
DataSource ds = (DataSource)initialContext.lookup("java:/DefaultGCDS");
System.out.println("3. ");
Connection conn = (Connection)ds.getConnection();
PreparedStatement stmt = null;
CallableStatement cstmt = conn.prepareCall("dal_ps_get_suborders_ready_to_auth");
stmt = cstmt;
System.out.println("4. ");
boolean flag = stmt.execute();
And in mssql-ds.xml file I have configured the datasource like this,
<local-tx-datasource>
<jndi-name>DefaultGCDS</jndi-name>
<connection-url>jdbc:inetdae:172.16.72.46:1433?database=Main</connection-url>
<driver-class>com.inet.tds.TdsDriver</driver-class>
<user-name>sa</user-name>
<!-- sql to call when connection is created
<new-connection-sql>some arbitrary sql</new-connection-sql>
-->
<!-- sql to call on an existing pooled connection when it is obtained from pool
<check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
-->
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -->
<type-mapping>MS SQLSERVER2000</type-mapping>
</local-tx-datasource>
Then it is giving the following exception,
19:44:57,599 WARN [TxConnectionManager] Connection error occured: org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener at 1ee145b[state=NORMAL mc=org.jboss.resource.adapter.jdbc.local.LocalManagedConnection at 1fe0816 handles=1 lastUse=1193062497458 permit=true
e mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool at c50561 context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool at e43b44 xaResource=org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource at 1d35bf2 txSync=null]
java.lang.NullPointerException
at org.jboss.resource.adapter.jdbc.CachedPreparedStatement.(CachedPreparedStatement.java:71)
at org.jboss.resource.adapter.jdbc.CachedCallableStatement.(CachedCallableStatement.java:54)
at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.prepareCall(BaseWrapperManagedConnection.java:368)
at org.jboss.resource.adapter.jdbc.WrappedConnection.prepareCall(WrappedConnection.java:269)
at com.sycronit.communication.generic.receiver.Sample.getConFromConnectionPooling(Sample.java:84)
at com.sycronit.communication.generic.receiver.AuthQueueCommandProcessor.executeCommand(AuthQueueCommandProcessor.java:11)
at com.sycronit.communication.generic.receiver.GenericStoreNetMessageRecipient.handleMessage(GenericStoreNetMessageRecipient.java:81)
at com.sycronit.communication.jms.receiver.JMSMessageRecipient.onMessage(JMSMessageRecipient.java:130)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:495)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:116)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:109)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:402)
at org.jboss.ejb.Container.invoke(Container.java:960)
at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:987)
at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1287)
at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:266)
at progress.message.jimpl.Session.deliver(Session.java:2952)
at progress.message.jimpl.Session.run(Session.java:2331)
at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:196)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
at java.lang.Thread.run(Thread.java:595)
19:44:57,599 ERROR [STDERR] org.jboss.util.NestedSQLException: Error; - nested throwable: (java.lang.NullPointerException)
19:44:57,599 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrappedConnection.checkException(WrappedConnection.java:557)
19:44:57,599 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrappedConnection.prepareCall(WrappedConnection.java:273)
19:44:57,599 ERROR [STDERR] at com.sycronit.communication.generic.receiver.Sample.getConFromConnectionPooling(Sample.java:84)
19:44:57,599 ERROR [STDERR] at com.sycronit.communication.generic.receiver.AuthQueueCommandProcessor.executeCommand(AuthQueueCommandProcessor.java:11)
19:44:57,614 ERROR [STDERR] at com.sycronit.communication.generic.receiver.GenericStoreNetMessageRecipient.handleMessage(GenericStoreNetMessageRecipient.java:81)
19:44:57,614 ERROR [STDERR] at com.sycronit.communication.jms.receiver.JMSMessageRecipient.onMessage(JMSMessageRecipient.java:130)
19:44:57,614 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
19:44:57,614 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
19:44:57,614 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
19:44:57,614 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
19:44:57,614 ERROR [STDERR] at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
19:44:57,614 ERROR [STDERR] at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:495)
19:44:57,614 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
19:44:57,614 ERROR [STDERR] at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:116)
19:44:57,614 ERROR [STDERR] at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
19:44:57,614 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
19:44:57,614 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
19:44:57,614 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
19:44:57,614 ERROR [STDERR] at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:109)
19:44:57,614 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
19:44:57,614 ERROR [STDERR] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
19:44:57,614 ERROR [STDERR] at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:402)
19:44:57,614 ERROR [STDERR] at org.jboss.ejb.Container.invoke(Container.java:960)
19:44:57,614 ERROR [STDERR] at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:987)
19:44:57,614 ERROR [STDERR] at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1287)
19:44:57,614 ERROR [STDERR] at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:266)
19:44:57,614 ERROR [STDERR] at progress.message.jimpl.Session.deliver(Session.java:2952)
19:44:57,614 ERROR [STDERR] at progress.message.jimpl.Session.run(Session.java:2331)
19:44:57,614 ERROR [STDERR] at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:196)
19:44:57,614 ERROR [STDERR] at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
19:44:57,614 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
19:44:57,614 ERROR [STDERR] Caused by: java.lang.NullPointerException
19:44:57,614 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.CachedPreparedStatement.(CachedPreparedStatement.java:71)
19:44:57,614 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.CachedCallableStatement.(CachedCallableStatement.java:54)
19:44:57,614 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.prepareCall(BaseWrapperManagedConnection.java:368)
19:44:57,614 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrappedConnection.prepareCall(WrappedConnection.java:269)
19:44:57,614 ERROR [STDERR] ... 29 more
19:44:57,614 ERROR [StdServerSession] failed to commit/rollback
If anybody knows about it, please help me.
Thanks & Regards,
Surya
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4097513#4097513
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4097513
More information about the jboss-user
mailing list